Skip to main content

Module classification

Module classification 

Source
Expand description

Classification (ISL ch 4) — generative and instance-based classifiers.

  • knn — k-nearest-neighbours (lazy, AllPairs).
  • naive_bayes — Gaussian naive Bayes (generative, Reduction).

LDA / QDA (shared / per-class Gaussian discriminants) land here next, on the linear_algebra covariance solve (build order in stats_plan.md).

Re-exports§

pub use discriminant::LdaModel;
pub use discriminant::QdaModel;
pub use knn::KnnClassifier;
pub use naive_bayes::GaussianNb;
pub use svm::Kernel;
pub use svm::Svm;
pub use svm_multiclass::MulticlassSvm;

Modules§

discriminant
Discriminant analysis (ISL ch 4.4) — LDA (shared covariance ⇒ linear boundary) and QDA (per-class covariance ⇒ quadratic boundary). Both are Gaussian generative classifiers; the covariance inverse / log-determinant come from linear_algebra::cholesky (no new solver). Kernel-class DenseLinear.
knn
k-Nearest-Neighbours classifier (ISL ch 2/4) — a lazy learner: store the training set, classify a query by majority vote of its k nearest neighbours (squared Euclidean). Kernel-class AllPairs (query↔train distances).
naive_bayes
Gaussian Naive Bayes (ISL ch 4.4.4) — a generative classifier assuming the features are conditionally independent Gaussians given the class. Fit per-class priors and per-feature mean/variance (reusing statistics::descriptive); classify by the argmax log-posterior. Kernel-class Reduction.
svm
Support Vector Machine (ISL ch 9, PRML ch 7) — soft-margin binary classifier trained by simplified Sequential Minimal Optimization (SMO) on the dual, with a linear or RBF (Gaussian) kernel. Kernel SVM separates classes a linear boundary cannot. Labels are boolean (true = +1, false = −1). Kernel-class DenseLinear (the kernel matrix) + Divergent (the SMO working-set loop) → CPU here.
svm_multiclass
Multiclass SVM by one-vs-rest (ISL ch 9.4.2) — train one binary SVM per class (that class vs. all others) and predict the class whose decision value is largest. Reuses the binary super::svm (no duplicated SMO).