A scikit-learn compatible wrapper for glmnet-based logistic regression.
Project description
glmpynet
High-Performance Logistic Regression for Scikit-Learn
glmpynet is a Python package that provides a scikit-learn-compatible LogisticRegression API powered by the high-performance glmnetpp C++ library.
This project bridges the computational speed of glmnetpp with the ease-of-use of the Python data science ecosystem, acting as a drop-in replacement for sklearn.linear_model.LogisticRegression for regularized logistic regression.
Key Features
- High Performance: Designed to leverage the optimized
glmnetppC++ backend for fitting models, suitable for large datasets. (Note: Currently uses a mock backend for API development). - Fully Scikit-learn Compatible: Implements the full estimator API, including
fit,predict, andpredict_proba, enabling seamless integration withsklearntools likePipelineandGridSearchCV. - User-Friendly Hybrid API: Accepts both standard Scikit-learn parameters (e.g.,
C,penalty) for ease of use andglmnet-native parameters (e.g.,alpha,nlambda) for advanced control. - Robust Development: Built with Bazel and Conda for reproducible builds, with a comprehensive test suite to ensure reliability.
Installation
Once released, install glmpynet via pip:
pip install glmpynet
Quick Start
Using glmpynet is as simple as any Scikit-learn estimator.
from glmpynet.logistic_regression import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.datasets import make_classification
from sklearn.metrics import accuracy_score
# 1. Generate synthetic data
X, y = make_classification(n_samples=1000, n_features=50, n_informative=10, random_state=42)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
# 2. Instantiate and fit the model using familiar sklearn parameters
model = LogisticRegression(penalty='l1', C=0.5)
model.fit(X_train, y_train)
# 3. Make predictions
y_pred = model.predict(X_test)
# 4. Evaluate the model
accuracy = accuracy_score(y_test, y_pred)
print(f"Model Accuracy: {accuracy:.2f}")
Project Status
The Python API for glmpynet.LogisticRegression is now complete and fully tested against a mock backend. The next major phase of development is to implement the real C++ binding that connects this API to the glmnetpp engine.
See the ROADMAP.md for the full development plan.
Contributing
Contributions are welcome! See CONTRIBUTING.md for guidelines on reporting bugs, suggesting features, or submitting pull requests.
License
This project is distributed under the GNU General Public License version 2.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file glmpynet-0.5.7.tar.gz.
File metadata
- Download URL: glmpynet-0.5.7.tar.gz
- Upload date:
- Size: 24.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55c5105a988dca71b90079b9b7c0b0f3328590766a09bf61c61d8e742e2be0a3
|
|
| MD5 |
6c318c51e9b0a4c360a5f35ced2653c7
|
|
| BLAKE2b-256 |
d476b9fe7c94f947646720a34c741769e0f082b7003508123e33924e48725b29
|
File details
Details for the file glmpynet-0.5.7-py3-none-any.whl.
File metadata
- Download URL: glmpynet-0.5.7-py3-none-any.whl
- Upload date:
- Size: 22.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab8f5f7da61d5ca8f6bfe0c73a0ee0c0642061e8c28866f84e3f1c8046c4b705
|
|
| MD5 |
741a257a02b5abc5cd4aad6632cb733f
|
|
| BLAKE2b-256 |
938fd9c460dbbd1dd5f1f809d8d04c231595ba20e7c588280a04376444ceca71
|