Expand description
Covariance and correlation helpers.
This module provides routines for measuring the relationship between columns or rows of matrices.
use rustframe::compute::stats::correlation;
use rustframe::matrix::Matrix;
let x = Matrix::from_vec(vec![1.0, 2.0, 3.0, 4.0], 2, 2);
let cov = correlation::covariance(&x, &x);
assert!((cov - 1.25).abs() < 1e-8);
Functionsยง
- covariance
- Population covariance between two equally-sized matrices (flattened)
- covariance_
horizontal - Covariance between rows (i.e. across columns)
- covariance_
matrix - Calculates the covariance matrix of the input data.
Assumes input
x
is (n_samples, n_features). - covariance_
vertical - Covariance between columns (i.e. across rows)
- pearson