Skip to main content

Module algorithms

Module algorithms 

Source
Expand description

Unsupervised learning algorithms.

This module defines the shared algorithm primitives — the squared-Euclidean distance helper and a small Matrix view over row-major data — and houses the clustering family in the clustering subgroup folder. Every clustering routine consumes &[Vec<f64>] (one inner Vec per observation) and returns a label vector that the equivalence suite compares to scikit-learn by adjusted Rand index.

Decomposition/embedding (PCA, factor analysis, ICA, t-SNE, UMAP, LLE) live in the decomposition subgroup; they compare to their scikit-learn references under the sign/order/stochastic-aware standards documented there. PELT change-point detection lives in change_point and compares to ruptures for exact breakpoint equality. Gaussian kernel density estimation lives in density and compares to scipy.stats.gaussian_kde (Scott’s-rule bandwidth) to machine precision. Univariate outlier / anomaly detection (z-score, IQR Tukey fence, modified MAD-based z-score) lives in outlier and compares to scipy.stats.zscore and numpy.percentile to machine precision. Univariate feature selection (variance threshold + ANOVA F-test f_classif score) lives in feature_selection and compares to sklearn.feature_selection.VarianceThreshold and sklearn.feature_selection.f_classif (F-scores to ~1e-9, p-values to the F distribution’s asymptotic 1e-6 tail band, variances exact). HyperLogLog distinct-count (cardinality) estimation lives in cardinality; it has no canonical reference library, so it is checked against the exact distinct count (a HashSet ground truth) landing inside a small multiple of HyperLogLog’s ≈ 1.04 / √m theoretical standard error.

Modules§

association
Market-basket association-rule mining: Apriori frequent-itemset generation and the support / confidence / lift (plus leverage / conviction) rule metrics.
cardinality
HyperLogLog distinct-count (cardinality) estimation.
change_point
Change-point detection algorithms.
clustering
Clustering algorithms and their shared types.
decomposition
Decomposition and embedding algorithms and their shared linear algebra.
density
Kernel density estimation (KDE) with a Gaussian kernel.
feature_selection
Univariate feature selection: variance-threshold filtering and the ANOVA F-test (f_classif) univariate score.
outlier
Univariate outlier / anomaly detection: z-score, IQR (Tukey fence), and modified (MAD-based) z-score detectors.
regression
Linear regression: ordinary least squares (OLS) and ridge (L2) regression.

Functions§

centroid
Computes the elementwise mean (centroid) of a non-empty set of points.
count_to_f64
Widens a usize count to f64 without an as cast.
euclidean_sq
Computes the squared Euclidean distance between two equal-length points.