Metadata-Version: 2.4
Name: calfcv
Version: 0.4.0
Summary: Coarse Approximation Linear Function (CALF) Classifier
Author-email: "Carlson Research, LLC" <rolf@hrolfrc.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/carlson-research/calfcv
Project-URL: Repository, https://github.com/carlson-research/calfcv
Project-URL: Documentation, https://carlson-research.github.io/calfcv/
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24.0
Requires-Dist: scipy>=1.10.0
Requires-Dist: scikit-learn>=1.6.0
Requires-Dist: joblib>=1.3.0
Requires-Dist: pandas
Requires-Dist: matplotlib
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
Requires-Dist: sphinx>=7.0.0; extra == "dev"
Requires-Dist: pydata-sphinx-theme>=0.15.0; extra == "dev"
Requires-Dist: sphinx-gallery; extra == "dev"
Requires-Dist: numpydoc; extra == "dev"
Requires-Dist: nbsphinx; extra == "dev"
Requires-Dist: pandoc; extra == "dev"
Requires-Dist: mypy>=1.8.0; extra == "dev"
Requires-Dist: pre-commit<3.8.0; extra == "dev"
Requires-Dist: build>=1.0.0; extra == "dev"
Requires-Dist: twine>=5.0.0; extra == "dev"
Dynamic: license-file

# calfcv

[![CI](https://github.com/carlson-research/calfcv/actions/workflows/tests.yml/badge.svg)](https://github.com/carlson-research/calfcv/actions)
[![PyPI Version](https://img.shields.io/pypi/v/calfcv.svg)](https://pypi.org/project/calfcv/)
[![Python Version](https://img.shields.io/pypi/pyversions/calfcv.svg)](https://pypi.org/project/calfcv/)
[![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://carlson-research.github.io/calfcv/)
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://github.com/carlson-research/calfcv/blob/main/LICENSE)

A Python implementation of the Coarse Approximation Linear Function (CALF) algorithm for binomial classification and feature selection.
This package provides binary classification with parsimonious and interpretable feature selection.

## Features

* **Integer Weighting:** Assigns integer weights for
  interpretable linear models.
* **Cross-Validation:** Built in cross validation for
  automated  hyperparameter tuning and feature selection.
* **Sparse Data Support:** Processes high-dimensional
  `scipy.sparse` matrices with stable memory usage.
* **Multiclass and Multilabel:** Supports Scikit-Learn
  `OneVsRestClassifier`.
* **Scikit-Learn Compatibility:** Plugs directly into `Pipeline`, `GridSearchCV`, and standard estimator workflows.

## Installation

Use pip to install calfcv:

```bash
pip install calfcv
```

## Quick Start Example

Make a classification problem and train the classifier:

```python
from calfcv import CalfCV
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split

# Make a classification problem
seed = 42
X, y = make_classification(
    n_samples=30,
    n_features=5,
    n_informative=2,
    n_redundant=2,
    n_classes=2,
    random_state=seed
)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=seed)

# Train the classifier
cls = CalfCV().fit(X_train, y_train)

# Get the score on unseen data
print(cls.score(X_test, y_test))
# Output: 0.875
```

## Citation

If you use this package in your research, please cite:

> Jeffries, C.D., Ford, J.R., Tilson, J.L. et al. *A greedy regression algorithm with coarse weights offers novel advantages.* Sci Rep 12, 5440 (2022). https://doi.org/10.1038/s41598-022-09415-2

## License

This project is licensed under the BSD-3-Clause License - see the [LICENSE](LICENSE) file for details.

## Authors

* **CALF Algorithm**: Clark D. Jeffries, John R. Ford, Jeffrey L. Tilson, Diana O. Perkins, Darius M. Bost, Dayne L. Filer, and Kirk C. Wilhelmsen
* **CalfCV Python Package (`calfcv`)**: Rolf Carlson
  (rolf@hrolfrc.com)
