Skip to content

Commit c9cddb3

Browse files
HFooladiclaude
andcommitted
docs: prepare v0.3.0 release with documentation site and uv migration
- Add documentation site with GitHub Pages deployment - Core concepts guide (batch-once-then-mask pattern) - API reference pages for models, acquisition, data, metrics - Updated getting started guide with correct examples - Migrate CI/CD to uv package manager - ci.yml: use astral-sh/setup-uv with caching - release.yml: use uv for builds - New docs.yml workflow for GitHub Pages deployment - Update README - Emphasize Flax NNX as the modern API - Simplify with links to documentation - uv-first installation instructions - Update CLAUDE.md with new modules and APIs - Update CHANGELOG.md for v0.3.0 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f619d63 commit c9cddb3

File tree

15 files changed

+657
-150
lines changed

15 files changed

+657
-150
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ jobs:
1616
steps:
1717
- uses: actions/checkout@v4
1818

19-
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v5
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
2121
with:
22-
python-version: ${{ matrix.python-version }}
22+
enable-cache: true
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
run: uv python install ${{ matrix.python-version }}
2326

2427
- name: Install dependencies
25-
run: |
26-
python -m pip install --upgrade pip
27-
pip install .[dev]
28+
run: uv pip install -e .[dev] --system
2829

2930
- name: Run tests
30-
run: |
31-
pytest tests/
31+
run: pytest tests/
3232

3333
- name: Check code formatting and linting
3434
run: |
@@ -41,18 +41,21 @@ jobs:
4141
steps:
4242
- uses: actions/checkout@v4
4343

44-
- name: Set up Python
45-
uses: actions/setup-python@v5
44+
- name: Install uv
45+
uses: astral-sh/setup-uv@v5
4646
with:
47-
python-version: "3.11"
47+
enable-cache: true
48+
49+
- name: Set up Python
50+
run: uv python install 3.11
4851

4952
- name: Build package
5053
run: |
51-
pip install build
54+
uv pip install build --system
5255
python -m build
5356
5457
- name: Store build artifacts
5558
uses: actions/upload-artifact@v4
5659
with:
5760
name: dist
58-
path: dist/
61+
path: dist/

.github/workflows/docs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
release:
7+
types: [published]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write
12+
pages: write
13+
14+
jobs:
15+
deploy:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v5
24+
with:
25+
enable-cache: true
26+
27+
- name: Set up Python
28+
run: uv python install 3.11
29+
30+
- name: Install dependencies
31+
run: uv pip install -e .[docs] --system
32+
33+
- name: Configure git
34+
run: |
35+
git config user.name "github-actions[bot]"
36+
git config user.email "github-actions[bot]@users.noreply.github.com"
37+
38+
- name: Deploy docs
39+
run: mkdocs gh-deploy --force

.github/workflows/release.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v4
1212

13-
- name: Set up Python
14-
uses: actions/setup-python@v5
13+
- name: Install uv
14+
uses: astral-sh/setup-uv@v5
1515
with:
16-
python-version: "3.11"
16+
enable-cache: true
1717

18-
- name: Install dependencies
19-
run: |
20-
python -m pip install --upgrade pip
21-
pip install build twine
18+
- name: Set up Python
19+
run: uv python install 3.11
20+
21+
- name: Install build tools
22+
run: uv pip install build twine --system
2223

