Metadata-Version: 2.1
Name: fisher-scoring
Version: 0.1.1
Summary: A Python implementation of the Fisher Scoring algorithm for logistic regression, multinomial regression, and focal loss regression.
Home-page: https://github.com/xRiskLab/fisher-scoring
License: MIT
Keywords: fisher scoring,logistic regression,focal loss,multinomial regression
Author: xRiskLab
Author-email: contact@xrisklab.ai
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Dist: black (>=24.4.2,<25.0.0)
Requires-Dist: fixit (>=2.1.0,<3.0.0)
Requires-Dist: isort (>=5.13.2,<6.0.0)
Requires-Dist: numpy (>=2.0.1,<3.0.0)
Requires-Dist: pandas (>=2.2.2,<3.0.0)
Requires-Dist: pylint (>=3.2.6,<4.0.0)
Requires-Dist: pytest (>=8.3.2,<9.0.0)
Requires-Dist: pytest-mock (>=3.14.0,<4.0.0)
Requires-Dist: rich (>=13.7.1,<14.0.0)
Requires-Dist: scikit-learn (>=1.5.1,<2.0.0)
Project-URL: Repository, https://github.com/xRiskLab/fisher-scoring
Description-Content-Type: text/markdown

# Fisher Scoring Logistic Regression Suite

Author: xRiskLab
GitHub: [xRiskLab](https://github.com/xRiskLab)  
Beta Version: 0.1  
2024 MIT License  

## Overview

This repository contains Python implementations of the Fisher Scoring algorithm for various logistic regression models:

1. **Fisher Scoring Logistic Regression**: Standard logistic regression using Fisher scoring.
2. **Fisher Scoring Multinomial Regression**: Multinomial logistic regression for multi-class classification.
3. **Fisher Scoring Focal Loss Regression**: Logistic regression with focal loss for imbalanced classification problems.

The Fisher Scoring algorithm is an iterative optimization algorithm that updates model parameters using the observed or expected Fisher information matrix.

## Models

### Fisher Scoring Logistic Regression

The `FisherScoringLogisticRegression` class is a custom implementation of logistic regression using the Fisher scoring algorithm. It provides methods for fitting the model, making predictions, and computing model statistics, including standard errors, Wald statistic, p-values, and confidence intervals.

**Parameters:**
- `epsilon`: Convergence threshold for the algorithm.
- `max_iter`: Maximum number of iterations for the algorithm.
- `information`: Type of information matrix to use ('expected' or 'observed').
- `use_bias`: Include a bias term in the model.
- `significance`: Significance level for computing confidence intervals.

**Methods:**
- `fit(X, y)`: Fit the model to the data.
- `predict(X)`: Predict target labels for input data.
- `predict_proba(X)`: Predict class probabilities for input data.
- `get_params()`: Get model parameters.
- `set_params(**params)`: Set model parameters.
- `summary()`: Get a summary of model parameters, standard errors, p-values, and confidence intervals.
- `display_summary()`: Display a summary of model parameters, standard errors, p-values, and confidence intervals.

### Fisher Scoring Multinomial Regression

The `FisherScoringMultinomialRegression` class implements the Fisher Scoring algorithm for multinomial logistic regression, suitable for multi-class classification tasks.

**Parameters:**
- `epsilon`: Convergence threshold for the algorithm.
- `max_iter`: Maximum number of iterations for the algorithm.
- `information`: Type of information matrix to use ('expected' or 'observed').
- `use_bias`: Include a bias term in the model.
- `verbose`: Enable verbose output.

The algorithm is in a beta version and may require further testing and optimization.

### Fisher Scoring Focal Loss Regression

The `FisherScoringFocalRegression` class implements the Fisher Scoring algorithm with focal loss, designed for imbalanced classification problems where the positive class is rare.

**Parameters:**
- `gamma`: Focusing parameter for focal loss.
- `epsilon`: Convergence threshold for the algorithm.
- `max_iter`: Maximum number of iterations for the algorithm.
- `information`: Type of information matrix to use ('expected' or 'observed').
- `use_bias`: Include a bias term in the model.
- `verbose`: Enable verbose output.

The algorithm is experimental and may require further testing and optimization.

## Installation

To use the models, clone the repository and install the required dependencies.

```bash
git clone https://github.com/xRiskLab/fisher-scoring.git
cd fisher-scoring
pip install -r requirements.txt
```

