xfin-xai


Namexfin-xai JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/dhruvparmar10/XFIN
SummaryPrivacy-Preserving Explainable AI Library for Financial Services and Banking Systems
upload_time2025-09-06 07:26:14
maintainerNone
docs_urlNone
authorRishabh Bhangale & Dhruv Parmar
requires_python>=3.9
licenseMIT
keywords explainable-ai finance privacy machine-learning credit-risk compliance
VCS
bugtrack_url
requirements streamlit pandas joblib shap lime numpy matplotlib dotenv
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # XFIN-XAI: Explainable AI Library for Financial Services and Banking Systems

[![PyPI version](https://badge.fury.io/py/xfin-xai.svg)](https://badge.fury.io/py/xfin-xai)
[![Documentation Status](https://readthedocs.org/projects/xfin-xai/badge/?version=latest)](https://xfin-xai.readthedocs.io/en/latest/?badge=latest)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

XFIN-XAI is an open-source Python library designed for privacy-preserving explainable AI (XAI) in financial services and banking systems. It enables banks and financial institutions to generate transparent explanations for black-box models without exposing proprietary internals. The MVP focuses on credit risk explanations, adverse action notices, and counterfactual recommendations, ensuring compliance with regulations like GDPR and ECOA.

This library is built for educational and research purposes, allowing users to explore XAI in finance while maintaining data privacy.

## Features

- **Privacy-Preserving Explanations**: Integrates SHAP and LIME for local explanations using only model predictions (no access to internals).
- **Credit Risk Module**: Generates feature importances, adverse action notices, and actionable recommendations.
- **Compliance Engine**: Produces regulatory-compliant reports and audit trails.
- **LLM Integration**: Uses Gemini (or similar) for natural language explanations and recommendations.
- **Modular Design**: Easily extensible for other domains (e.g., ESG, stress testing) in future versions.
- **Efficient and Scalable**: Runs on commodity hardware with low resource usage.

## Installation

Install XFIN via pip:

```
pip install xfin-xai
```

For development installation, clone the repository and install dependencies:

```
git clone https://github.com/dhruvparmar10/XFIN.git
cd XFIN
pip install -e .
```

### Requirements

- Python 3.8+
- Dependencies: `pandas`, `numpy`, `shap`, `lime`, `joblib`, `matplotlib`,`streamlit`,(Open router for LLM features)

See `requirements.txt` for the full list.

## Quick Start

Here's a basic example to get started with credit risk explanations:

```
import pandas as pd
import joblib
from xfin_xai import CreditRiskModule

# Load your black-box model (example)

model = joblib.load('path/to/your/model.pkl')

# Define a wrapper for your model (only expose predict/predict_proba)

class BankModel:
def predict(self, X):
return model.predict(X)
def predict_proba(self, X):
return model.predict_proba(X)

# Sample input data (replace with your features)

sample_data = pd.DataFrame({
'Annual_income': ,
'Employed_days': , # Add other features as per your dataset
})

# Initialize the explainer

explainer = CreditRiskModule(BankModel(), domain="credit_risk")

# Generate explanation

explanation = explainer.explain_prediction(sample_data)

# Generate recommendations

recommendations = explainer.generate_recommendations(sample_data)

# Generate compliance notice

compliance = explainer.generate_adverse_action_notice(explanation)

print("Prediction Explanation:", explanation)
print("Recommendations:", recommendations)
print("Adverse Action Notice:", compliance)
```

For more details, see the [examples](./examples) directory.

## Documentation

Full documentation is available at [xfin-xai.readthedocs.io](https://xfin-xai.readthedocs.io/en/latest/).

- [API Reference](https://xfin-xai.readthedocs.io/en/latest/api.html)
- [Tutorials](https://xfin-xai.readthedocs.io/en/latest/tutorials.html)
- [Roadmap](https://xfin-xai.readthedocs.io/en/latest/roadmap.html)

## Contributing

We welcome contributions! Please see our [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.

1. Fork the repository.
2. Create a feature branch (`git checkout -b feature/YourFeature`).
3. Commit your changes (`git commit -m 'Add YourFeature'`).
4. Push to the branch (`git push origin feature/YourFeature`).
5. Open a Pull Request.

For bugs or feature requests, open an issue on GitHub.

## License

This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.

## Acknowledgments

- Major Thanks to Shap and Lime for building great tools.
- Thanks to the open-source community for tools like setuptools and ReadTheDocs.

For questions, contact [dhruv.jparmar0@gmail.com] or open an issue.

```

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dhruvparmar10/XFIN",
    "name": "xfin-xai",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "explainable-ai, finance, privacy, machine-learning, credit-risk, compliance",
    "author": "Rishabh Bhangale & Dhruv Parmar",
    "author_email": "dhruv.jparmar0@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/83/01/07ea86ef7c9957bfe52a63d86d67f05d37c69b87641e833a021cfdc660cc/xfin_xai-0.1.1.tar.gz",
    "platform": null,
    "description": "# XFIN-XAI: Explainable AI Library for Financial Services and Banking Systems\n\n[![PyPI version](https://badge.fury.io/py/xfin-xai.svg)](https://badge.fury.io/py/xfin-xai)\n[![Documentation Status](https://readthedocs.org/projects/xfin-xai/badge/?version=latest)](https://xfin-xai.readthedocs.io/en/latest/?badge=latest)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nXFIN-XAI is an open-source Python library designed for privacy-preserving explainable AI (XAI) in financial services and banking systems. It enables banks and financial institutions to generate transparent explanations for black-box models without exposing proprietary internals. The MVP focuses on credit risk explanations, adverse action notices, and counterfactual recommendations, ensuring compliance with regulations like GDPR and ECOA.\n\nThis library is built for educational and research purposes, allowing users to explore XAI in finance while maintaining data privacy.\n\n## Features\n\n- **Privacy-Preserving Explanations**: Integrates SHAP and LIME for local explanations using only model predictions (no access to internals).\n- **Credit Risk Module**: Generates feature importances, adverse action notices, and actionable recommendations.\n- **Compliance Engine**: Produces regulatory-compliant reports and audit trails.\n- **LLM Integration**: Uses Gemini (or similar) for natural language explanations and recommendations.\n- **Modular Design**: Easily extensible for other domains (e.g., ESG, stress testing) in future versions.\n- **Efficient and Scalable**: Runs on commodity hardware with low resource usage.\n\n## Installation\n\nInstall XFIN via pip:\n\n```\npip install xfin-xai\n```\n\nFor development installation, clone the repository and install dependencies:\n\n```\ngit clone https://github.com/dhruvparmar10/XFIN.git\ncd XFIN\npip install -e .\n```\n\n### Requirements\n\n- Python 3.8+\n- Dependencies: `pandas`, `numpy`, `shap`, `lime`, `joblib`, `matplotlib`,`streamlit`,(Open router for LLM features)\n\nSee `requirements.txt` for the full list.\n\n## Quick Start\n\nHere's a basic example to get started with credit risk explanations:\n\n```\nimport pandas as pd\nimport joblib\nfrom xfin_xai import CreditRiskModule\n\n# Load your black-box model (example)\n\nmodel = joblib.load('path/to/your/model.pkl')\n\n# Define a wrapper for your model (only expose predict/predict_proba)\n\nclass BankModel:\ndef predict(self, X):\nreturn model.predict(X)\ndef predict_proba(self, X):\nreturn model.predict_proba(X)\n\n# Sample input data (replace with your features)\n\nsample_data = pd.DataFrame({\n'Annual_income': ,\n'Employed_days': , # Add other features as per your dataset\n})\n\n# Initialize the explainer\n\nexplainer = CreditRiskModule(BankModel(), domain=\"credit_risk\")\n\n# Generate explanation\n\nexplanation = explainer.explain_prediction(sample_data)\n\n# Generate recommendations\n\nrecommendations = explainer.generate_recommendations(sample_data)\n\n# Generate compliance notice\n\ncompliance = explainer.generate_adverse_action_notice(explanation)\n\nprint(\"Prediction Explanation:\", explanation)\nprint(\"Recommendations:\", recommendations)\nprint(\"Adverse Action Notice:\", compliance)\n```\n\nFor more details, see the [examples](./examples) directory.\n\n## Documentation\n\nFull documentation is available at [xfin-xai.readthedocs.io](https://xfin-xai.readthedocs.io/en/latest/).\n\n- [API Reference](https://xfin-xai.readthedocs.io/en/latest/api.html)\n- [Tutorials](https://xfin-xai.readthedocs.io/en/latest/tutorials.html)\n- [Roadmap](https://xfin-xai.readthedocs.io/en/latest/roadmap.html)\n\n## Contributing\n\nWe welcome contributions! Please see our [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.\n\n1. Fork the repository.\n2. Create a feature branch (`git checkout -b feature/YourFeature`).\n3. Commit your changes (`git commit -m 'Add YourFeature'`).\n4. Push to the branch (`git push origin feature/YourFeature`).\n5. Open a Pull Request.\n\nFor bugs or feature requests, open an issue on GitHub.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.\n\n## Acknowledgments\n\n- Major Thanks to Shap and Lime for building great tools.\n- Thanks to the open-source community for tools like setuptools and ReadTheDocs.\n\nFor questions, contact [dhruv.jparmar0@gmail.com] or open an issue.\n\n```\n\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Privacy-Preserving Explainable AI Library for Financial Services and Banking Systems",
    "version": "0.1.1",
    "project_urls": {
        "Bug Reports": "https://github.com/dhruvparmar10/XFIN/issues",
        "Documentation": "https://github.com/dhruvparmar10/XFIN/blob/main/README.md",
        "Homepage": "https://github.com/dhruvparmar10/XFIN",
        "Source": "https://github.com/dhruvparmar10/XFIN"
    },
    "split_keywords": [
        "explainable-ai",
        " finance",
        " privacy",
        " machine-learning",
        " credit-risk",
        " compliance"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cde5e371054a98da04d2dce7e96212872bc0a2742db44a25cfe23e3e461800e2",
                "md5": "b93e41ddfa7ca5c3084dd22966c55b4f",
                "sha256": "c36c4dbc27bc8a83e417084d151106a149f382b6f9c78cd42c2f78093f3a764d"
            },
            "downloads": -1,
            "filename": "xfin_xai-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b93e41ddfa7ca5c3084dd22966c55b4f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 13650,
            "upload_time": "2025-09-06T07:26:13",
            "upload_time_iso_8601": "2025-09-06T07:26:13.158924Z",
            "url": "https://files.pythonhosted.org/packages/cd/e5/e371054a98da04d2dce7e96212872bc0a2742db44a25cfe23e3e461800e2/xfin_xai-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "830107ea86ef7c9957bfe52a63d86d67f05d37c69b87641e833a021cfdc660cc",
                "md5": "26571edaf36731380e5f42ebfe655de6",
                "sha256": "36225be36e799c680313be99c49246f1a01e3bcb5bf1b6cb7ce3e504aad7ac2f"
            },
            "downloads": -1,
            "filename": "xfin_xai-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "26571edaf36731380e5f42ebfe655de6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 14520,
            "upload_time": "2025-09-06T07:26:14",
            "upload_time_iso_8601": "2025-09-06T07:26:14.418245Z",
            "url": "https://files.pythonhosted.org/packages/83/01/07ea86ef7c9957bfe52a63d86d67f05d37c69b87641e833a021cfdc660cc/xfin_xai-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-06 07:26:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dhruvparmar10",
    "github_project": "XFIN",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "streamlit",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "joblib",
            "specs": []
        },
        {
            "name": "shap",
            "specs": []
        },
        {
            "name": "lime",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "matplotlib",
            "specs": []
        },
        {
            "name": "dotenv",
            "specs": []
        }
    ],
    "lcname": "xfin-xai"
}
        
Elapsed time: 0.45525s