Package pycv :: Package cs :: Package ml :: Package cla :: Module score :: Class TLinearClassifier
[hide private]
[frames] | no frames]

Class TLinearClassifier

source code

ml.Predictor --+            
               |            
  cla.Classifier --+        
                   |        
cla.BinaryClassifier --+    
                       |    
       ScoringClassifier --+
                           |
                          TLinearClassifier

Thresholded linear classifier. f(x) = w^T x - b If f(x) >= 0 then return 1. Otherwise return 0. w, b are parameters.

Nested Classes [hide private]

Inherited from ml.Predictor: EarlyPrediction

Instance Methods [hide private]
 
__init__(self, w, b)
Initialize the class.
source code
 
score(self, input_point, *args, **kwds)
Return the score of an input point.
source code
 
test(self, input_data, *args, **kwds)
Predict the output classes of an array of input points.
source code

Inherited from ScoringClassifier: predict, scores

Inherited from cla.Classifier: get_error_rates

Method Details [hide private]

__init__(self, w, b)
(Constructor)

source code 
Initialize the class.
Parameters:
  • w (array of doubles) - direction of projection, same dim with input point
  • b (double) - thresholding value
Overrides: ScoringClassifier.__init__

score(self, input_point, *args, **kwds)

source code 
Return the score of an input point.
Parameters:
  • input_point (a numpy.array) - an input point
Returns:
val : double
the input point's score
Overrides: ScoringClassifier.score

test(self, input_data, *args, **kwds)

source code 
Predict the output classes of an array of input points.
Overrides: cla.Classifier.test