Table Of Contents

Previous topic

clfs.sg.svm

Next topic

clfs.stats

This content refers to the previous stable release of PyMVPA. Please visit www.pymvpa.org for the most recent version of PyMVPA and its documentation.

clfs.smlr

Module: clfs.smlr

Inheritance diagram for mvpa.clfs.smlr:

Sparse Multinomial Logistic Regression classifier.

Classes

SMLR

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
  • trained_nsamples+: Number of samples 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)
  • unsparsify*EXPERIMENTAL* Whether to unsparsify the weights via regression. Note that it likely leads to worse classifier performance, but more interpretable weights. (Default: False)
  • std_to_keep – Standard deviation threshold of weights to keep when unsparsifying. (Default: 2.0)
  • 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

SMLRWeights

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_results: 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.
  • transformer (Functor) – This functor is called in __call__() to perform a final processing step on the to be returned dataset measure. If None, nothing is called
  • null_dist (instance of distribution estimator) – The estimated distribution is used to assign a probability for a certain value of the computed measure.