def predict(self, data):
     o = Output(data)
     x = self.transform.transform(data.x)
     y = x.dot(self.w) + self.b
     o.fu = y
     o.y = y
     return o
Exemple #2
0
 def predict(self, data):
     o = Output(data)
     x = self.transform.transform(data.x)
     y = x.dot(self.w) + self.b
     o.fu = y
     o.y = y
     return o
 def predict(self, data):
     o = Output(data)
     #W = pairwise.rbf_kernel(data.x,self.x,self.sigma)
     x = data.x
     if self.use_stacking:
         x = self.get_stacking_x(data)
     x = self.transform.transform(x)
     if self.method == MixedFeatureGuidanceMethod.METHOD_LASSO:
         o.y = self.learner_lasso.predict(x)
         o.fu = o.y
     else:
         o.y = x.dot(self.w) + self.b
         o.fu = o.y
         o.w = self.w
         o.true_w = self.true_w
     return o
 def predict(self, data):
     o = Output(data)
     #W = pairwise.rbf_kernel(data.x,self.x,self.sigma)
     x = data.x
     if self.use_stacking:
         x = self.get_stacking_x(data)
     x = self.transform.transform(x)
     o.y = x.dot(self.w) + self.b
     o.fu = o.y
     o.w = self.w
     o.true_w = self.true_w
     return o
    def predict(self, data):
        o = Output(data)
        x = data.x
        if self.transform is not None:
            x = self.transform.transform(x)
        y = x.dot(self.w) + self.b
        # y = np.round(y)
        # y[y >= .5] = 1
        # y[y < .5] = 0
        y = np.sign(y)
        o.y = y
        o.fu = y
        if self.label_transform is not None:
            o.true_y = self.label_transform.transform(o.true_y)

        if not self.running_cv:
            is_correct = o.y == o.true_y
            mean_train = is_correct[o.is_train].mean()
            mean_test = is_correct[o.is_test].mean()
            mean_train_labeled = is_correct[data.is_train & data.is_labeled].mean()
            pass
        return o
    def predict(self, data):
        o = Output(data)
        x = data.x
        if self.transform is not None:
            x = self.transform.transform(x)
        y = x.dot(self.w) + self.b
        #y = np.round(y)
        #y[y >= .5] = 1
        #y[y < .5] = 0
        y = np.sign(y)
        o.y = y
        o.fu = y
        if self.label_transform is not None:
            o.true_y = self.label_transform.transform(o.true_y)

        if not self.running_cv:
            is_correct = (o.y == o.true_y)
            mean_train = is_correct[o.is_train].mean()
            mean_test = is_correct[o.is_test].mean()
            mean_train_labeled = is_correct[data.is_train
                                            & data.is_labeled].mean()
            pass
        return o