Package pyvision :: Package ml :: Module regression :: Class LogisticRegression
[hide private]
[frames] | no frames]

Class LogisticRegression

source code

object --+
         |
        LogisticRegression

This object implements a logistic regression model.

For the house-votes-84.data.txt data set this learned a model that was consistant with R.

Instance Methods [hide private]
 
__init__(self)
Create and initialize the model.
source code
 
train(self, obs, data, method='ml')
Train a logistic regression model.
source code
 
predict(self, data)
Predict the results for a dataset.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Create and initialize the model.

Overrides: object.__init__

train(self, obs, data, method='ml')

source code 

Train a logistic regression model.

Parameters:
  • obs (float in [0.0:1.0]) - these are the observations.
  • data (list of data points in rows) - floating point matrix of data
  • method (can be 'ml' (maximum likelihood) or 'fast' (least sqaures estimate)) - determines the optimization criteria.

predict(self, data)

source code 

Predict the results for a dataset.

Parameters:
  • data (list of data points in rows) - floating point matrix of data
Returns:
a probibility for each data point.