eazyml-cf


Nameeazyml-cf JSON
Version 0.0.35 PyPI version JSON
download
home_pagehttps://eazyml.com/
Summaryeazyml-cf provides APIs for counterfactual explanations, prescriptive analytics, and actionable insights to optimize predictive outcomes.
upload_time2025-01-27 12:31:52
maintainerNone
docs_urlNone
authorEazyml
requires_python>=3.7
licenseNone
keywords counterfactuals prescriptive-analytics optimal-decision what-if-analysis actionable-insights prediction-optimization causal-inference machine-learning ml-api explainable-ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Eazyml Counterfactual
![Python](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)  ![PyPI package](https://img.shields.io/badge/pypi%20package-0.0.35-brightgreen) ![Code Style](https://img.shields.io/badge/code%20style-black-black)

![EazyML](https://github.com/EazyML/eazyml-docs/raw/refs/heads/master/EazyML_logo.png)

`eazyml-cf` is a Python package that helps users optimize predictive outcomes by generating counterfactual explanations.
EazyML revolutionizes machine learning by introducing counterfactual inference, automating the process of identifying optimal changes to variables that shift outcomes from unfavorable to favorable. This approach overcomes the limitations of manual "what-if" analysis, enabling models to provide actionable, prescriptive insights alongside their predictions.

Designed for post-prediction analysis, the package answers questions like:
- "What minimal changes to input features can reverse an unfavorable prediction?"
- "How can I achieve a desired outcome by tweaking feature values?"

### Features
- **Counterfactual Explanations**: Identify feature changes required to alter predictions.
- **Prescriptive Analytics**: Generate actionable recommendations to achieve better outcomes.
- It performs feature selection from a training dataset by excluding specific columns and the target outcome column.
- This function builds a machine learning model using a specified training dataset.
- It provides platform to automates counterfactual inference for a test record by calculating the probability of an unfavorable outcome and determining the optimal adjustments to minimize it. It processes input datasets, configuration parameters, and model details to identify actionable changes in features while respecting constraints, enabling prescriptive insights for improved outcomes.

`eazyml-cf` is ideal for scenarios like fraud detection, loan approvals, and customer churn prevention.`

## Installation
### User installation
The easiest way to install counterfactual package is using pip:
```bash
pip install -U eazyml-cf
```
### Dependencies
Eazyml Augmented Intelligence requires :
- pandas
- matplotlib
- openpyxl
- scikit-learn
- scipy
- pyyaml

## Usage
Counterfactual can be used by initalizing EazyML and then getting insights for new test data.

```python
from eazyml_augi import ez_init, ez_augi
# Replace 'your_license_key' with your actual EazyML license key
ez_init(license_key="your_license_key")
selected_features = sk_feature_selection(
        train_file = 'train/file/path.csv',
        outcome = 'outcome column name',
        config= {
                "discard_columns" : ['id', 'unnamed'],
                }
        )
model_dict = sk_feature_selection(
        train_file = 'train/file/path.csv',
        test_file = 'test/file/path.csv',
        outcome = 'outcome column name',
        selected_columns = selected_features,
        config= {
            "unfavorable_outcome" : 1,
            "sklearn_classifier" : 'Gradient Boosting'
        }
    )
result = ez_cf_inference(
        train_file = 'train/file/path.csv',
        test_file = 'test/file/path.csv',
        outcome = 'outcome column name',
        config = {
            "unfavorable_outcome" : 1,
            "lower_quantile" : 0.01,
                "upper_quantile" : 0.99,
                "p" : 40,
                "M" : 2,
                "N" : 10000,
                "tolerable_error_threshold" : 0.1
            },
            selected_columns = selected_features,
            model_info = model_dict,
            test_record_idx = 'single or multiple testdata id or None'
        )
```
You can find more information in the [documentation](https://eazyml.readthedocs.io/en/latest/packages/eazyml_cf.html).

## Useful links and similar projects
- [Documentation](https://docs.eazyml.com)
- [Homepage](https://eazyml.com)
- If you have more questions or want to discuss a specific use case please book an appointment [here](https://eazyml.com/trust-in-ai)
- Here are some other EazyML's packages :

    - [eazyml](https://pypi.org/project/eazyml/): Eazyml provides a suite of APIs for training, testing and optimizing machine learning models with built-in AutoML capabilities, hyperparameter tuning, and cross-validation.
    - [eazyml-dq](https://pypi.org/project/eazyml-dq/): `eazyml-dq` provides APIs for comprehensive data quality assessment, including bias detection, outlier identification, and data drift analysis.
    - [eazyml-cf](https://pypi.org/project/eazyml-cf/): `eazyml-cf` provides APIs for counterfactual explanations, prescriptive analytics, and actionable insights to optimize predictive outcomes.
    - [eazyml-augi](https://pypi.org/project/eazyml-augi/): `eazyml-augi` provides APIs to uncover patterns, generate insights, and discover rules from training datasets.
    - [eazyml-xai](https://pypi.org/project/eazyml-xai/): `eazyml-xai` provides APIs for explainable AI (XAI), offering human-readable explanations, feature importance, and predictive reasoning.
    - [eazyml-xai-image](https://pypi.org/project/eazyml-xai-image/): eazyml-xai-image provides APIs for image explainable AI (XAI).

## License
This project is licensed under the [Proprietary License](https://github.com/EazyML/eazyml-docs/blob/master/LICENSE).

---

*Maintained by [EazyML](https://eazyml.com)*  
*© 2025 EazyML. All rights reserved.*

            

Raw data

            {
    "_id": null,
    "home_page": "https://eazyml.com/",
    "name": "eazyml-cf",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "counterfactuals, prescriptive-analytics, optimal-decision, what-if-analysis, actionable-insights, prediction-optimization, causal-inference, machine-learning, ml-api, explainable-ai",
    "author": "Eazyml",
    "author_email": "admin@ipsoftlabs.com",
    "download_url": "https://files.pythonhosted.org/packages/c5/1c/e3a718e40991bd366a33e463df3540d82025b9561d39ede5736161831bc7/eazyml_cf-0.0.35.tar.gz",
    "platform": null,
    "description": "## Eazyml Counterfactual\r\n![Python](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)  ![PyPI package](https://img.shields.io/badge/pypi%20package-0.0.35-brightgreen) ![Code Style](https://img.shields.io/badge/code%20style-black-black)\r\n\r\n![EazyML](https://github.com/EazyML/eazyml-docs/raw/refs/heads/master/EazyML_logo.png)\r\n\r\n`eazyml-cf` is a Python package that helps users optimize predictive outcomes by generating counterfactual explanations.\r\nEazyML revolutionizes machine learning by introducing counterfactual inference, automating the process of identifying optimal changes to variables that shift outcomes from unfavorable to favorable. This approach overcomes the limitations of manual \"what-if\" analysis, enabling models to provide actionable, prescriptive insights alongside their predictions.\r\n\r\nDesigned for post-prediction analysis, the package answers questions like:\r\n- \"What minimal changes to input features can reverse an unfavorable prediction?\"\r\n- \"How can I achieve a desired outcome by tweaking feature values?\"\r\n\r\n### Features\r\n- **Counterfactual Explanations**: Identify feature changes required to alter predictions.\r\n- **Prescriptive Analytics**: Generate actionable recommendations to achieve better outcomes.\r\n- It performs feature selection from a training dataset by excluding specific columns and the target outcome column.\r\n- This function builds a machine learning model using a specified training dataset.\r\n- It provides platform to automates counterfactual inference for a test record by calculating the probability of an unfavorable outcome and determining the optimal adjustments to minimize it. It processes input datasets, configuration parameters, and model details to identify actionable changes in features while respecting constraints, enabling prescriptive insights for improved outcomes.\r\n\r\n`eazyml-cf` is ideal for scenarios like fraud detection, loan approvals, and customer churn prevention.`\r\n\r\n## Installation\r\n### User installation\r\nThe easiest way to install counterfactual package is using pip:\r\n```bash\r\npip install -U eazyml-cf\r\n```\r\n### Dependencies\r\nEazyml Augmented Intelligence requires :\r\n- pandas\r\n- matplotlib\r\n- openpyxl\r\n- scikit-learn\r\n- scipy\r\n- pyyaml\r\n\r\n## Usage\r\nCounterfactual can be used by initalizing EazyML and then getting insights for new test data.\r\n\r\n```python\r\nfrom eazyml_augi import ez_init, ez_augi\r\n# Replace 'your_license_key' with your actual EazyML license key\r\nez_init(license_key=\"your_license_key\")\r\nselected_features = sk_feature_selection(\r\n        train_file = 'train/file/path.csv',\r\n        outcome = 'outcome column name',\r\n        config= {\r\n                \"discard_columns\" : ['id', 'unnamed'],\r\n                }\r\n        )\r\nmodel_dict = sk_feature_selection(\r\n        train_file = 'train/file/path.csv',\r\n        test_file = 'test/file/path.csv',\r\n        outcome = 'outcome column name',\r\n        selected_columns = selected_features,\r\n        config= {\r\n            \"unfavorable_outcome\" : 1,\r\n            \"sklearn_classifier\" : 'Gradient Boosting'\r\n        }\r\n    )\r\nresult = ez_cf_inference(\r\n        train_file = 'train/file/path.csv',\r\n        test_file = 'test/file/path.csv',\r\n        outcome = 'outcome column name',\r\n        config = {\r\n            \"unfavorable_outcome\" : 1,\r\n            \"lower_quantile\" : 0.01,\r\n                \"upper_quantile\" : 0.99,\r\n                \"p\" : 40,\r\n                \"M\" : 2,\r\n                \"N\" : 10000,\r\n                \"tolerable_error_threshold\" : 0.1\r\n            },\r\n            selected_columns = selected_features,\r\n            model_info = model_dict,\r\n            test_record_idx = 'single or multiple testdata id or None'\r\n        )\r\n```\r\nYou can find more information in the [documentation](https://eazyml.readthedocs.io/en/latest/packages/eazyml_cf.html).\r\n\r\n## Useful links and similar projects\r\n- [Documentation](https://docs.eazyml.com)\r\n- [Homepage](https://eazyml.com)\r\n- If you have more questions or want to discuss a specific use case please book an appointment [here](https://eazyml.com/trust-in-ai)\r\n- Here are some other EazyML's packages :\r\n\r\n    - [eazyml](https://pypi.org/project/eazyml/): Eazyml provides a suite of APIs for training, testing and optimizing machine learning models with built-in AutoML capabilities, hyperparameter tuning, and cross-validation.\r\n    - [eazyml-dq](https://pypi.org/project/eazyml-dq/): `eazyml-dq` provides APIs for comprehensive data quality assessment, including bias detection, outlier identification, and data drift analysis.\r\n    - [eazyml-cf](https://pypi.org/project/eazyml-cf/): `eazyml-cf` provides APIs for counterfactual explanations, prescriptive analytics, and actionable insights to optimize predictive outcomes.\r\n    - [eazyml-augi](https://pypi.org/project/eazyml-augi/): `eazyml-augi` provides APIs to uncover patterns, generate insights, and discover rules from training datasets.\r\n    - [eazyml-xai](https://pypi.org/project/eazyml-xai/): `eazyml-xai` provides APIs for explainable AI (XAI), offering human-readable explanations, feature importance, and predictive reasoning.\r\n    - [eazyml-xai-image](https://pypi.org/project/eazyml-xai-image/): eazyml-xai-image provides APIs for image explainable AI (XAI).\r\n\r\n## License\r\nThis project is licensed under the [Proprietary License](https://github.com/EazyML/eazyml-docs/blob/master/LICENSE).\r\n\r\n---\r\n\r\n*Maintained by [EazyML](https://eazyml.com)*  \r\n*\u00c2\u00a9 2025 EazyML. All rights reserved.*\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "eazyml-cf provides APIs for counterfactual explanations, prescriptive analytics, and actionable insights to optimize predictive outcomes.",
    "version": "0.0.35",
    "project_urls": {
        "Contact Us": "https://eazyml.com/trust-in-ai",
        "Documentation": "https://docs.eazyml.com/",
        "Homepage": "https://eazyml.com/",
        "eazyml": "https://pypi.org/project/eazyml/",
        "eazyml-augi": "https://pypi.org/project/eazyml-augi/",
        "eazyml-cf": "https://pypi.org/project/eazyml-cf/",
        "eazyml-dq": "https://pypi.org/project/eazyml-dq/",
        "eazyml-xai": "https://pypi.org/project/eazyml-xai/",
        "eazyml-xai-image": "https://pypi.org/project/eazyml-xai-image/"
    },
    "split_keywords": [
        "counterfactuals",
        " prescriptive-analytics",
        " optimal-decision",
        " what-if-analysis",
        " actionable-insights",
        " prediction-optimization",
        " causal-inference",
        " machine-learning",
        " ml-api",
        " explainable-ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d73dd5785aab1c7f06096274d729f5c967fdd145dd24a71478f9820267790e43",
                "md5": "90406519e21dc691fff66dfcf2a75e40",
                "sha256": "eb3e6f076b12303ebec0d14567a4ba9e70b3a90d5b6c80a7406708c7a8f8ba8f"
            },
            "downloads": -1,
            "filename": "eazyml_cf-0.0.35-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "90406519e21dc691fff66dfcf2a75e40",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.7",
            "size": 11759428,
            "upload_time": "2025-01-27T12:31:37",
            "upload_time_iso_8601": "2025-01-27T12:31:37.908486Z",
            "url": "https://files.pythonhosted.org/packages/d7/3d/d5785aab1c7f06096274d729f5c967fdd145dd24a71478f9820267790e43/eazyml_cf-0.0.35-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c51ce3a718e40991bd366a33e463df3540d82025b9561d39ede5736161831bc7",
                "md5": "337259f8b7ee43a170ec931e48433c84",
                "sha256": "83aab9394b9a00d69222c2dc82fcb781e97187c910dd4fa19f5a8d89b35e79f2"
            },
            "downloads": -1,
            "filename": "eazyml_cf-0.0.35.tar.gz",
            "has_sig": false,
            "md5_digest": "337259f8b7ee43a170ec931e48433c84",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 11265561,
            "upload_time": "2025-01-27T12:31:52",
            "upload_time_iso_8601": "2025-01-27T12:31:52.818345Z",
            "url": "https://files.pythonhosted.org/packages/c5/1c/e3a718e40991bd366a33e463df3540d82025b9561d39ede5736161831bc7/eazyml_cf-0.0.35.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-27 12:31:52",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "eazyml-cf"
}
        
Elapsed time: 2.85007s