mvpa.clfs.smlr
Sparse Multinomial Logistic Regression classifier.
The comprehensive API documentation for this module, including
all technical details, is available in the Epydoc-generated API
reference for mvpa.clfs.smlr (for developers).
Classes
-
class mvpa.clfs.smlr.SMLR(**kwargs)
Bases: mvpa.clfs.base.Classifier
Sparse Multinomial Logistic Regression Classifier.
This is an implementation of the SMLR algorithm published in
Krishnapuram et al., 2005 (2005, IEEE Transactions
on Pattern Analysis and Machine Intelligence). Be sure to cite
that article if you use this classifier for your work.
Note
Available state variables:
- feature_ids: Feature IDS which were used for the actual training.
- predicting_time+: Time (in seconds) which took classifier to predict
- predictions+: Most recent set of predictions
- trained_dataset: The dataset it has been trained on
- trained_labels+: Set of unique labels it has been trained on
- training_confusion: Confusion matrix of learning performance
- training_time+: Time (in seconds) which took classifier to train
- values+: Internal classifier values the most recent predictions are based on
(States enabled by default are listed with +)
See also
Please refer to the documentation of the base class for more information:
Classifier
Initialize an SMLR classifier.
| Parameters: |
- lm – The penalty term lambda. Larger values will give rise to
more sparsification. (Default: 0.1)
- convergence_tol – When the weight change for each cycle drops below this value
the regression is considered converged. Smaller values
lead to tighter convergence. (Default: 0.001)
- resamp_decay – Decay rate in the probability of resampling a zero weight.
1.0 will immediately decrease to the min_resamp from 1.0, 0.0
will never decrease from 1.0. (Default: 0.5)
- min_resamp – Minimum resampling probability for zeroed weights. (Default: 0.001)
- maxiter – Maximum number of iterations before stopping if not
converged. (Default: 10000)
- has_bias – Whether to add a bias term to allow fits to data not through
zero. (Default: True)
- fit_all_weights – Whether to fit weights for all classes or to the number of
classes minus one. Both should give nearly identical results, but
if you set fit_all_weights to True it will take a little longer
and yield weights that are fully analyzable for each class. Also,
note that the convergence rate may be different, but convergence
point is the same. (Default: True)
- implementation – Use C or Python as the implementation of
stepwise_regression. C version brings significant speedup thus is
the default one. (Default: C)
- seed – Seed to be used to initialize random generator, might be
used to replicate the run. (Default: None)
- enable_states (None or list of basestring) – Names of the state variables which should be enabled additionally
to default ones
- disable_states (None or list of basestring) – Names of the state variables which should be disabled
|
-
biases
-
getSensitivityAnalyzer(**kwargs)
- Returns a sensitivity analyzer for SMLR.
-
weights
See also
Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the SMLR documentation.
Full API documentation of SMLR in module mvpa.clfs.smlr.
-
class mvpa.clfs.smlr.SMLRWeights(clf, force_training=True, **kwargs)
Bases: mvpa.measures.base.Sensitivity
SensitivityAnalyzer that reports the weights SMLR trained
on a given Dataset.
By default SMLR provides multiple weights per feature (one per label in
training dataset). By default, all weights are combined into a single
sensitivity value. Please, see the FeaturewiseDatasetMeasure constructor
arguments how to custmize this behavior.
Note
Available state variables:
- base_sensitivities: Stores basic sensitivities if the sensitivity relies on combining multiple ones
- biases+: A 1-d ndarray of biases
- null_prob+: State variable
- null_t: State variable
- raw_result: Computed results before applying any transformation algorithm
(States enabled by default are listed with +)
See also
Please refer to the documentation of the base class for more information:
Sensitivity
Initialize the analyzer with the classifier it shall use.
| Parameters: |
- clf (Classifier) – classifier to use.
- force_training (Bool) – if classifier was already trained – do not retrain
- enable_states (None or list of basestring) – Names of the state variables which should be enabled additionally
to default ones
- disable_states (None or list of basestring) – Names of the state variables which should be disabled
- combiner (Functor) – The combiner is only applied if the computed featurewise dataset
measure is more than one-dimensional. This is different from a
transformer, which is always applied. By default, the sum of
absolute values along the second axis is computed.
|
See also
Derived classes might provide additional methods via their base classes. Please refer to the list of base classes (if it exists) at the begining of the SMLRWeights documentation.
Full API documentation of SMLRWeights in module mvpa.clfs.smlr.