python evaluation wrapper

        Returns:
        ----------
        None
558059
def do_python_eval(self):
        
        annopath = os.path.join(self.data_path, 'Annotations', '{:s}.xml')
        imageset_file = os.path.join(self.data_path, 'ImageSets', 'Main', self.image_set + '.txt')
        cache_dir = os.path.join(self.cache_path, self.name)
        aps = []
        # The PASCAL VOC metric changed in 2010
        use_07_metric = True if int(self.year) < 2010 else False
        print('VOC07 metric? ' + ('Y' if use_07_metric else 'No'))
        for cls_ind, cls in enumerate(self.classes):
            filename = self.get_result_file_template().format(cls)
            rec, prec, ap = voc_eval(filename, annopath, imageset_file, cls, cache_dir,
                                     ovthresh=0.5, use_07_metric=use_07_metric)
            aps += [ap]
            print('AP for {} = {:.4f}'.format(cls, ap))
        print('Mean AP = {:.4f}'.format(np.mean(aps)))
966662
def call_eval(self, value, caller, return_value=True, **kwargs):
        
        value = self.name_to_system_object(value)
        if return_value and isinstance(value, AbstractStatusObject):
            return value.status
        if hasattr(value, 'call'):
            return self.call_eval(value.call(caller, **kwargs), caller, return_value, **kwargs)
        else:
            return value
1029666
def eval(self, restore_model_path: Optional[str]=None) -> None:
        

        saver = tf.train.Saver()
        with tf.Session(config=allow_growth_config) as sess:
            if restore_model_path:
                logger.info("restoring model from %s", restore_model_path)
                saver.restore(sess, restore_model_path)
            else:
                assert self.saved_model_path, "{}".format(self.saved_model_path)
                logger.info("restoring model from %s", self.saved_model_path)
                saver.restore(sess, self.saved_model_path)

            test_x, test_x_lens, test_y = self.corpus_reader.test_batch()

            feed_dict = {self.batch_x: test_x,
                         self.batch_x_lens: test_x_lens,
                         self.batch_y: test_y}

            test_ler, dense_decoded, dense_ref = sess.run(
                [self.ler, self.dense_decoded, self.dense_ref],
                feed_dict=feed_dict)
            hyps, refs = self.corpus_reader.human_readable_hyp_ref(
                dense_decoded, dense_ref)
            # Log hypotheses
            hyps_dir = os.path.join(self.exp_dir, "test")
            if not os.path.isdir(hyps_dir):
                os.mkdir(hyps_dir)
            with open(os.path.join(hyps_dir, "hyps"), "w",
                      encoding=ENCODING) as hyps_f:
                for hyp in hyps:
                    print(" ".join(hyp), file=hyps_f)
            with open(os.path.join(hyps_dir, "refs"), "w",
                      encoding=ENCODING) as refs_f:
                for ref in refs:
                    print(" ".join(ref), file=refs_f)

            test_per = utils.batch_per(hyps, refs)
            assert test_per == test_ler
            with open(os.path.join(hyps_dir, "test_per"), "w",
                      encoding=ENCODING) as per_f:
                print("LER: %f" % (test_ler), file=per_f)
410138
def valuewrapper(f, arguments=None):
    
    def wrapper(**kwds):
        value = kwds.pop('value')
        return f(value, **kwds)

    if arguments is None:
        wrapper.__dict__.update(f.__dict__)
    else:
        wrapper.__dict__.update(arguments)

    return wrapper
976368
def _eval(self, m: EvalParam) -> object:
        
        if inspect.ismethod(m) or inspect.isroutine(m):
            return m()
        elif inspect.isfunction(m):
            return m(self) if len(inspect.signature(m)) > 0 else m()
        else:
            return m
12345
def eval_py(self, _globals, _locals):
        
        try:
            params = eval(self.script, _globals, _locals)
        except NameError as e:
            raise Exception(
                'Failed to evaluate parameters: {}'
                .format(str(e))
            )
        except ResolutionError as e:
            raise Exception('GetOutput: {}'.format(str(e)))

        return params
