Commits

Jure Žbontar committed da2d70e

small change

  • Participants
  • Parent commits 3de707c

Comments (0)

Files changed (1)

         for p in self.model.params:
             updates.append((p, p - learning_rate * T.grad(cost, p)))
         self.train_model = theano.function(inputs=[x, y], updates=updates)
+        self.get_output = theano.function(inputs=[x], outputs=self.model.output_test)
 
     def fit(self, X_tr, y_tr, W):
         # reset params
             epoch += 1
             for i in range(0, X_tr.shape[0] - self.batch_size + 1, self.batch_size):
                 self.train_model(X_tr[i:i + self.batch_size], y_tr[i:i + self.batch_size])
-        return MLPClassifier(self.model)
+        return MLPClassifier(self.get_output)
 
 
 class MLPClassifier(Orange.classification.Model):
-    def __init__(self, model):
-        self.model = model
-        x = T.matrix()
-        self.get_output = theano.function(inputs=[x], outputs=self.model.output_test.flatten())
+    def __init__(self, get_output):
+        self.get_output = get_output
 
     def predict(self, X_te):
         return self.get_output(X_te)
         scale=0.1,
         batch_size=10)
     cls = l(d)
+    print(cls(d))