Skip to main content

A scikit-learn compatible wrapper for glmnet-based logistic regression.

Project description

glmpynet

CircleCI ReadTheDocs Codecov

glmnetpp-based 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, focusing on regularized logistic regression for binary classification. The initial version uses glmnetpp’s default settings (sourced from glmnet’s R documentation or online resources) for core methods (fit, predict), with parameters like C and penalty planned for later releases.

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.

Key Features

  • High Performance: Leverages the optimized glmnetpp C++ backend for fitting models, suitable for large datasets.
  • Scikit-learn Compatible: Implements fit and predict methods, enabling seamless integration with sklearn pipelines and tools.
  • Robust Development: Built with Bazel and Conda for reproducible builds, with comprehensive glmnetpp testing for reliability.

Installation

Once released, install glmpynet via pip:

pip install glmpynet

Quick Start

Using glmpynet is as simple as any scikit-learn estimator.

import numpy as np
from glmpynet import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score

# 1. Generate synthetic data
X, y = np.random.rand(100, 10), np.random.randint(0, 2, 100)
X_train, X_test, y_train, y_test = train_test_split(X, y)

# 2. Instantiate and fit the model
model = LogisticRegression()  # Uses glmnetpp defaults
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

glmpynet is in early development, focusing on drafting Sphinx documentation, validating the glmnetpp environment with all tests, and implementing a minimal LogisticRegression with default settings. Future releases will add parameters (e.g., C, penalty) and advanced features like multi-class support. See ROADMAP.md for details.

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 MIT License.

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

glmpynet-0.4.16.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

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

glmpynet-0.4.16-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file glmpynet-0.4.16.tar.gz.

File metadata

  • Download URL: glmpynet-0.4.16.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.20

File hashes

Hashes for glmpynet-0.4.16.tar.gz
Algorithm Hash digest
SHA256 372c17c56a371dcee0d3ce524552aadbfa8b0e138979215464e52e790b65c8f0
MD5 706e44441ab6f399a8a26e3b9340ce2c
BLAKE2b-256 9d7910f1063a95ad48043eb369351157fd5ee403bd1a50912a0202c0e685b0aa

See more details on using hashes here.

File details

Details for the file glmpynet-0.4.16-py3-none-any.whl.

File metadata

  • Download URL: glmpynet-0.4.16-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.20

File hashes

Hashes for glmpynet-0.4.16-py3-none-any.whl
Algorithm Hash digest
SHA256 1de7c6db116f3b3c306ef94ba4330db47bba593ceefca2fb6bab7db812bbd5e3
MD5 50a17f2b7a0211d583b6a11bdbe69423
BLAKE2b-256 a9108b071836032b2742ed9f70528a7f020f1bec652a7f6b305cd41f04c7c6fa

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