Predicts the time cost of evaluating the function at x.
188744
def _cost_gp(self,x):
        
        m, _, _, _ = self.cost_model.predict_withGradients(x)
        return np.exp(m)
1005215
def _evaluate(self,x,return_indices = False):
        '''
        
        '''
        return self._evalOrDer(x,True,False)[0]
527306
def _evaluate(self,x,y):
        '''
        
        '''
        x_pos, y_pos = self.findSector(x,y)
        alpha, beta = self.findCoords(x,y,x_pos,y_pos)

        # Calculate the function at each point using bilinear interpolation
        f = (
             (1-alpha)*(1-beta)*self.f_values[x_pos,y_pos]
          +  (1-alpha)*beta*self.f_values[x_pos,y_pos+1]
          +  alpha*(1-beta)*self.f_values[x_pos+1,y_pos]
          +  alpha*beta*self.f_values[x_pos+1,y_pos+1])
        return f
152948
def predict_proba(self, X):
        """"""
        return F.softmax(self.forward(X), dim=1).data.cpu().numpy()
48547
def predict(self, X, cut_point=0.5):
        
        return np.floor(self.predict_proba(X)[:, 1] + (1 - cut_point))
1096009
def F(self, x):
        
        if isinstance(x, np.ndarray):
            nfwvals = np.ones_like(x)
            inds1 = np.where(x < 1)
            inds2 = np.where(x > 1)
            nfwvals[inds1] = (1 - x[inds1] ** 2) ** -.5 * np.arctanh((1 - x[inds1] ** 2) ** .5)
            nfwvals[inds2] = (x[inds2] ** 2 - 1) ** -.5 * np.arctan((x[inds2] ** 2 - 1) ** .5)
            return nfwvals

        elif isinstance(x, float) or isinstance(x, int):
            if x == 1:
                return 1
            if x < 1:
                return (1 - x ** 2) ** -.5 * np.arctanh((1 - x ** 2) ** .5)
            else:
                return (x ** 2 - 1) ** -.5 * np.arctan((x ** 2 - 1) ** .5)
232905
def opt(self, x_init, f_fp=None, f=None, fp=None):
        
        tnc_rcstrings = ['Local minimum', 'Converged', 'XConverged', 'Maximum number of f evaluations reached',
             'Line search failed', 'Function is constant']

        assert f_fp != None, "TNC requires f_fp"

        opt_dict = {}
        if self.xtol is not None:
            opt_dict['xtol'] = self.xtol
        if self.ftol is not None:
            opt_dict['ftol'] = self.ftol
        if self.gtol is not None:
            opt_dict['pgtol'] = self.gtol

        opt_result = optimize.fmin_tnc(f_fp, x_init, messages=self.messages,
                       maxfun=self.max_f_eval, **opt_dict)
        self.x_opt = opt_result[0]
        self.f_opt = f_fp(self.x_opt)[0]
        self.funct_eval = opt_result[1]
        self.status = tnc_rcstrings[opt_result[2]]
514974
def _compute_acq(self,x):
         
        means, stds = self.model.predict(x)
        f_acqu = 0
        for m,s in zip(means, stds):
            f_acqu += -m + self.exploration_weight * s
        return f_acqu/(len(means))
119804
def predict(self, x, *args, **kwargs):
        
        if not self.model:
            raise Exception('Not trained. Train first')

        points = self._dimensionality_check(x, ext='points')

        return self.execute(points, *args, **kwargs)[0]
801541
def _call(self, x):
        """"""

        if abs(x.ufuncs.sum() / self.sum_value - 1) <= self.sum_rtol:
            return 0
        else:
            return np.inf
1223638
def _call(self, x):
        """"""
        if self.exponent == 0:
            return self.domain.one().inner(np.not_equal(x, 0))
        elif self.exponent == 1:
            return x.ufuncs.absolute().inner(self.domain.one())
        elif self.exponent == 2:
            return np.sqrt(x.inner(x))
        elif np.isfinite(self.exponent):
            tmp = x.ufuncs.absolute()
            tmp.ufuncs.power(self.exponent, out=tmp)
            return np.power(tmp.inner(self.domain.one()), 1 / self.exponent)
        elif self.exponent == np.inf:
            return x.ufuncs.absolute().ufuncs.max()
        elif self.exponent == -np.inf:
            return x.ufuncs.absolute().ufuncs.min()
        else:
            raise RuntimeError('unknown exponent')
77905
def _evaluate(self,x):
        '''
        
        '''
        if _isscalar(x):
            y = np.nanmin([f(x) for f in self.functions])
        else:
            m = len(x)
            fx = np.zeros((m,self.funcCount))
            for j in range(self.funcCount):
                fx[:,j] = self.functions[j](x)
            y = np.nanmin(fx,axis=1)
        return y
929767
def evaluate(self, x):
        """"""

        if not hasattr(self, '_coefficients'):
            # Graph Fourier transform -> modulation -> inverse GFT.
            c = self.G.igft(self._kernels.evaluate(self.G.e).squeeze())
            c = np.sqrt(self.G.n_vertices) * self.G.U * c[:, np.newaxis]
            self._coefficients = self.G.gft(c)

        shape = x.shape
        x = x.flatten()
        y = np.full((self.n_features_out, x.size), np.nan)
        for i in range(len(x)):
            query = self._coefficients[x[i] == self.G.e]
            if len(query) != 0:
                y[:, i] = query[0]
        return y.reshape((self.n_features_out,) + shape)
128305
def predict(self, X):
        
        check_is_fitted(self, 'estimators_')

        X = check_array(X, dtype=DTYPE, order="C")
        score = self._decision_function(X)
        if score.shape[1] == 1:
            score = score.ravel()

        return score
30264
def score(self, X, y):
        """"""

        from sklearn.metrics import accuracy_score
        return accuracy_score(y, self.predict(X))
484463
def _call(self, x):
        """"""
        # Since the proximal projects onto our feasible set we can simply
        # check if it changes anything
        proj = self.proximal(1)(x)
        return np.inf if x.dist(proj) > 0 else 0
1319506
def predict_maxprob(self, x, **kwargs):
        
        return self.base_estimator_.predict(x.values, **kwargs)