Metadata-Version: 2.4
Name: vistaar
Version: 1.2.1
Summary: Audit-ready predictive modelling and customer segmentation in one call, with a plain-language review of what to do next.
Author-email: Chinmay Anand <mail@chinmayanand.com>
License-Expression: MIT
Keywords: analytics,segmentation,modelling,audit,uplift
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy<2.1,>=1.24; python_version < "3.10"
Requires-Dist: numpy>=1.24; python_version >= "3.10"
Requires-Dist: pandas<3,>=2.0
Requires-Dist: scipy<1.14,>=1.10; python_version < "3.10"
Requires-Dist: scipy>=1.10; python_version >= "3.10"
Requires-Dist: scikit-learn<1.7,>=1.5; python_version < "3.10"
Requires-Dist: scikit-learn>=1.5; python_version >= "3.10"
Requires-Dist: plotly>=5.18
Requires-Dist: openpyxl>=3.1
Requires-Dist: tqdm>=4.66
Provides-Extra: ml
Requires-Dist: xgboost<3,>=2.0; python_version < "3.10" and extra == "ml"
Requires-Dist: xgboost>=2.0; python_version >= "3.10" and extra == "ml"
Requires-Dist: lightgbm<4.7,>=4.3; python_version < "3.10" and extra == "ml"
Requires-Dist: lightgbm>=4.3; python_version >= "3.10" and extra == "ml"
Requires-Dist: catboost>=1.2; extra == "ml"
Provides-Extra: automl
Requires-Dist: optuna>=3.5; extra == "automl"
Provides-Extra: ebm
Requires-Dist: interpret>=0.6; extra == "ebm"
Provides-Extra: survival
Requires-Dist: scikit-survival>=0.22; extra == "survival"
Provides-Extra: shap
Requires-Dist: shap<0.50,>=0.45; python_version < "3.11" and extra == "shap"
Requires-Dist: shap<0.52,>=0.45; (python_version >= "3.11" and python_version < "3.12") and extra == "shap"
Requires-Dist: shap>=0.45; python_version >= "3.12" and extra == "shap"
Provides-Extra: spark
Requires-Dist: pyspark>=3.4; extra == "spark"
Provides-Extra: hdbscan
Requires-Dist: hdbscan<0.8.41,>=0.8.33; python_version < "3.10" and extra == "hdbscan"
Requires-Dist: hdbscan>=0.8.33; python_version >= "3.10" and extra == "hdbscan"
Provides-Extra: all
Requires-Dist: xgboost<3,>=2.0; python_version < "3.10" and extra == "all"
Requires-Dist: xgboost>=2.0; python_version >= "3.10" and extra == "all"
Requires-Dist: lightgbm<4.7,>=4.3; python_version < "3.10" and extra == "all"
Requires-Dist: lightgbm>=4.3; python_version >= "3.10" and extra == "all"
Requires-Dist: catboost>=1.2; extra == "all"
Requires-Dist: shap<0.50,>=0.45; python_version < "3.11" and extra == "all"
Requires-Dist: shap<0.52,>=0.45; (python_version >= "3.11" and python_version < "3.12") and extra == "all"
Requires-Dist: shap>=0.45; python_version >= "3.12" and extra == "all"
Requires-Dist: pyspark>=3.4; extra == "all"
Requires-Dist: hdbscan<0.8.41,>=0.8.33; python_version < "3.10" and extra == "all"
Requires-Dist: hdbscan>=0.8.33; python_version >= "3.10" and extra == "all"
Requires-Dist: statsmodels>=0.14.6; extra == "all"
Requires-Dist: optuna>=3.5; extra == "all"
Provides-Extra: stats
Requires-Dist: statsmodels>=0.14.6; extra == "stats"
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: nbformat>=5; extra == "dev"
Requires-Dist: build>=1.0; extra == "dev"
Requires-Dist: twine>=5; extra == "dev"
Requires-Dist: statsmodels>=0.14.6; extra == "dev"
Dynamic: license-file

# VISTAAR

Audit-ready predictive modelling and customer segmentation in one call, with a plain-language review of what to do next.

## What it does

