gizai/tensor/stats
the statistics of a Tensor of any real element type (T extends Real: i64, u64, f64, i32, f32, ...), as numpy's mean, var, quantile and median over an ndarray. Each computes in f64 and gives f64, also for integers. gizlang/stats keeps the forms over a sequence that is not a tensor.
import * as Stats from "gizai/tensor/stats";Methods
Tensor.mean
function Tensor.mean<T extends Real>(self: Tensor<T>): f64The mean of every element; NaN for none.
Tensor.variance
function Tensor.variance<T extends Real>(self: Tensor<T>, ddof: i64): f64The variance of every element with DDOF degrees of freedom removed (0: population, 1: sample), in two passes.
Tensor.quantile
function Tensor.quantile<T extends Real>(self: Tensor<T>, q: f64): f64The Q-quantile (0 <= Q <= 1) of every element, interpolating between the closest ranks (numpy's default).
Tensor.median
function Tensor.median<T extends Real>(self: Tensor<T>): f64The middle element, or the mean of the two middle ones.
Tensor.meanAlong
function Tensor.meanAlong<T extends Real>(self: Tensor<T>, axis: i64): Tensor<f64>The mean along AXIS: a tensor of the other axes (numpy's mean(axis)).