Metadata-Version: 2.4
Name: thinxai
Version: 1.0.1
Summary: AI Model Explainability and Interpretability Tool
Author: ThinXAI Team
Author-email: ThinXAI Team <fyp9446@gmail.com>
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.21.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: matplotlib>=3.4.0
Requires-Dist: seaborn>=0.11.0
Requires-Dist: scikit-learn>=1.0.0
Requires-Dist: torch>=2.0.0
Requires-Dist: transformers>=4.30.0
Requires-Dist: shap>=0.42.0
Requires-Dist: captum>=0.6.0
Requires-Dist: groq>=0.4.0
Requires-Dist: tqdm>=4.62.0
Requires-Dist: psutil>=5.8.0
Provides-Extra: tensorflow
Requires-Dist: tensorflow>=2.12.0; extra == "tensorflow"
Provides-Extra: gpu
Requires-Dist: torch[cuda]; extra == "gpu"
Provides-Extra: all
Requires-Dist: tensorflow>=2.12.0; extra == "all"
Requires-Dist: torch[cuda]; extra == "all"
Dynamic: author
Dynamic: license-file
Dynamic: requires-python

# ThinXAI

A CLI tool for explaining deep learning models. Provide it with a trained model + training dataset with target and it generates a PDF report telling what drives predictions and why.

## Install

```bash
pip install thinxai
```

With extras:

```bash
pip install thinxai[tensorflow]   # TensorFlow/Keras models
pip install thinxai[gpu]           # GPU acceleration
pip install thinxai[all]           # all extras
```

## Quick Start

1. Place your model file and CSV dataset in the same folder
2. Run:

```bash
thinxai
```

Or:

```bash
python -m thinxai
```

3. Select your model and dataset from the interactive menu
4. Find the PDF report in the same folder

## Supported Inputs

**Deep Learning Models:** PyTorch (.pth, .pt, .pkl), TensorFlow/Keras (.h5, .hdf5, .keras, SavedModel), Transformers (BERT, GPT, etc.), ONNX (.onnx)

**Also Supported:** Scikit-learn (.pkl, .joblib)

**Data:** CSV, tab-delimited, pipe-delimited

## What It Does

ThinXAI runs multiple explainability methods on your model and combines the results into a single ranked list. It then generates plain English explanations for the top features and packages everything into a PDF report.

### Analysis Pipeline

- **Permutation Importance**: shuffles each feature and measures accuracy drop 
- **SHAP Values**: game-theoretic attribution per prediction 
- **Integrated Gradients**: gradient-based attribution along the input path 
- **Statistical Tests**: mutual information and F-scores
- **Built-in Importance**: model native scores when available

These are merged into a **consensus score**. Features that rank highly across multiple methods get higher confidence.

### Explanations

Top features are explained by a **cascade LLM system**:

- **Groq API**: Primary 
- **HuggingFace fallback**: Secondary
- **Rule-based fallback**: Always works

Each explanation includes a **business insight**

### PDF Report Contents

- Cover page with model validation metrics and trust indicator
- Feature importance distribution pie chart
- Each feature gets explanation cards with business insights
- Executive summary with the top 3 features
- Technical glossary automatically generated from terms found in the report

### Trust Indicators

The tool flags suspicious results:

- **Accuracy >99%**: warns about possible data leakage
- **Accuracy near random**: warns model may not have learned patterns
- **Raw state_dict models**: skips validation, runs statistical analysis only

## Requirements

- Python 3.8+
- See `setup.py` for full dependency list

## Documentation

- `README.md` — this file
- `QUICKREF.md` — how to run this 
- `LICENSE` — MIT License
