AdaptoLogit package
Introduction
AdaptoLogit is a python package that proposes the implementation of adaptive lasso to solve logistic regression models.
Dependencies
AdaptoLogit requires:
- Numpy >= 1.2
- SciPy >= 1.7.0
- Scikit-learn >= 1.0
User installation
If you already have a working installation of numpy, scipy and scikit-learn, the easiest way to install AdaptoLogit is using pip:
pip install AdaptoLogit
Usage Example
In the following example, the package is used to apply adaptive lasso logistic regression on simulated binary data. Cross validation is carried out to get the optimal subset of parameters for the data.
from sklearn.model_selection import GridSearchCV
import numpy as np
import AdaptoLogit as al
from sklearn.datasets import make_classification
# Generate data
X, y = make_classification(random_state=8) # 100 samples, 20 features, 2 informative
# Estimate weights
weight = al.AdaptiveWeights(power_weight=(0.5,1,1.5))
weight.fit(X, y)
# Build model
model = al.AdaptiveLogistic()
# Cross validation for best subset of parameters
param_grid = {'C':[1e-3, 1e-2, 1e-1, 1, 10, 100, 1000], 'weight_array': weight.lasso_weights_,
'solver': ['saga','liblinear'], 'max_iter': [1000, 10000]}
grid_search = GridSearchCV(model, param_grid, cv=3, scoring='accuracy', n_jobs=8)
grid_search.fit(X, y)
final_model = grid_search.best_estimator_
# Model coefficients
print("Model coefficients ", final_model.coef_)
Metadata
Release files for AdaptoLogit 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| AdaptoLogit-0.0.1.tar.gz | 20.0 kB | Without provenance | Details |
Release files / AdaptoLogit-0.0.1.tar.gz
| Download URL | AdaptoLogit-0.0.1.tar.gz |
|---|---|
| Size | 20.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0265f2796db3c00c10c79a3b2fe57a458524f36e34981f5c2c01e41803876fa1
|
|
BLAKE2b-256 checksum How to use checksums |
3817239b6ac60a526a79c0a4c1263e2fa9dcffd569916efb0a5eeadafbf60938
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.5
|
Security for AdaptoLogit 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.