DataSet

Struct DataSet 

Source
pub struct DataSet<T>(pub Vec<T>);
Expand description

A high-performance structure encapsulating a linear array of values designed for descriptive and bivariate statistical data mining.

Tuple Fields§

§0: Vec<T>

Implementations§

Source§

impl DataSet<f64>

Source

pub fn new(data: Vec<f64>) -> Self

Instantiates a new data frame context around a contiguous memory buffer.

§Example
use scicdh::statistics::DataSet;
let ds = DataSet::new(vec![1.0, 2.0, 3.0]);
Source

pub fn mean(&self) -> CDHResult<f64>

Computes the arithmetic mean ($\mu$) of the sample space.

$$\mu = \frac{\sum_{i=1}^n x_i}{n}$$

Source

pub fn median(&self) -> CDHResult<f64>

Computes the sample median using a non-destructive 0-indexed sorting pipeline. Handles both odd and even dataset lengths correctly.

Source

pub fn mode(&self) -> CDHResult<Option<f64>>

Computes the statistical mode of the dataset in linear time $\mathcal{O}(n)$.

Uses low-level float bit-packing (to_bits()) to completely bypass hashing restrictions on f64. Returns Ok(None) if the distribution is completely uniform (no single clear majority frequency exists).

Source

pub fn range(&self) -> CDHResult<f64>

Calculates the algebraic range (Span) between the maximum and minimum parameters.

$$\text{Range} = X_{\text{max}} - X_{\text{min}}$$

Source

pub fn has(&self, value: f64, other: Option<&[f64]>) -> CDHResult<bool>

Scans a target container or the internal dataset structure to check for the existence of a precise value.

Fixed Bug: Bypassed memory copying vulnerabilities from previous design.

Source

pub fn sample_variation_x2(&self) -> CDHResult<f64>

Computes the sum of squared deviations for the primary variable ($SS_{xx}$).

$$SS_{xx} = \sum x^2 - \frac{(\sum x)^2}{n}$$

Source

pub fn sample_variation_y2(&self, y: &[f64]) -> CDHResult<f64>

Computes the sum of squared deviations for an independent reference slice ($SS_{yy}$).

$$SS_{yy} = \sum y^2 - \frac{(\sum y)^2}{n}$$

Source

pub fn sample_variance(&self) -> CDHResult<f64>

Computes the unbiased sample variance ($s^2$) leveraging Bessel’s correction factor.

$$s^2 = \frac{SS_{xx}}{n - 1}$$

Source

pub fn sample_std_deviation(&self) -> CDHResult<f64>

Computes the unbiased sample standard deviation ($s$).

Source

pub fn sample_coeff_of_variation(&self) -> CDHResult<f64>

Evaluates the dimensionless sample coefficient of variation ($CV$).

$$CV = \frac{s}{\bar{x}}$$

Source

pub fn kth_central_moment(&self, k: f64) -> CDHResult<f64>

Generates the $k$-th mathematical population central moment ($m_k$).

$$\mu_k = \frac{\sum (x_i - \bar{x})^k}{n}$$

Source

pub fn skewness(&self) -> CDHResult<f64>

Measures the skewness ($\beta_3$), tracking distribution symmetry.

Source

pub fn kurtosis(&self) -> CDHResult<f64>

Computes excess kurtosis ($\beta_4$), tracking peak sharpness relative to standard normal shapes.

Source

pub fn sample_variation_xy(&self, y: &[f64]) -> CDHResult<f64>

Computes the cross-variation sum of joint distribution observations ($SS_{xy}$).

$$SS_{xy} = \sum xy - \frac{(\sum x)(\sum y)}{n}$$

Source

pub fn pearson_correlation_coeff(&self, y: &[f64]) -> CDHResult<f64>

Evaluates Pearson’s Product-Moment Correlation Coefficient ($r_{xy}$). Hardened against the textbook typo by using $SS_{yy}$ space arrays.

Source

pub fn into_set(&self) -> CDHResult<Vec<f64>>

Deduplicates entries from the dataset to form a unique element mathematical set pool.

Source

pub fn population_variance(&self) -> CDHResult<f64>

Calculates pure population variance ($\sigma^2$) relative to the exact population mean.

Source

pub fn population_std_deviation(&self) -> CDHResult<f64>

Computes the population standard deviation ($\sigma$).

Source

pub fn max(&self) -> CDHResult<f64>

Evaluates the peak extreme value bound present inside the dataset.

Source

pub fn min(&self) -> CDHResult<f64>

Evaluates the lowest value parameter bound present inside the dataset.

Source

pub fn info(&self) -> CDHResult<()>

Dumps clean debug statements displaying the full metrics profile of the active dataset.

Auto Trait Implementations§

§

impl<T> Freeze for DataSet<T>

§

impl<T> RefUnwindSafe for DataSet<T>
where T: RefUnwindSafe,

§

impl<T> Send for DataSet<T>
where T: Send,

§

impl<T> Sync for DataSet<T>
where T: Sync,

§

impl<T> Unpin for DataSet<T>
where T: Unpin,

§

impl<T> UnwindSafe for DataSet<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.