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.3.tar.gz (22.3 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.3-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for smlr_learn-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6d032d10d79042867d9dec49ca0c5c79fd5c50f78a906e8b5ab3d92bca11777d
MD5 1ca31bfad3cde92f730425f6f847a397
BLAKE2b-256 6a908f8de2dee277673d26facbafe61fcc2a371caeb8a22b120107ffe6e746ba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smlr_learn-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for smlr_learn-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7ed357fea055a0ecdd99cea1ade2c938f98f45cdeaca0263bb487a36c6cbe24d
MD5 ac71581f12b9ecec0e9a3778c0a0a3f2
BLAKE2b-256 1cf012ace512557de4abe03cafcc7124ac380def104dbbd12e9faa68bd502543

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