1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//! Fast, parallel Rust implementation of the UMAP dimensionality reduction algorithm.
//!
//! This library provides a streamlined implementation of UMAP (Uniform Manifold
//! Approximation and Projection) focused on performance and correctness. It requires
//! precomputed k-nearest neighbors and initialization, allowing you to use your
//! preferred libraries for these steps.
//!
//! # Example
//!
//! ```ignore
//! use umap::{Umap, UmapConfig};
//! use umap::EuclideanMetric;
//!
//! // Configure UMAP
//! let config = UmapConfig::default();
//! let umap = Umap::new(config);
//!
//! // Fit to data (requires precomputed KNN and initialization)
//! let model = umap.fit(
//! data.view(),
//! knn_indices.view(),
//! knn_dists.view(),
//! init.view(),
//! );
//!
//! // Get the embedding
//! let embedding = model.embedding();
//! ```
//!
//! # Features
//!
//! - **Parallel optimization**: Rayon's parallel SGD (Hogwild! algorithm)
//! - **Extensible metrics**: Custom distance functions via the `Metric` trait
//! - **Zero-copy views**: Efficient array handling with `ndarray`
//!
//! # Limitations
//!
//! - Dense arrays only (no sparse matrix support)
//! - Fit only (transform for new points not yet implemented)
//! - Panics on invalid input (no Result-based error handling)
//! - Requires external KNN computation and initialization
//!
//! # Public API
//!
//! The library exposes a minimal, well-defined API:
//!
//! * [`Umap`] - Main algorithm struct
//! * [`FittedUmap`] - Fitted model with embeddings
//! * [`UmapConfig`] - Configuration parameters
//! * [`Metric`] - Distance metric trait
//! * [`EuclideanMetric`] - Euclidean distance implementation
// Public modules
// Public re-exports (primary API)
pub use GraphParams;
pub use ManifoldParams;
pub use OptimizationParams;
pub use UmapConfig;
pub use FittedUmap;
pub use Umap;
pub use LearnedManifold;
pub use Metric;
pub use MetricType;
pub use Optimizer;
pub use SparseMat;
// Internal modules (not exposed)
// Public modules (for advanced users)
// Re-export distances for convenience
pub use EuclideanMetric;
// Tests