2324
- name: Build and publish
2425
env:
2526
TWINE_USERNAME: __token__
2627
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
2728
run: |
2829
python -m build
29-
twine upload dist/*
30+
twine upload dist/*

CHANGELOG.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
---
1919

20+
## [0.3.0] - 2025-01-26
21+
22+
### Added
23+
- **Documentation Site** deployed to GitHub Pages
24+
- Core concepts guide explaining batch-once-then-mask pattern
25+
- Full API reference with mkdocstrings
26+
- Installation and quick start guides
27+
28+
- **Calibration Metrics** (`molax/metrics/`)
29+
- `expected_calibration_error` for measuring uncertainty quality
30+
- `compute_calibration_curve` for calibration analysis
31+
- `negative_log_likelihood` metric
32+
- `calibration_report` for comprehensive analysis
33+
- Visualization tools: `plot_calibration_curve`, `plot_reliability_diagram`
34+
35+
### Changed
36+
- **Migrated to uv** for package management
37+
- CI/CD workflows now use `astral-sh/setup-uv@v5`
38+
- Installation instructions updated to uv-first
39+
- Faster dependency resolution and caching
40+
41+
- Simplified README with links to documentation site
42+
43+
---
44+
2045
## [0.2.0] - 2025-01-26
2146

2247
### Added
@@ -53,6 +78,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5378

5479
---
5580

56-
[Unreleased]: https://github.com/HFooladi/molax/compare/v0.2.0...HEAD
81+
[Unreleased]: https://github.com/HFooladi/molax/compare/v0.3.0...HEAD
82+
[0.3.0]: https://github.com/HFooladi/molax/compare/v0.2.0...v0.3.0
5783
[0.2.0]: https://github.com/HFooladi/molax/compare/v0.1.0...v0.2.0
5884
[0.1.0]: https://github.com/HFooladi/molax/releases/tag/v0.1.0

CLAUDE.md

Lines changed: 68 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Molax is a high-performance JAX framework for molecular active learning. It uses
99
## Quick Commands
1010

1111
```bash
12-
# Setup
13-
source env.sh # or: pip install -e .[dev]
12+
# Setup (using uv)
13+
source env.sh
1414

1515
# Test
1616
pytest tests/
@@ -19,9 +19,15 @@ pytest tests/
1919
ruff format .
2020
ruff check .
2121

22+
# Build docs locally
23+
uv pip install -e .[docs]
24+
mkdocs serve
25+
2226
# Run examples
2327
python examples/simple_active_learning.py
2428
python examples/active_learning_benchmark.py
29+
python examples/ensemble_demo.py
30+
python examples/evidential_demo.py
2531
```
2632

2733
## Architecture
@@ -59,17 +65,22 @@ SMILES string
5965
jraph.GraphsTuple (single molecule)
6066
↓ jraph.batch()
6167
jraph.GraphsTuple (batched - all molecules as one graph)
62-
↓ UncertaintyGCN
68+
↓ UncertaintyGCN / DeepEnsemble / EvidentialGCN
6369
(mean, variance) predictions
6470
```
6571

6672
### Key Files
6773

6874
| File | Purpose |
6975
|------|---------|
70-
| `molax/models/gcn.py` | `GCNConfig`, `UncertaintyGCN`, `train_step`, `eval_step` |
76+
| `molax/models/gcn.py` | `GCNConfig`, `UncertaintyGCN`, `MolecularGCN`, `train_step`, `eval_step` |
77+
| `molax/models/ensemble.py` | `EnsembleConfig`, `DeepEnsemble` for ensemble uncertainty |
78+
| `molax/models/evidential.py` | `EvidentialConfig`, `EvidentialGCN` for evidential uncertainty |
7179
| `molax/utils/data.py` | `MolecularDataset`, `smiles_to_jraph`, `batch_graphs` |
72-
| `molax/acquisition/uncertainty.py` | `uncertainty_sampling`, `diversity_sampling`, `combined_acquisition` |
80+
| `molax/acquisition/uncertainty.py` | `uncertainty_sampling`, `ensemble_uncertainty_sampling`, `evidential_uncertainty_sampling` |
81+
| `molax/acquisition/diversity.py` | `diversity_sampling` |
82+
| `molax/metrics/calibration.py` | `expected_calibration_error`, `calibration_report` |
83+
| `molax/metrics/visualization.py` | `plot_calibration_curve`, `plot_reliability_diagram` |
7384

7485
### Model API
7586

@@ -88,6 +99,55 @@ model = UncertaintyGCN(config, rngs=nnx.Rngs(0))
8899
mean, variance = model(batched_graphs, training=True)
89100
```
90101

102+
### Ensemble API
103+
104+
```python
105+
from molax.models.ensemble import EnsembleConfig, DeepEnsemble
106+
107+
config = EnsembleConfig(
108+
node_features=6,
109+
hidden_features=[64, 64],
110+
out_features=1,
111+
n_members=5,
112+
)
113+
ensemble = DeepEnsemble(config, rngs=nnx.Rngs(0))
114+
115+
# Returns separate epistemic and aleatoric uncertainty
116+
mean, epistemic_var, aleatoric_var = ensemble(batched_graphs, training=False)
117+
```
118+
119+
### Evidential API
120+
121+
```python
122+
from molax.models.evidential import EvidentialConfig, EvidentialGCN
123+
124+
config = EvidentialConfig(
125+
node_features=6,
126+
hidden_features=[64, 64],
127+
out_features=1,
128+
)
129+
model = EvidentialGCN(config, rngs=nnx.Rngs(0))
130+
131+
# Single forward pass for both uncertainties
132+
mean, aleatoric_var, epistemic_var = model(batched_graphs, training=False)
133+
```
134+
135+
### Calibration Metrics
136+
137+
```python
138+
from molax.metrics import expected_calibration_error, calibration_report
139+
from molax.metrics.visualization import plot_calibration_curve
140+
141+
# Compute ECE
142+
ece = expected_calibration_error(predictions, variances, targets)
143+
144+
# Generate full report
145+
report = calibration_report(predictions, variances, targets)
146+
147+
# Visualize
148+
fig = plot_calibration_curve(predictions, variances, targets)
149+
```
150+
91151
### Optimizer Pattern (Flax 0.11+)
92152

93153
```python
@@ -104,7 +164,10 @@ optimizer.update(model, grads)
104164
```bash
105165
pytest tests/ -v # All tests
106166
pytest tests/test_gcn.py -v # Model tests
167+
pytest tests/test_ensemble.py -v # Ensemble tests
168+
pytest tests/test_evidential.py -v # Evidential tests
107169
pytest tests/test_acquisition.py -v # Acquisition tests
170+
pytest tests/test_calibration.py -v # Calibration tests
108171
```
109172

110173
## Dependencies

0 commit comments

Comments
 (0)