# Fisher Scoring Logistic Regression
**Author:** [xRiskLab](https://github.com/xRiskLab)<br>
**Version:** Beta v0.1<br>
**License:** [MIT License](https://opensource.org/licenses/MIT) (2024)
## 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 statistics, 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.
- `significance`: Significance level for computing confidence intervals.
- `verbose`: Enable verbose output.
**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.
- `summary(class_idx)`: Get a summary of model parameters, standard errors, p-values, and confidence intervals for a specific class.
- `display_summary(class_idx)`: Display a summary of model parameters, standard errors, p-values, and confidence intervals for a specific class.
The algorithm is in a beta version and may require further testing and optimization to speed up matrix operations.
### 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
```
## Change Log
- **v0.1.4**
- Updated log likelihood for Multinomial Regression and minor changes to Logistic Regression for integration with scikit-learn.
- **v0.1.3**
- Added coefficients, standard errors, p-values, and confidence intervals for Multinomial Regression.
- **v0.1.2**
- Updated NumPy dependency.
- **v0.1.1**
- Added support for Python 3.9+ 🐍.
- **v0.1.0**
- Initial release of Fisher Scoring Logistic, Multinomial, and Focal Loss Regression.
Raw data
{
"_id": null,
"home_page": "https://github.com/xRiskLab/fisher-scoring",
"name": "fisher-scoring",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "fisher scoring, logistic regression, focal loss, multinomial regression",
"author": "xRiskLab",
"author_email": "contact@xrisklab.ai",
"download_url": "https://files.pythonhosted.org/packages/92/7f/2efba9daf4e5b77b3771eeaba5e3282afed9a4778d8aeddef16bc7cf23e2/fisher_scoring-0.1.4.tar.gz",
"platform": null,
"description": "# Fisher Scoring Logistic Regression\n\n**Author:** [xRiskLab](https://github.com/xRiskLab)<br>\n**Version:** Beta v0.1<br>\n**License:** [MIT License](https://opensource.org/licenses/MIT) (2024)\n\n## Overview\n\nThis repository contains Python implementations of the Fisher Scoring algorithm for various logistic regression models:\n\n1. **Fisher Scoring Logistic Regression**: Standard logistic regression using Fisher scoring.\n2. **Fisher Scoring Multinomial Regression**: Multinomial logistic regression for multi-class classification.\n3. **Fisher Scoring Focal Loss Regression**: Logistic regression with focal loss for imbalanced classification problems.\n\nThe Fisher Scoring algorithm is an iterative optimization algorithm that updates model parameters using the observed or expected Fisher information matrix.\n\n## Models\n\n### Fisher Scoring Logistic Regression\n\nThe `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 statistics, p-values, and confidence intervals.\n\n**Parameters:**\n- `epsilon`: Convergence threshold for the algorithm.\n- `max_iter`: Maximum number of iterations for the algorithm.\n- `information`: Type of information matrix to use ('expected' or 'observed').\n- `use_bias`: Include a bias term in the model.\n- `significance`: Significance level for computing confidence intervals.\n\n**Methods:**\n- `fit(X, y)`: Fit the model to the data.\n- `predict(X)`: Predict target labels for input data.\n- `predict_proba(X)`: Predict class probabilities for input data.\n- `get_params()`: Get model parameters.\n- `set_params(**params)`: Set model parameters.\n- `summary()`: Get a summary of model parameters, standard errors, p-values, and confidence intervals.\n- `display_summary()`: Display a summary of model parameters, standard errors, p-values, and confidence intervals.\n\n### Fisher Scoring Multinomial Regression\n\nThe `FisherScoringMultinomialRegression` class implements the Fisher Scoring algorithm for multinomial logistic regression, suitable for multi-class classification tasks.\n\n**Parameters:**\n- `epsilon`: Convergence threshold for the algorithm.\n- `max_iter`: Maximum number of iterations for the algorithm.\n- `information`: Type of information matrix to use ('expected' or 'observed').\n- `use_bias`: Include a bias term in the model.\n- `significance`: Significance level for computing confidence intervals.\n- `verbose`: Enable verbose output.\n\n**Methods:**\n- `fit(X, y)`: Fit the model to the data.\n- `predict(X)`: Predict target labels for input data.\n- `predict_proba(X)`: Predict class probabilities for input data.\n- `summary(class_idx)`: Get a summary of model parameters, standard errors, p-values, and confidence intervals for a specific class.\n- `display_summary(class_idx)`: Display a summary of model parameters, standard errors, p-values, and confidence intervals for a specific class.\n\nThe algorithm is in a beta version and may require further testing and optimization to speed up matrix operations.\n\n### Fisher Scoring Focal Loss Regression\n\nThe `FisherScoringFocalRegression` class implements the Fisher Scoring algorithm with focal loss, designed for imbalanced classification problems where the positive class is rare.\n\n**Parameters:**\n- `gamma`: Focusing parameter for focal loss.\n- `epsilon`: Convergence threshold for the algorithm.\n- `max_iter`: Maximum number of iterations for the algorithm.\n- `information`: Type of information matrix to use ('expected' or 'observed').\n- `use_bias`: Include a bias term in the model.\n- `verbose`: Enable verbose output.\n\nThe algorithm is experimental and may require further testing and optimization.\n\n## Installation\n\nTo use the models, clone the repository and install the required dependencies.\n\n```bash\ngit clone https://github.com/xRiskLab/fisher-scoring.git\ncd fisher-scoring\npip install -r requirements.txt\n```\n\n## Change Log\n\n- **v0.1.4**\n - Updated log likelihood for Multinomial Regression and minor changes to Logistic Regression for integration with scikit-learn.\n\n- **v0.1.3**\n - Added coefficients, standard errors, p-values, and confidence intervals for Multinomial Regression.\n\n- **v0.1.2**\n - Updated NumPy dependency.\n\n- **v0.1.1**\n - Added support for Python 3.9+ \ud83d\udc0d.\n\n- **v0.1.0**\n - Initial release of Fisher Scoring Logistic, Multinomial, and Focal Loss Regression.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python implementation of the Fisher Scoring algorithm for logistic regression, multinomial regression, and focal loss regression.",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/xRiskLab/fisher-scoring",
"Repository": "https://github.com/xRiskLab/fisher-scoring"
},
"split_keywords": [
"fisher scoring",
" logistic regression",
" focal loss",
" multinomial regression"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "dcf0e625364add2f6bc3cb0225ead5ad6b6eff5cf3e8347f5439bf35532dafb6",
"md5": "6a4bcbf62ea37ada2e3342d338c85d8c",
"sha256": "ed4b23a69f097f9258d38ed0d844c3a8d0e237301f5d7a86c2321ea6e4d70400"
},
"downloads": -1,
"filename": "fisher_scoring-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6a4bcbf62ea37ada2e3342d338c85d8c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 14223,
"upload_time": "2024-09-08T17:01:23",
"upload_time_iso_8601": "2024-09-08T17:01:23.977898Z",
"url": "https://files.pythonhosted.org/packages/dc/f0/e625364add2f6bc3cb0225ead5ad6b6eff5cf3e8347f5439bf35532dafb6/fisher_scoring-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "927f2efba9daf4e5b77b3771eeaba5e3282afed9a4778d8aeddef16bc7cf23e2",
"md5": "5db04db524944934b8db4bfb11487c7c",
"sha256": "950eb1fd3dce018af7fec27832abd4d89e7f05aa24595f9557a31774db405400"
},
"downloads": -1,
"filename": "fisher_scoring-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "5db04db524944934b8db4bfb11487c7c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 10106,
"upload_time": "2024-09-08T17:01:25",
"upload_time_iso_8601": "2024-09-08T17:01:25.513114Z",
"url": "https://files.pythonhosted.org/packages/92/7f/2efba9daf4e5b77b3771eeaba5e3282afed9a4778d8aeddef16bc7cf23e2/fisher_scoring-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-08 17:01:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "xRiskLab",
"github_project": "fisher-scoring",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "fisher-scoring"
}