Skip to content

Python package for Sparse Multinomial Logistic Regression (SMLR)

License

Notifications You must be signed in to change notification settings

KamitaniLab/smlr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMLR: Sparse Multinominal Logistic Regression

Sparse Multinomial Logistic Regression (SMLR) classifier, developed by Kei Majima at Kyoto Univ.

Sparse regularization by automatic relevance determination (ARD) prior was introduced to the linear multinomial logistic regression algorithm (Yamashita et al., 2008). This regularization process estimates the importance of each voxel (feature) and prunes away voxels that are not useful for prediction.

Original SLR toolbox for Matlab is available at http:https://www.cns.atr.jp/%7Eoyamashi/SLR_WEB.html.

Installation

Run the following command:

$ pip install git+https://github.com/KamitaniLab/smlr.git

Usage

import smlr

model = smlr.SMLR(max_iter=1000, tol=1e-5, verbose=1)
model.fit(x, y)
model.predict(x_test)
  • x, x_test: numpy array of input features (# of samples x # of features)
  • y: label vector consisting of integers (len(y) = # of samples; please use integers 0, 1, 2, ..., K-1 when K-class classification)

The API of this function is compatible with the logistic regression in scikit-learn.

Parameters

  • max_iter: The number of iterations in training (default 1000).
  • tol: The tolerance value of stopping criteria (default 1e-5; positive value)
  • verbose: If 1, print verbose information (default).

Attributes

  • coef_: array, shape = [n_classes, n_features]
    • Coefficient of the features in the decision function.
  • intercept_: array, shape = [n_classes]
    • Intercept (a.k.a. bias) added to the decision function.

For demonstration, try demoSMLR_20170617.py.

References

Yamashita O, Sato MA, Yoshioka T, Tong F, Kamitani Y. (2008) Sparse estimation automatically selects voxels relevant for the decoding of fMRI activity patterns. NeuroImage. doi: 10.1016/j.neuroimage.2008.05.050. http:https://www.sciencedirect.com/science/article/pii/S1053811908006940

License

The scripts provided here are released under the MIT license (http:https://opensource.org/licenses/mit-license.php).

About

Python package for Sparse Multinomial Logistic Regression (SMLR)

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages