<h1 align="center">MLQuantify</h1>
<h4 align="center">A Python Package for Quantification</h4>
___
**mlquantify** is a Python library for quantification, also known as supervised prevalence estimation, designed to estimate the distribution of classes within datasets. It offers a range of tools for various quantification methods, model selection tailored for quantification tasks, evaluation metrics, and protocols to assess quantification performance. Additionally, mlquantify includes popular datasets and visualization tools to help analyze and interpret results.
___
## Latest Release
- **Version 0.0.11.6**: Inicial beta version. For a detailed list of changes, check the [changelog](#).
- In case you need any help, refer to the [wiki](https://github.com/luizfernandolj/mlquantify/wiki).
- Explore the [API documentation](#) for detailed developer information.
- See also the library in the pypi site in [pypi mlquantify](https://pypi.org/project/mlquantify/)
___
## Installation
To install mlquantify, run the following command:
```bash
pip install mlquantify
```
If you only want to update, run the code below:
```bash
pip install --update mlquantify
```
___
## Contents
| Section | Description |
|---|---|
| **21 Quantification Methods** | Methods for quantification, such as classify & Count Correct methods, Threshold Optimization, Mixture Models and more.|
| **Dynamic class management** | All methods are dynamic, and handles multiclass and binary problems, in case of binary it makes One-Vs-All (OVA) automatically. |
| **Model Selection** | Criteria and processes used to select the best model, such as grid-search for the case of quantification|
| **Evaluation Metrics** | Specific metrics used to evaluate quantification performance, (e.g., AE, BIAS, NAE, SE, KLD, etc.). |
| **Evaluation Protocols** | Evaluation protocols used, based on sampling generation (e.g., APP, NPP, etc.).. |
| **Plotting Results** | Tools and techniques used to visualize results, such as the protocol results.|
| **Comprehensive Documentation** | Complete documentation of the project, including code, data, and results. |
___
## Quick example:
This code first loads the breast cancer dataset from _sklearn_, which is then split into training and testing sets. It uses the _Expectation Maximisation Quantifier (EMQ)_ with a RandomForest classifier to predict class prevalence. After training the model, it evaluates performance by calculating and printing the absolute error and bias between the real and predicted prevalences.
```python
import mlquantify as mq
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
# Loading dataset from sklearn
features, target = load_breast_cancer(return_X_y=True)
#Splitting into train and test
X_train, X_test, y_train, y_test = train_test_split(features, target, test_size=0.3)
#Create the model, here it is the Expectation Maximisation Quantifier (EMQ) with a classifier
model = mq.methods.EMQ(RandomForestClassifier())
model.fit(X_train, y_train)
#Predict the class prevalence for X_test
pred_prevalence = model.predict(X_test)
real_prevalence = mq.utils.get_real_prev(y_test)
#Get the error for the prediction
ae = mq.evaluation.absolute_error(real_prevalence, pred_prevalence)
bias = mq.evaluation.bias(real_prevalence, pred_prevalence)
print(f"Mean Squared Error (MSE) -> {ae:.4f}")
print(f"Bias -> {bias}")
```
___
## Requirements
- Scikit-learn
- pandas
- numpy
- joblib
- tqdm
- matplotlib
- xlrd
___
## Documentation
##### API is avaliable [here](#)
- [Methods](https://github.com/luizfernandolj/mlquantify/wiki/Methods)
- [Model Selection](https://github.com/luizfernandolj/mlquantify/wiki/Model-Selection)
- [Evaluation](https://github.com/luizfernandolj/mlquantify/wiki/Evaluation)
- [Plotting](https://github.com/luizfernandolj/mlquantify/wiki/Plotting)
- [Utilities](https://github.com/luizfernandolj/mlquantify/wiki/Utilities)
___
Raw data
{
"_id": null,
"home_page": "https://github.com/luizfernandolj/QuantifyML/tree/master",
"name": "mlquantify",
"maintainer": "Luiz Fernando Luth Junior",
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, machine learning, quantification, quantify",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/d8/9c/0e2fc03d9ca16bdff038d05fa7edfbd0c815b4ba3c118b8ee5738379b8c1/mlquantify-0.0.11.11.tar.gz",
"platform": null,
"description": "<h1 align=\"center\">MLQuantify</h1>\r\n<h4 align=\"center\">A Python Package for Quantification</h4>\r\n\r\n___\r\n\r\n **mlquantify** is a Python library for quantification, also known as supervised prevalence estimation, designed to estimate the distribution of classes within datasets. It offers a range of tools for various quantification methods, model selection tailored for quantification tasks, evaluation metrics, and protocols to assess quantification performance. Additionally, mlquantify includes popular datasets and visualization tools to help analyze and interpret results.\r\n\r\n___\r\n\r\n## Latest Release\r\n\r\n- **Version 0.0.11.6**: Inicial beta version. For a detailed list of changes, check the [changelog](#).\r\n- In case you need any help, refer to the [wiki](https://github.com/luizfernandolj/mlquantify/wiki).\r\n- Explore the [API documentation](#) for detailed developer information.\r\n- See also the library in the pypi site in [pypi mlquantify](https://pypi.org/project/mlquantify/)\r\n\r\n___\r\n\r\n## Installation\r\n\r\nTo install mlquantify, run the following command:\r\n\r\n```bash\r\npip install mlquantify\r\n```\r\n\r\nIf you only want to update, run the code below:\r\n\r\n```bash\r\npip install --update mlquantify\r\n```\r\n\r\n___\r\n\r\n## Contents\r\n\r\n| Section | Description |\r\n|---|---|\r\n| **21 Quantification Methods** | Methods for quantification, such as classify & Count Correct methods, Threshold Optimization, Mixture Models and more.|\r\n| **Dynamic class management** | All methods are dynamic, and handles multiclass and binary problems, in case of binary it makes One-Vs-All (OVA) automatically. |\r\n| **Model Selection** | Criteria and processes used to select the best model, such as grid-search for the case of quantification|\r\n| **Evaluation Metrics** | Specific metrics used to evaluate quantification performance, (e.g., AE, BIAS, NAE, SE, KLD, etc.). |\r\n| **Evaluation Protocols** | Evaluation protocols used, based on sampling generation (e.g., APP, NPP, etc.).. |\r\n| **Plotting Results** | Tools and techniques used to visualize results, such as the protocol results.|\r\n| **Comprehensive Documentation** | Complete documentation of the project, including code, data, and results. |\r\n\r\n___\r\n\r\n## Quick example:\r\n\r\nThis code first loads the breast cancer dataset from _sklearn_, which is then split into training and testing sets. It uses the _Expectation Maximisation Quantifier (EMQ)_ with a RandomForest classifier to predict class prevalence. After training the model, it evaluates performance by calculating and printing the absolute error and bias between the real and predicted prevalences.\r\n\r\n```python\r\nimport mlquantify as mq\r\nfrom sklearn.ensemble import RandomForestClassifier\r\nfrom sklearn.datasets import load_breast_cancer\r\nfrom sklearn.model_selection import train_test_split\r\n\r\n# Loading dataset from sklearn\r\nfeatures, target = load_breast_cancer(return_X_y=True)\r\n\r\n#Splitting into train and test\r\nX_train, X_test, y_train, y_test = train_test_split(features, target, test_size=0.3)\r\n\r\n#Create the model, here it is the Expectation Maximisation Quantifier (EMQ) with a classifier\r\nmodel = mq.methods.EMQ(RandomForestClassifier())\r\nmodel.fit(X_train, y_train)\r\n\r\n#Predict the class prevalence for X_test\r\npred_prevalence = model.predict(X_test)\r\nreal_prevalence = mq.utils.get_real_prev(y_test)\r\n\r\n#Get the error for the prediction\r\nae = mq.evaluation.absolute_error(real_prevalence, pred_prevalence)\r\nbias = mq.evaluation.bias(real_prevalence, pred_prevalence)\r\n\r\nprint(f\"Mean Squared Error (MSE) -> {ae:.4f}\")\r\nprint(f\"Bias -> {bias}\")\r\n```\r\n\r\n___\r\n\r\n## Requirements\r\n\r\n- Scikit-learn\r\n- pandas\r\n- numpy\r\n- joblib\r\n- tqdm\r\n- matplotlib\r\n- xlrd\r\n\r\n___\r\n\r\n## Documentation\r\n\r\n##### API is avaliable [here](#)\r\n\r\n- [Methods](https://github.com/luizfernandolj/mlquantify/wiki/Methods)\r\n- [Model Selection](https://github.com/luizfernandolj/mlquantify/wiki/Model-Selection)\r\n- [Evaluation](https://github.com/luizfernandolj/mlquantify/wiki/Evaluation)\r\n- [Plotting](https://github.com/luizfernandolj/mlquantify/wiki/Plotting)\r\n- [Utilities](https://github.com/luizfernandolj/mlquantify/wiki/Utilities)\r\n\r\n\r\n___\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Quantification Library",
"version": "0.0.11.11",
"project_urls": {
"Homepage": "https://github.com/luizfernandolj/QuantifyML/tree/master"
},
"split_keywords": [
"python",
" machine learning",
" quantification",
" quantify"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d89c0e2fc03d9ca16bdff038d05fa7edfbd0c815b4ba3c118b8ee5738379b8c1",
"md5": "6d074cb942ec4ace64cb23822b5adde8",
"sha256": "268f8f6962c65fd53638a6d3775d79c8932b03a313e0b30f44b37a5bebd70997"
},
"downloads": -1,
"filename": "mlquantify-0.0.11.11.tar.gz",
"has_sig": false,
"md5_digest": "6d074cb942ec4ace64cb23822b5adde8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 50520,
"upload_time": "2024-12-18T18:53:35",
"upload_time_iso_8601": "2024-12-18T18:53:35.615997Z",
"url": "https://files.pythonhosted.org/packages/d8/9c/0e2fc03d9ca16bdff038d05fa7edfbd0c815b4ba3c118b8ee5738379b8c1/mlquantify-0.0.11.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-18 18:53:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "luizfernandolj",
"github_project": "QuantifyML",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "mlquantify"
}