Skip to content

Commit ade32c0

Browse files
committed
added method to get the score of each function
1 parent a6a6afb commit ade32c0

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

src/layers/logistic_sgd.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,7 @@ def errors(self, y):
4545
raise NotImplementedError()
4646

4747
def prediction(self):
48-
return self.y_pred;
48+
return self.y_pred;
49+
50+
def posterior(self):
51+
return self.p_y_given_x;

src/models/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,19 @@ def getLabelFunction(self):
164164
givens={self.x: in_x},name='labels',
165165
allow_input_downcast=True)#,on_unused_input='warn')
166166
return fn
167+
168+
def getScoreFunction(self):
169+
"""
170+
Get Function for getting score for each labels
171+
172+
:returns theano.function
173+
A function takes input features
174+
"""
175+
in_x = self.x.type('in_x');
176+
fn = theano.function(inputs=[in_x],outputs=self.logLayer.posterior(),
177+
givens={self.x: in_x},name='score',
178+
allow_input_downcast=True)#,on_unused_input='warn')
179+
return fn
167180

168181
def __l1Regularization__(self,start=0):
169182
"""

0 commit comments

Comments
 (0)