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.10.tar.gz (5.5 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.10-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: glmpynet-0.4.10.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for glmpynet-0.4.10.tar.gz
Algorithm Hash digest
SHA256 f40189ac765ff1162e8fa122d789f90268cf2b03fd78fa70ff0c5f72581f7444
MD5 90e46e75813f6a0d7ef946197e862132
BLAKE2b-256 b465756144ed98b2f9043f9521722f2a405935b42c029cc11c9a57ce9c7c8b71

See more details on using hashes here.

File details

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

File metadata

  • Download URL: glmpynet-0.4.10-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for glmpynet-0.4.10-py3-none-any.whl
Algorithm Hash digest
SHA256 29357b29aafdd5394e66af7654e9c2af1048441edd06c8910e4e87e0a594414b
MD5 7e9fa9b149324d032ca24d418d8659da
BLAKE2b-256 5679d83f0f14550ab521690d4bcb520758368b5062935d7c4c586496d9919e0e

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