Skip to main content

Python Package of Simplex-based Multinomial Logistic Regression

Project description

SMLR: Simplex-based Multinomial Logistic Regression

Currently in v0.1.2

Introduction

This is a project of SMLR (Simplex-based Multinomial Logistic Regression) + Penalty. You may learn this model from paper by Fu et al. [1]

Starter Guidance

By pip

To create a virtual env in your device, use:

python3 -m venv .venv

Then use pip to install:

pip install smlr-learn

Fit SMLR

You can use SMLR by sklearn-like API:

from smlr import SMLR
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report


model = SMLR(penalty='l1', gamma=1.0)

X, y = make_classification(
    n_informative=10,
    n_samples=1000,
    random_state=42
)

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3,random_state=42)

model.fit(X_train, y_train)
y_pred = model.predict(X_test)

print(classification_report(y_pred, y_test))

Then you can see:

Iteration 1000, loss: 0.335493
Converged after 1786 iterations, loss: 0.335087
              precision    recall  f1-score   support

           0       0.78      0.88      0.83       135
           1       0.89      0.79      0.84       165

    accuracy                           0.83       300
   macro avg       0.83      0.84      0.83       300
weighted avg       0.84      0.83      0.83       300

References

[1] Fu, S., Chen, P., Liu, Y., & Ye, Z. (2023). Simplex-based multinomial logistic regression with diverging numbers of categories and covariate. Statistica Sinica, 33(4), 2463-2493.

Update Notice

0.1.2

  • Fix CMLR1 and CMLR2. Now CMLR1 performs correctly.
  • Enhance SMLR computation by change gradient descent optimization method to proximal gradient descent.
  • Add examples in repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smlr_learn-0.1.2.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smlr_learn-0.1.2-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file smlr_learn-0.1.2.tar.gz.

File metadata

  • Download URL: smlr_learn-0.1.2.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for smlr_learn-0.1.2.tar.gz
Algorithm Hash digest
SHA256 54d9b15d72fc4316c1113c5c2d26b6b0f63aaf923adfa531cc7cf141c3d7af24
MD5 b76cb53fe26278e800195f283fafb105
BLAKE2b-256 68ac518af17bf4cb5e4ceebc5beb5a44169daa4674f07b06287f5f112a37f636

See more details on using hashes here.

File details

Details for the file smlr_learn-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for smlr_learn-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 46f803c47475dc0d2e48c88b048f9a16a436579b492a235f88427b7f843e0ab0
MD5 1182d4e67fe75c75530d09292626d8f7
BLAKE2b-256 2678d45fad4321854fa9a5c5612514518611e52c2f24cd2ffcc1c2985d3da9ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page