Skip to content

Commit 37632cc

Browse files
committed
doc: enhance README and index with additional badges and improved content; update CSS for better styling
1 parent 1dc5cd1 commit 37632cc

5 files changed

Lines changed: 115 additions & 15 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Khisto
22

3+
[![CI](https://github.com/khiops/khisto-python/actions/workflows/ci.yaml/badge.svg)](https://github.com/khiops/khisto-python/actions/workflows/ci.yaml)
4+
[![Docs](https://github.com/khiops/khisto-python/actions/workflows/docs.yaml/badge.svg)](https://khiops.github.io/khisto-python/)
5+
[![PyPI](https://img.shields.io/pypi/v/khisto)](https://pypi.org/project/khisto/)
6+
[![Python](https://img.shields.io/pypi/pyversions/khisto)](https://pypi.org/project/khisto/)
7+
[![License](https://img.shields.io/pypi/l/khisto)](LICENSE)
8+
39
**Optimal Binning Histograms for Python**
410

511
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.

docs/_static/css/custom.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,30 @@ h5 {
2222
img.sidebar-logo {
2323
width: 40px;
2424
}
25+
26+
/* Hero tagline */
27+
.hero-tagline {
28+
font-size: 1.25em;
29+
color: var(--color-foreground-secondary);
30+
margin-bottom: 1.5rem;
31+
}
32+
33+
/* Card styling overrides for Furo + sphinx-design */
34+
.sd-card {
35+
border-radius: 0px !important;
36+
transition: box-shadow 0.2s ease;
37+
}
38+
39+
.sd-card:hover {
40+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
41+
}
42+
43+
/* Gallery images */
44+
.sd-card img {
45+
border-radius: 4px;
46+
}
47+
48+
/* Install code block on landing page */
49+
.install-cmd .highlight {
50+
font-size: 1.05em;
51+
}

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def _read_release() -> str:
4949
"sphinx.ext.intersphinx",
5050
"numpydoc",
5151
"sphinx_copybutton",
52+
"sphinx_design",
5253
"nbsphinx",
5354
]
5455

docs/index.rst

Lines changed: 80 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,88 @@
1-
.. khisto-python documentation master file, created by
2-
sphinx-quickstart on Fri Mar 6 17:40:33 2026.
3-
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
1+
.. khisto-python documentation master file
52
6-
khisto-python documentation
7-
===========================
3+
===========================================
4+
Khisto — Histograms that fit your data
5+
===========================================
86

9-
Khisto helps you build histograms that look right on the first try.
7+
.. rst-class:: hero-tagline
108

11-
It replaces fixed-width bin guesses with adaptive bins computed by the Khiops
12-
algorithm, so dense regions stay detailed and sparse regions stay readable.
9+
Drop-in replacements for ``numpy.histogram`` and ``plt.hist`` with
10+
adaptive, variable-width bins powered by the Khisto algorithm.
11+
Dense regions get fine bins, sparse regions get wide ones — no tuning needed.
1312

14-
Pick the entry point that matches your workflow:
13+
.. grid:: 2
14+
:gutter: 3
1515

16-
- :doc:`demo` for a runnable tour.
17-
- :doc:`array/histogram/index` for a NumPy-like API with better bins.
18-
- :doc:`matplotlib/index` for plots that stay familiar but look sharper.
19-
- :doc:`core/index` for full access to the histogram series.
20-
- :doc:`api_comparison` for a quick comparison with NumPy and matplotlib.
16+
.. grid-item-card:: Standard Gaussian
17+
:img-top: images/gaussian-quick-start.png
18+
19+
Bins concentrate around the interesting areas — exactly
20+
matching the density of a normal distribution.
21+
22+
.. grid-item-card:: Heavy-tailed Pareto
23+
:img-top: images/pareto-quick-start.png
24+
25+
Log-log axes reveal how adaptive bins track a power-law decay
26+
over four orders of magnitude.
27+
28+
Get started
29+
-----------
30+
31+
.. div:: install-cmd
32+
33+
.. code-block:: bash
34+
35+
pip install khisto # core (NumPy only)
36+
pip install "khisto[matplotlib]" # + plotting
37+
38+
.. code-block:: python
39+
40+
import numpy as np
41+
from khisto import histogram
42+
43+
data = np.random.normal(0, 1, 10_000)
44+
hist, bin_edges = histogram(data) # optimal bins, no guessing
45+
46+
.. grid:: 1 1 3 3
47+
:gutter: 3
48+
:class-container: sd-mt-3
49+
50+
.. grid-item-card:: :octicon:`package;1.5em` NumPy-like API
51+
:link: array/histogram/index
52+
:link-type: doc
53+
54+
``histogram(data)`` returns ``(hist, bin_edges)`` — same shape as
55+
``numpy.histogram``, better bins.
56+
57+
.. grid-item-card:: :octicon:`graph;1.5em` Matplotlib integration
58+
:link: matplotlib/index
59+
:link-type: doc
60+
61+
``khisto.matplotlib.hist`` plots like ``plt.hist`` with density,
62+
cumulative, step, and log-scale support.
63+
64+
.. grid-item-card:: :octicon:`telescope;1.5em` Core engine
65+
:link: core/index
66+
:link-type: doc
67+
68+
``compute_histograms`` exposes every granularity level so you can
69+
pick the resolution that suits your analysis.
70+
71+
.. grid:: 1 1 2 2
72+
:gutter: 3
73+
:class-container: sd-mt-1
74+
75+
.. grid-item-card:: :octicon:`git-compare;1.5em` API comparison
76+
:link: api_comparison
77+
:link-type: doc
78+
79+
Side-by-side parameter tables for NumPy, Matplotlib, and Khisto.
80+
81+
.. grid-item-card:: :octicon:`play;1.5em` Interactive demo
82+
:link: demo
83+
:link-type: doc
84+
85+
A runnable notebook tour covering all features.
2186

2287
.. toctree::
2388
:maxdepth: 2

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ docs = [
7070
"furo>=2022.12.7",
7171
"numpydoc>=1.5",
7272
"sphinx-copybutton>=0.5",
73+
"sphinx-design>=0.6",
7374
"nbsphinx>=0.9",
7475
"pypandoc>=1.17",
7576
"ipykernel>=7",

0 commit comments

Comments
 (0)