Skip to content

Commit ff62264

Browse files
committed
doc(readme): more conscise readme
1 parent d5c651e commit ff62264

1 file changed

Lines changed: 1 addition & 98 deletions

File tree

README.md

Lines changed: 1 addition & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,7 @@
1010

1111
Khisto is a Python library for creating histograms using the **Khiops optimal binning algorithm**. Unlike standard histograms that use fixed-width bins or simple heuristics, Khisto automatically determines the optimal number of bins and their variable widths to best represent the underlying data distribution.
1212

13-
## Features
14-
15-
- **Optimal Binning**: Uses the MODL (Minimum Description Length) principle to find the best discretization.
16-
- **Variable-Width Bins**: Captures dense regions with fine bins and sparse regions with wider bins.
17-
- **NumPy Compatible**: Drop-in replacement for `numpy.histogram`.
18-
- **Matplotlib Integration**: `khisto.matplotlib.hist` works like `plt.hist`.
19-
- **Core Histogram API**: Inspect every available granularity with `khisto.core.compute_histograms` and `HistogramResult`.
20-
- **Minimal Dependencies**: Only requires NumPy (matplotlib optional for plotting).
21-
22-
| Standard Gaussian | Heavy-tailed Pareto |
23-
| --- | --- |
24-
| ![Adaptive Gaussian histogram](docs/images/gaussian-quick-start.png) | ![Adaptive Pareto histogram](docs/images/pareto-quick-start.png) |
25-
26-
## Reproducing The Example Distributions
27-
28-
The complete runnable script is available in `scripts/generate_distribution_examples.py`.
29-
30-
Run it from the repository root to regenerate both example distributions and the figure files used in this README:
31-
32-
```bash
33-
python scripts/generate_distribution_examples.py
34-
```
13+
Documentation is available at **[khiops.github.io/khisto-python](https://khiopsml.github.io/khisto-python/)**.
3514

3615
## Installation
3716

@@ -58,74 +37,8 @@ data = np.random.normal(0, 1, 10000)
5837

5938
# Compute optimal histogram (drop-in replacement for np.histogram)
6039
hist, bin_edges = histogram(data)
61-
62-
# With density normalization
63-
density, bin_edges = histogram(data, density=True)
64-
65-
# Limit maximum number of bins
66-
hist, bin_edges = histogram(data, max_bins=10)
67-
68-
# Specify range
69-
hist, bin_edges = histogram(data, range=(-2, 2))
70-
```
71-
72-
Using 10,000 samples keeps the adaptive refinement visible while remaining fast to compute.
73-
74-
Heavy-tailed example:
75-
76-
```python
77-
import numpy as np
78-
import matplotlib.pyplot as plt
79-
from khisto.matplotlib import hist
80-
81-
# Generate 10,000 samples from a Pareto distribution, shifted to start at 1 for better log-log visualization
82-
shape = 3
83-
long_tail_data = np.random.pareto(shape, size=10000) + 1
84-
85-
# Plot an adaptive histogram on logarithmic axes.
86-
n, bins, patches = hist(long_tail_data, density=True)
87-
plt.xscale("log")
88-
plt.yscale("log")
89-
plt.show()
90-
```
91-
92-
### Matplotlib Integration
93-
94-
```python
95-
import numpy as np
96-
import matplotlib.pyplot as plt
97-
from khisto.matplotlib import hist
98-
99-
# Generate 10,000 samples from a standard Gaussian distribution.
100-
data = np.random.normal(0, 1, 10000)
101-
102-
# Density is usually the most interpretable view with variable-width bins.
103-
n, bins, patches = hist(data, density=True)
104-
plt.xlabel('Value')
105-
plt.ylabel('Density')
106-
plt.show()
107-
108-
# Cumulative density follows matplotlib semantics.
109-
n, bins, patches = hist(data, density=True, cumulative=True)
110-
plt.ylabel('Cumulative probability')
111-
plt.show()
11240
```
11341

114-
## How It Works
115-
116-
Khisto uses the Khiops optimal binning algorithm based on the MODL (Minimum Optimal Description Length) principle. Instead of using fixed-width bins like traditional histograms, it:
117-
118-
1. Analyzes the data distribution
119-
2. Finds bin boundaries that minimize information loss
120-
3. Creates variable-width bins that adapt to data density
121-
122-
This results in histograms that better represent the underlying distribution, with finer bins in dense regions and wider bins in sparse regions.
123-
124-
The method implemented in Khiops is comprehensively detailed in [2] and further extended in [1].
125-
126-
- [1] M. Boullé. Floating-point histograms for exploratory analysis of large scale real-world data sets. Intelligent Data Analysis, 28(5):1347-1394, 2024
127-
- [2] V. Zelaya Mendizábal, M. Boullé, F. Rossi. Fast and fully-automated histograms for large-scale data sets. Computational Statistics & Data Analysis, 180:0-0, 2023
128-
12942
## Development
13043

13144
```bash
@@ -140,16 +53,6 @@ uv sync --group dev --extra all
14053
uv run pytest
14154
```
14255

143-
## Documentation
144-
145-
Full documentation is hosted at **[khiops.github.io/khisto-python](https://khiops.github.io/khisto-python/)**.
146-
147-
- [API Reference](https://khiops.github.io/khisto-python/array/histogram/index.html) — NumPy-like histogram API
148-
- [Matplotlib Integration](https://khiops.github.io/khisto-python/matplotlib/index.html)`hist` plotting function
149-
- [Core API](https://khiops.github.io/khisto-python/core/index.html) — full access to histogram granularity levels
150-
- [API Comparison](https://khiops.github.io/khisto-python/api_comparison.html) — side-by-side with NumPy and Matplotlib
151-
- [Demo Notebook](https://khiops.github.io/khisto-python/demo.html) — interactive walkthrough
152-
15356
## License
15457

15558
[BSD 3-Clause Clear License](LICENSE)

0 commit comments

Comments
 (0)