Metadata-Version: 2.4
Name: sdm-learn
Version: 0.1.5
Summary: Self-documenting models: the document is the model.
Author: Yulu Gan
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/sunrainyg/sdm
Project-URL: Repository, https://github.com/sunrainyg/sdm
Keywords: machine-learning,llm,interpretability,self-documenting,supervised-learning
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.24
Requires-Dist: Pillow>=9
Provides-Extra: image
Requires-Dist: numpy>=1.21; extra == "image"
Requires-Dist: Pillow>=9; extra == "image"
Requires-Dist: cairosvg>=2.5; extra == "image"
Provides-Extra: audio
Requires-Dist: numpy>=1.21; extra == "audio"
Requires-Dist: Pillow>=9; extra == "audio"
Provides-Extra: pods
Requires-Dist: Pillow>=9; extra == "pods"
Requires-Dist: pyarrow>=12; extra == "pods"
Provides-Extra: science
Requires-Dist: numpy>=1.21; extra == "science"
Requires-Dist: Pillow>=9; extra == "science"
Requires-Dist: h5py>=3; extra == "science"
Provides-Extra: all
Requires-Dist: numpy>=1.21; extra == "all"
Requires-Dist: Pillow>=9; extra == "all"
Requires-Dist: cairosvg>=2.5; extra == "all"
Requires-Dist: pyarrow>=12; extra == "all"
Requires-Dist: h5py>=3; extra == "all"
Dynamic: license-file

# sdm-learn: Self-Documenting Models

**The document *is* the model.**

[![PyPI](https://img.shields.io/pypi/v/sdm-learn.svg)](https://pypi.org/project/sdm-learn/)
[![Python](https://img.shields.io/pypi/pyversions/sdm-learn.svg)](https://pypi.org/project/sdm-learn/)
[![checks](https://github.com/sunrainyg/sdm/actions/workflows/test.yml/badge.svg)](https://github.com/sunrainyg/sdm/actions/workflows/test.yml)
[![docs](https://img.shields.io/badge/docs-yulugan.com%2Fsdm-blue.svg)](https://yulugan.com/sdm/)

`sdm` trains a classifier that has no weights. An LLM writes a document that
says how to tell the classes apart, the same LLM reads that document to
classify new inputs, and a gate keeps a revision only when it does not lower
accuracy on protected training rows. What you train is a readable file. What
you read is what runs.

```bash
pip install sdm-learn
sdm ui                                    # the local app: run, watch, compare
sdm run --dataset cifar10                 # a markdown rulebook, plus the zero-shot control
sdm run --dataset pods --format html      # the same learner writing an HTML page
```

```python
import sdm

data = sdm.dataset(
    train=[{"text": "wire me $500 today", "label": "spam"},
           {"text": "lunch at one?", "label": "ham"}],
    classes=("spam", "ham"),
    description="Each input is one email body.",
)
skill = sdm.train(data, algo="sdm", format="markdown")
print(skill.text)
```

**Documentation: [yulugan.com/sdm](https://yulugan.com/sdm/)**: installation
and providers, the UI, the command line, the Python API, skill formats,
datasets (PODS, AI4Science, SR, and your own), the transfer and
interpretability tools, results, and the changelog.

Reproductions with exact commands and numbers are under
[`reproduce/`](reproduce/README.md). Copy `settings.example.json` to
`settings.json` and add your provider, model, and key before the first run.

## License

Apache-2.0
