Skip to main content

fit_transform

Function fit_transform 

Source
pub fn fit_transform(
    data: &[f32],
    n: usize,
    d: usize,
    config: PaCMAPConfig,
    knn: Option<&KnnGraph>,
    progress: Option<Sender<PaCMAPProgress>>,
    cancel: Option<Arc<AtomicBool>>,
) -> Result<Vec<[f32; 2]>, PaCMAPError>
Expand description

Embed n × d row-major f32 data into 2 dimensions.

§Arguments

  • data: flat row-major slice, len = n * d
  • n: number of points; must be ≥ 2 and ≤ u32::MAX
  • d: number of dimensions per point; must be ≥ 1
  • config: algorithm configuration
  • knn: optional precomputed KnnGraph. When None, KNN is computed internally (n_neighbors + 50 candidates, capped by n − 1). When Some, search is skipped after validating n / k / metric.
  • progress: optional channel for per-iteration progress events
  • cancel: optional cancellation token; checked once per iteration

§Returns

n [f32; 2] pairs aligned with the input rows, or a PaCMAPError.

§Breaking change

As of 0.1.2 the signature inserts knn: Option<&KnnGraph> after config. One-shot callers pass None; staged callers pass Some(&graph) from compute_knn.