316933
public Object eval( CallStack callstack, Interpreter interpreter)
        throws EvalError
    {
        if ( jjtGetNumChildren() > 0 )
            type = ((BSHType)jjtGetChild(0)).getType( callstack, interpreter );
        else
            type = UNTYPED;

        if (isVarArgs)
            type = Array.newInstance(type, 0).getClass();

        return type;
    }
1162826
def evaluate(self, **kwargs):
        
        self._eval_points = kwargs.get('points', self._init_array())
        self._dimension = len(self._eval_points[0])
755604
def get(self):
        
        if not self._evaluated:
            self._val = self._func(*self._args, **self._kwargs)
            self._evaluated = True
        return self._val
1338281
def _eval_call(self, node):
        
        try:
            func = self.functions[node.func.id]
        except KeyError:
            raise NameError(node.func.id)

        value = func(
            *(self._eval(a) for a in node.args),
            **dict(self._eval(k) for k in node.keywords)
        )

        if value is True:
            return 1
        elif value is False:
            return 0
        else:
            return value
763603
def evaluate(self,n, features, stack_float, stack_bool,labels=None):
        """"""
        np.seterr(all='ignore')
        if len(stack_float) >= n.arity['f'] and len(stack_bool) >= n.arity['b']:
            if n.out_type == 'f':
                stack_float.append(
                    self.safe(self.eval_dict[n.name](n,features,stack_float,
                                                     stack_bool,labels)))
                if (np.isnan(stack_float[-1]).any() or
                    np.isinf(stack_float[-1]).any()):
                    print("problem operator:",n)
            else:
                stack_bool.append(self.safe(self.eval_dict[n.name](n,features,
                                                                   stack_float,
                                                                   stack_bool,
                                                                   labels)))
                if np.isnan(stack_bool[-1]).any() or np.isinf(stack_bool[-1]).any():
                    print("problem operator:",n)
955420
def evaluate(self, verbose=False, decode=True, passes=None, num_threads=1, apply_experimental=True):
        
        evaluated_index = self.index.evaluate(verbose, decode, passes, num_threads, apply_experimental)
        evaluated_data = OrderedDict((column.name, column.evaluate(verbose, decode, passes,
                                                                   num_threads, apply_experimental))
                                     for column in self._iter())

        return DataFrame(evaluated_data, evaluated_index)
66026
def eval(cls, exp, files=None):
        
        return cls.show(cls.get(exp, files=files))
114090
def _eval(self, v, in_bounds, der):
        """"""
        result = np.zeros_like(v, dtype='float')
        x_indices = np.searchsorted(self._x, v, side='rigth')
        ids = x_indices[in_bounds] - 1
        u = v[in_bounds] - self._x[ids]
        result[in_bounds] = self._poly_eval(u, ids, der)
        return result
1021648
def _evaluate_standard(op, op_str, a, b, **eval_kwargs):
    
    if _TEST_MODE:
        _store_test_result(False)
    with np.errstate(all='ignore'):
        return op(a, b)
1308980
def evaluate():
    
    print(eval_model)
    eval_model.initialize(mx.init.Xavier(), ctx=context[0])
    eval_model.hybridize(static_alloc=True, static_shape=True)
    epoch = args.from_epoch if args.from_epoch else 0
    while epoch < args.epochs:
        checkpoint_name = '%s.%s'%(args.save, format(epoch, '02d'))
        if not os.path.exists(checkpoint_name):
            print('Wait for a new checkpoint...')
            # check again after 600 seconds
            time.sleep(600)
            continue
        eval_model.load_parameters(checkpoint_name)
        print('Loaded parameters from checkpoint %s'%(checkpoint_name))
        start_epoch_time = time.time()
        final_test_L = test(test_data, test_batch_size, ctx=context[0])
        end_epoch_time = time.time()
        print('[Epoch %d] test loss %.2f, test ppl %.2f'%
              (epoch, final_test_L, math.exp(final_test_L)))
        print('Epoch %d took %.2f seconds.'%(epoch, end_epoch_time - start_epoch_time))
        sys.stdout.flush()
        epoch += 1
669821
def eval(self, packet):
        
        try:
            context = createPacketContext(packet)
            result  = eval(self._code, packet._defn.globals, context)
        except ZeroDivisionError:
            result = None

        return result