raso 0.1.0

Pure-Rust manifold projection and density clustering (UMAP, HDBSCAN)
Documentation
# raso

Pure-Rust manifold projection and density clustering (**UMAP** and **HDBSCAN**, with **t-SNE**, Python `abi3`, and WASM bindings planned).

*Raso* (Spanish: flat, level, open, unobstructed) is about flattening high-dimensional embeddings into a 2D/3D plane where structure and clusters become legible.

## Workspace crates

| Crate | Purpose |
| --- | --- |
| [`raso`]crates/raso | Umbrella facade re-exporting sub-crates behind feature flags (`umap`, `hdbscan`, `parallel`) |
| [`raso-umap`]crates/raso-umap | Pure-Rust UMAP dimensionality reduction |
| [`raso-hdbscan`]crates/raso-hdbscan | Pure-Rust HDBSCAN density-based clustering (EOM and Leaf selection, membership probabilities, persistence) |

### Implementation scope (80/20 UMAP)

`raso-umap` currently implements a clean, intentionally simple **80/20 UMAP**:
- Exact brute-force $O(n^2)$ k-NN search (fast and exact for small-to-medium datasets up to ~10k points; avoids NN-Descent complexity for now)
- Smooth k-NN fuzzy simplicial set construction
- Curve-fitted $(a, b)$ parameters and negative-sampling SGD layout optimization
- Out-of-sample `transform` via weighted k-NN initialization + SGD refinement

`raso-hdbscan` implements core distances, mutual-reachability MST, condensed tree construction, EOM/Leaf cluster extraction, soft membership probabilities, and cluster persistence.

## Usage

Add the umbrella crate (or a single member crate like `raso-umap` / `raso-hdbscan`) from GitHub:

```toml
[dependencies]
raso = { git = "https://github.com/mmacpherson/raso" }
ndarray = "0.16"
```

```rust
use ndarray::array;
use raso::hdbscan::{DistanceMetric as HdbscanMetric, Hdbscan};
use raso::umap::{DistanceMetric as UmapMetric, Umap};

let data = array![
    [0.0, 0.0], [0.2, 0.1], [0.1, 0.3],
    [10.0, 10.0], [10.2, 10.1], [10.1, 10.3],
];

let coords = Umap::new()
    .n_neighbors(2)
    .n_components(2)
    .min_dist(0.1)
    .metric(UmapMetric::Euclidean)
    .random_state(42)
    .fit_transform(data.view())?;

let clusters = Hdbscan::new()
    .min_cluster_size(2)
    .metric(HdbscanMetric::Euclidean)
    .fit(coords.view())?;
```

### Single-threaded & `wasm32-unknown-unknown`

`rayon` parallelism is enabled by default via the `parallel` feature. Disable it for single-threaded or WebAssembly builds without `SharedArrayBuffer` / COOP+COEP headers:

```toml
[dependencies]
raso = { git = "https://github.com/mmacpherson/raso", default-features = false, features = ["umap", "hdbscan"] }
```

## Development

```bash
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
cargo test --workspace --no-default-features
cargo check --workspace --no-default-features --target wasm32-unknown-unknown
```

## Roadmap

- `raso-tsne` crate
- `bindings/python` (PyO3 `abi3-py311` wheels for Python 3.11–3.15+)
- `bindings/wasm` (`wasm-bindgen` package for browser-side projection and clustering)
- Approximate k-NN (NN-Descent) for larger datasets in `raso-umap`

## License

MIT — see [LICENSE](LICENSE).