Package mvpa :: Package clfs :: Module glmnet :: Class _GLMNET
[hide private]
[frames] | no frames]

Class _GLMNET

source code


GLM-Net regression (GLMNET) Classifier.

GLM-Net is the model selection algorithm from:

Friedman, J., Hastie, T. and Tibshirani, R. (2008) Regularization Paths for Generalized Linear Models via Coordinate Descent. http://www-stat.stanford.edu/~hastie/Papers/glmnet.pdf

To make use of GLMNET, you must have R and RPy installed as well as both the glmnet contributed package. You can install the R and RPy with the following command on Debian-based machines:

sudo aptitude install python-rpy python-rpy-doc r-base-dev

You can then install the glmnet package by running R as root and calling:

install.packages()

Nested Classes [hide private]

Inherited from misc.state.ClassWithCollections: __metaclass__

Instance Methods [hide private]
 
__init__(self, **kwargs)
Initialize GLM-Net.
source code
 
_train(self, dataset)
Train the classifier using data (Dataset).
source code
 
_predict(self, data)
Predict the output for the provided data.
source code
 
_getFeatureIds(self)
Return ids of the used features
source code
 
getSensitivityAnalyzer(self, **kwargs)
Returns a sensitivity analyzer for GLMNET.
source code

Inherited from base.Classifier: __repr__, __str__, clone, isTrained, predict, repredict, retrain, summary, train, trained, untrain

Inherited from base.Classifier (private): _postpredict, _posttrain, _prepredict, _pretrain, _regressionIsBogus, _setRetrainable

Inherited from misc.state.ClassWithCollections: __getattribute__, __new__, __setattr__, reset

Inherited from object: __delattr__, __format__, __hash__, __reduce__, __reduce_ex__, __sizeof__, __subclasshook__

Class Variables [hide private]
  _clf_internals = ['glmnet', 'linear', 'has_sensitivity', 'does...
Describes some specifics about the classifier -- is that it is doing regression for instance....
  family = Parameter('gaussian', allowedtype= 'basestring', choi...
  alpha = Parameter(1.0, min= 0.01, max= 1.0, allowedtype= 'floa...
  nlambda = Parameter(100, allowedtype= 'int', min= 1, doc= """M...
  standardize = Parameter(True, allowedtype= 'bool', doc= """Whe...
  thresh = Parameter(1e-4, min= 1e-10, max= 1.0, allowedtype= 'f...
  pmax = Parameter(None, min= 1, allowedtype= 'None or int', doc...
  maxit = Parameter(100, min= 10, allowedtype= 'int', doc= """Ma...
  model_type = Parameter('covariance', allowedtype= 'basestring'...
  weights = property(lambda self: self.__weights)

Inherited from base.Classifier: _DEV__doc__, feature_ids, predicting_time, predictions, regression, retrainable, trained_dataset, trained_labels, trained_nsamples, training_confusion, training_time, values

Inherited from misc.state.ClassWithCollections: descr

Instance Variables [hide private]
  __weights
The beta weights for each feature.
  __trained_model
The model object after training that will be used for predictions.
  __trained_model_dict
The model object in dict form after training that will be used for predictions.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **kwargs)
(Constructor)

source code 

Initialize GLM-Net.

See the help in R for further details on the parameters

Overrides: object.__init__

_train(self, dataset)

source code 
Train the classifier using data (Dataset).
Overrides: base.Classifier._train

_predict(self, data)

source code 
Predict the output for the provided data.
Overrides: base.Classifier._predict

_getFeatureIds(self)

source code 
Return ids of the used features
Overrides: base.Classifier._getFeatureIds

getSensitivityAnalyzer(self, **kwargs)

source code 
Returns a sensitivity analyzer for GLMNET.
Overrides: base.Classifier.getSensitivityAnalyzer

Class Variable Details [hide private]

_clf_internals

Describes some specifics about the classifier -- is that it is doing regression for instance....
Value:
['glmnet', 'linear', 'has_sensitivity', 'does_feature_selection']

family

Value:
Parameter('gaussian', allowedtype= 'basestring', choices= ["gaussian",\
 "multinomial"], doc= """Response type of your labels (either 'gaussia\
n'
                       for regression or 'multinomial' for classificat\
ion).""")

alpha

Value:
Parameter(1.0, min= 0.01, max= 1.0, allowedtype= 'float', doc= """The \
elastic net mixing parameter.
                      Larger values will give rise to
                      less L2 regularization, with alpha=1.0
                      as a true LASSO penalty.""")

nlambda

Value:
Parameter(100, allowedtype= 'int', min= 1, doc= """Maximum number of l\
ambdas to calculate
                        before stopping if not converged.""")

standardize

Value:
Parameter(True, allowedtype= 'bool', doc= """Whether to standardize th\
e variables
                            prior to fitting.""")

thresh

Value:
Parameter(1e-4, min= 1e-10, max= 1.0, allowedtype= 'float', doc= """Co\
nvergence threshold for coordinate descent.""")

pmax

Value:
Parameter(None, min= 1, allowedtype= 'None or int', doc= """Limit the \
maximum number of variables ever to be
             nonzero.""")

maxit

Value:
Parameter(100, min= 10, allowedtype= 'int', doc= """Maximum number of \
outer-loop iterations for
             'multinomial' families.""")

model_type

Value:
Parameter('covariance', allowedtype= 'basestring', choices= ["covarian\
ce", "naive"], doc= """'covariance' saves all inner-products ever
             computed and can be much faster than 'naive'. The
             latter can be more efficient for
             nfeatures>>nsamples situations.""")