Skip to main content

Python Package of Simplex-based Multinomial Logistic Regression

Project description

SMLR Project

Introduction

This is a project of SMLR (Simplex-based Multinomial Logistic Regression) + Penalty. You may know 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] S. Fu, P. Chen, Y. Liu, and Z. Ye, “Simplex-based Multinomial Logistic Regression with Diverging Numbers of Categories and Covariates,” STAT SINICA, 2024, doi: 10.5705/ss.202021.0082.

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.1.tar.gz (9.0 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.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for smlr_learn-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c5de351945f4762071e9fe17c2f28839da37f33cd23be2a646fe0b3e11e891ec
MD5 25e1996b7775decc45d9f083eb1b2634
BLAKE2b-256 f36b818086853f52e0abfada02f91c77a9fb94b30ccd50d72b82e21100888873

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for smlr_learn-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f3bb1c547427f95c6088e44c2bf67ca4ee86f5637f482087b1fcaed5e9675ce1
MD5 8ebb139ecf33c07b9dabb8c411ed91d6
BLAKE2b-256 68dda7e4458bc3f687b187485292d6ba6dcec1ad19e33575f8c28a66c45394df

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