Metadata-Version: 2.4
Name: caretmetrics
Version: 0.1.0
Summary: caret-style confusion matrices and classification statistics for Python
Author-email: Giorgi Kokhreidze <giokokhreidze1@gmail.com>
License: MIT
Keywords: confusion matrix,caret,classification,metrics,kappa
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.20
Requires-Dist: scipy>=1.7
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: pandas; extra == "dev"
Requires-Dist: openpyxl; extra == "dev"
Dynamic: license-file

# caretmetrics

caret-style confusion matrices and classification statistics for Python.

Reproduces the output of R's `caret::confusionMatrix()` — same table
orientation (**Prediction in rows, Reference in columns**), a chosen
**positive** class, the exact (Clopper–Pearson) 95% CI, the *Acc > NIR*
binomial test, McNemar's test, and Cohen's Kappa.

## Install (local, editable)

From the project folder:

```bash
pip install -e .
```

This installs the package in "editable" mode, so edits to the source take
effect immediately without reinstalling.

## Usage

```python
import pandas as pd
from caretmetrics import confusion_matrix

df = pd.read_excel("data.xlsx")
cm = confusion_matrix(df["survived"], df["pred_classes"], positive="yes")

print(cm)              # caret-style report
cm.accuracy            # 0.774...
cm.kappa               # 0.528...
cm.as_dict()           # all statistics as a dict
cm.table               # 2x2 numpy array (rows=Prediction, cols=Reference)
```

## Notes

- **Positive class** is explicit; flipping it swaps sensitivity/specificity
  and the predictive values.
- Orientation is the opposite of `sklearn.metrics.confusion_matrix`, which is
  the usual reason Python and R matrices don't line up.

## Test

```bash
pip install -e ".[dev]"
pytest
```

## License

MIT
