Skip to main content

Module common

Module common 

Source
Expand description

Shared building blocks: model traits, a seeded random helper and small numeric utilities.

Data is stored as ndarray arrays: a feature matrix x of shape (samples, features) (a VR2D view) and targets as a VR1D (regression) or &[usize] class labels (classification).

See the book entry Foundations.

Structs§

MlRng
A small seeded random-number helper used by the stochastic algorithms.

Traits§

Classifier
A model mapping feature rows to class labels 0..classes.
Clusterer
A model that groups rows without labels. Noise points (density-based methods) get None.
Regressor
A model mapping feature rows to real-valued predictions.
Transformer
A learned transformation of feature rows (scaling, projection, embedding).

Functions§

argmax
The index of the largest value (first on ties); None if empty or all NaN.
check_features
Checks a non-empty feature matrix with finite values.
check_xy
Checks features and a matching-length target.
class_count
The number of classes implied by labels (max label + 1).
pairwise_distances
The matrix of Euclidean distances between all pairs of rows.
rows
The rows of a matrix as owned vectors.
squared_distance
Squared Euclidean distance between two equal-length slices.