- Fixes types, null tokens, and dates, then screens columns for leakage.
- Selects a model with repeated cross-validation and a shuffled-label null test.
- Compares a challenger with the champion and promotes it only when the paired test clears zero.
- Finds micro-segments and controls the false-discovery rate.
- Ranks a target list to a capacity, with reason codes on each row.
- Writes an HTML report and an audit pack that can be re-run.

Pass a table and a binary target. Set `event_name` to the word you want in the report. The numbers are observational, not causal effects.

## Install

```bash
pip install vistaar
```

Python 3.9 or newer. Optional extras: `vistaar[ml]` (LightGBM, XGBoost, CatBoost), `vistaar[automl]` (Optuna), `vistaar[ebm]` (InterpretML), `vistaar[shap]`, `vistaar[spark]`, `vistaar[hdbscan]`, and `vistaar[all]`.

`automl=True` tunes the leading model on a training slice, checks a correlated numeric block, target-encodes high-cardinality fields inside each training fold, and keeps a top-3 blend only when a paired test says it wins. Set `optimize_metric` to `pr_auc` or `recall_top2`. `time_column` holds out later rows. The Model decisions section records each choice.

`success_metric` and `success_target` choose the number used for tuning, selection, and the verdict. `escalate=True` tries a second stage, then small groups, and states the lift ceiling (1 divided by the base rate). The HTML report includes a leaderboard, model cards, an info note on each heading, and an Audit section with a JSON download. `print_report(explain=True)` prints those notes in the notebook. `results.save_audit(directory)` writes the same pack for a pipeline.

## Quickstart

```python
import vistaar as vt
results = vt.Analytics(
    df,
    target="outcome",
    event_name="event",
    entity_name="customer",
    action_name="contact",
).run()
results.summary()
print(results.summary_text())
results.print_report()
results.decile_table()
results.recall_at_deciles()
# or set a minimum captured share: target_recall=0.75, top_n_deciles=2
results.priority_list(capacity=200)
results.export("report.html")
```

## Benchmarks

0.6.0 smart search, on the same logistic and histogram-boosting pair as 0.5.2, changes ROC-AUC by about 0.00 to 0.002. The intervals overlap. A 200,000 × 600 table finished in 107 seconds on 8 cores. Details are in [Benchmarks](docs/benchmarks.md).

1.0.0 on a shared 25% holdout. FLAML, H2O, and AutoGluon each had 60 seconds. VISTAAR fit logistic regression and histogram boosting with 3-fold scores and no search budget. AutoGluon skipped neural nets, CatBoost, and XGBoost because those extras were not installed. Bank marketing excludes duration. The gaps are small: VISTAAR leads on bank ROC-AUC, and the other libraries lead on Adult by about 0.005.

| Dataset | VISTAAR ROC / PR | FLAML ROC / PR | H2O ROC / PR | AutoGluon ROC / PR |
| --- | --- | --- | --- | --- |
| Telco | 0.844 / 0.638 | 0.837 / 0.633 | 0.847 / 0.652 | 0.845 / 0.648 |
| Bank marketing | 0.798 / 0.458 | 0.784 / 0.426 | 0.796 / 0.460 | 0.794 / 0.464 |
| Adult | 0.924 / 0.822 | 0.930 / 0.832 | 0.929 / 0.832 | 0.930 / 0.832 |

`experiments/benchmark_100.py` repeats the Telco run.

Out-of-fold ROC AUC on the full public tables, against a tuned logistic regression or LightGBM fit on the same rows.

| Dataset | VISTAAR AUC | Baseline | Baseline AUC |
| --- | --- | --- | --- |
| Telco | 0.845 | LightGBM | 0.839 |
| Bank marketing | 0.797 | LightGBM | 0.805 |
| Adult | 0.928 | LightGBM | 0.928 |
| Credit card fraud | 0.981 | Logistic regression | 0.976 |
| Credit default | 0.785 | LightGBM | 0.782 |

## Docs

- [Changelog](CHANGELOG.md)
- [Audit pack](docs/audit.md)
- [Benchmarks](docs/benchmarks.md)
- [Methodology](docs/methodology.md)
