pub struct StatisticalComputingLibrary { /* private fields */ }Expand description
Statistical Computing Library Manager
Implementations§
Source§impl StatisticalComputingLibrary
impl StatisticalComputingLibrary
Sourcepub fn initialize(&mut self) -> Result<(), StatisticalError>
pub fn initialize(&mut self) -> Result<(), StatisticalError>
Initialize the library
Sourcepub fn create_dataset(
&mut self,
dataset_id: String,
data: Vec<Vec<DataValue>>,
column_names: Vec<String>,
column_types: Vec<DataType>,
privacy_level: PrivacyLevel,
) -> Result<Dataset, StatisticalError>
pub fn create_dataset( &mut self, dataset_id: String, data: Vec<Vec<DataValue>>, column_names: Vec<String>, column_types: Vec<DataType>, privacy_level: PrivacyLevel, ) -> Result<Dataset, StatisticalError>
Create a new dataset
Sourcepub fn mean(
&mut self,
dataset_id: &str,
column: &str,
privacy_preserved: bool,
) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
pub fn mean( &mut self, dataset_id: &str, column: &str, privacy_preserved: bool, ) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
Compute mean of a column
Sourcepub fn median(
&mut self,
dataset_id: &str,
column: &str,
privacy_preserved: bool,
) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
pub fn median( &mut self, dataset_id: &str, column: &str, privacy_preserved: bool, ) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
Compute median of a column
Sourcepub fn variance(
&mut self,
dataset_id: &str,
column: &str,
sample: bool,
privacy_preserved: bool,
) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
pub fn variance( &mut self, dataset_id: &str, column: &str, sample: bool, privacy_preserved: bool, ) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
Compute variance of a column
Sourcepub fn correlation(
&mut self,
dataset_id: &str,
column1: &str,
column2: &str,
method: CorrelationMethod,
privacy_preserved: bool,
) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
pub fn correlation( &mut self, dataset_id: &str, column1: &str, column2: &str, method: CorrelationMethod, privacy_preserved: bool, ) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
Compute correlation between two columns
Sourcepub fn t_test(
&mut self,
dataset_id: &str,
column: &str,
hypothesis_type: HypothesisType,
privacy_preserved: bool,
) -> Result<StatisticalAnalysisResult<TTestResult>, StatisticalError>
pub fn t_test( &mut self, dataset_id: &str, column: &str, hypothesis_type: HypothesisType, privacy_preserved: bool, ) -> Result<StatisticalAnalysisResult<TTestResult>, StatisticalError>
Perform t-test
Sourcepub fn histogram(
&mut self,
dataset_id: &str,
column: &str,
bins: usize,
privacy_preserved: bool,
) -> Result<StatisticalAnalysisResult<HistogramResult>, StatisticalError>
pub fn histogram( &mut self, dataset_id: &str, column: &str, bins: usize, privacy_preserved: bool, ) -> Result<StatisticalAnalysisResult<HistogramResult>, StatisticalError>
Generate histogram
Sourcepub fn standard_deviation(
&self,
dataset_id: &str,
column: &str,
sample: bool,
) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
pub fn standard_deviation( &self, dataset_id: &str, column: &str, sample: bool, ) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
Standard deviation (sample = true → Bessel-corrected).
Sourcepub fn skewness(
&self,
dataset_id: &str,
column: &str,
) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
pub fn skewness( &self, dataset_id: &str, column: &str, ) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
Sample skewness (Fisher-Pearson).
Sourcepub fn kurtosis(
&self,
dataset_id: &str,
column: &str,
) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
pub fn kurtosis( &self, dataset_id: &str, column: &str, ) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
Excess kurtosis.
Sourcepub fn mode(
&self,
dataset_id: &str,
column: &str,
) -> Result<ModeResult, StatisticalError>
pub fn mode( &self, dataset_id: &str, column: &str, ) -> Result<ModeResult, StatisticalError>
Modal value + its frequency.
Sourcepub fn quantile(
&self,
dataset_id: &str,
column: &str,
q: f64,
) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
pub fn quantile( &self, dataset_id: &str, column: &str, q: f64, ) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
The q-quantile (q ∈ [0,1]) via linear interpolation between order
statistics. percentile is the same with p ∈ [0,100].
Sourcepub fn covariance(
&self,
dataset_id: &str,
column_x: &str,
column_y: &str,
sample: bool,
) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
pub fn covariance( &self, dataset_id: &str, column_x: &str, column_y: &str, sample: bool, ) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
Covariance between two columns (sample = true → divide by n-1).
Sourcepub fn linear_regression(
&self,
dataset_id: &str,
column_x: &str,
column_y: &str,
) -> Result<LinearRegression, StatisticalError>
pub fn linear_regression( &self, dataset_id: &str, column_x: &str, column_y: &str, ) -> Result<LinearRegression, StatisticalError>
Ordinary-least-squares simple linear regression y ~ x with full
inferential statistics (slope/intercept, R², standard errors, t, p).
Sourcepub fn polynomial_regression(
&self,
dataset_id: &str,
column_x: &str,
column_y: &str,
degree: usize,
) -> Result<PolynomialFit, StatisticalError>
pub fn polynomial_regression( &self, dataset_id: &str, column_x: &str, column_y: &str, degree: usize, ) -> Result<PolynomialFit, StatisticalError>
Polynomial regression y ~ poly(x, degree) by least squares (normal
equations). Returns ascending-power coefficients and in-sample R².
Sourcepub fn logistic_regression(
&self,
dataset_id: &str,
feature_columns: &[&str],
label_column: &str,
fit_intercept: bool,
) -> Result<GlmModel, StatisticalError>
pub fn logistic_regression( &self, dataset_id: &str, feature_columns: &[&str], label_column: &str, fit_intercept: bool, ) -> Result<GlmModel, StatisticalError>
Binary logistic regression by IRLS (label in {0,1}), with Wald
standard errors, z-statistics and p-values on the coefficients.
Sourcepub fn anova(
&self,
dataset_id: &str,
group_columns: &[&str],
) -> Result<AnovaResult, StatisticalError>
pub fn anova( &self, dataset_id: &str, group_columns: &[&str], ) -> Result<AnovaResult, StatisticalError>
One-way ANOVA across the named columns (each column is a group). Groups may have unequal lengths; Null cells are dropped per column.
Sourcepub fn chi_square_gof(
&self,
dataset_id: &str,
observed_column: &str,
expected_column: Option<&str>,
) -> Result<ChiSquareResult, StatisticalError>
pub fn chi_square_gof( &self, dataset_id: &str, observed_column: &str, expected_column: Option<&str>, ) -> Result<ChiSquareResult, StatisticalError>
Chi-square goodness-of-fit test: observed counts vs. expected counts.
If expected_column is None, a uniform expectation is used.
Sourcepub fn chi_square_independence(
&self,
dataset_id: &str,
columns: &[&str],
) -> Result<ChiSquareResult, StatisticalError>
pub fn chi_square_independence( &self, dataset_id: &str, columns: &[&str], ) -> Result<ChiSquareResult, StatisticalError>
Chi-square test of independence over a contingency table whose columns are the named columns (each row of the table is one dataset row).
Sourcepub fn autocorrelation(
&self,
dataset_id: &str,
column: &str,
lag: usize,
) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
pub fn autocorrelation( &self, dataset_id: &str, column: &str, lag: usize, ) -> Result<StatisticalAnalysisResult<f64>, StatisticalError>
Autocorrelation of a column at the given lag (biased estimator).
Sourcepub fn moving_average(
&self,
dataset_id: &str,
column: &str,
window: usize,
) -> Result<Vec<f64>, StatisticalError>
pub fn moving_average( &self, dataset_id: &str, column: &str, window: usize, ) -> Result<Vec<f64>, StatisticalError>
Simple moving average of a column with the given window.
Sourcepub fn exponential_smoothing(
&self,
dataset_id: &str,
column: &str,
alpha: f64,
) -> Result<Vec<f64>, StatisticalError>
pub fn exponential_smoothing( &self, dataset_id: &str, column: &str, alpha: f64, ) -> Result<Vec<f64>, StatisticalError>
Single exponential smoothing of a column with factor alpha ∈ (0,1].
Sourcepub fn kmeans(
&self,
dataset_id: &str,
feature_columns: &[&str],
k: usize,
max_iter: usize,
seed: u64,
) -> Result<KMeansModel, StatisticalError>
pub fn kmeans( &self, dataset_id: &str, feature_columns: &[&str], k: usize, max_iter: usize, seed: u64, ) -> Result<KMeansModel, StatisticalError>
K-means clustering over the named feature columns. Returns the fitted model (centroids, per-point labels, inertia, convergence).
Sourcepub fn linear_svm(
&self,
dataset_id: &str,
feature_columns: &[&str],
label_column: &str,
c: f64,
) -> Result<SvmFitResult, StatisticalError>
pub fn linear_svm( &self, dataset_id: &str, feature_columns: &[&str], label_column: &str, c: f64, ) -> Result<SvmFitResult, StatisticalError>
Soft-margin linear SVM over the named feature columns with a boolean
label column (non-zero = positive class). Returns a fit summary with
support-vector count and in-sample accuracy.
Sourcepub fn random_forest(
&self,
dataset_id: &str,
feature_columns: &[&str],
target_column: &str,
n_trees: usize,
classifier: bool,
seed: u64,
) -> Result<RandomForestFitResult, StatisticalError>
pub fn random_forest( &self, dataset_id: &str, feature_columns: &[&str], target_column: &str, n_trees: usize, classifier: bool, seed: u64, ) -> Result<RandomForestFitResult, StatisticalError>
Random-forest fit over the named feature columns and a target column.
classifier = true fits a classification forest (integer labels) and
reports in-sample accuracy; otherwise a regression forest reporting R².
Sourcepub fn get_performance_stats(&self) -> SystemMetrics
pub fn get_performance_stats(&self) -> SystemMetrics
Get performance statistics
Sourcepub fn list_datasets(&self) -> Vec<String>
pub fn list_datasets(&self) -> Vec<String>
List all datasets
Sourcepub fn get_dataset_info(&self, dataset_id: &str) -> Option<DatasetMetadata>
pub fn get_dataset_info(&self, dataset_id: &str) -> Option<DatasetMetadata>
Get dataset information
Auto Trait Implementations§
impl Freeze for StatisticalComputingLibrary
impl RefUnwindSafe for StatisticalComputingLibrary
impl Send for StatisticalComputingLibrary
impl Sync for StatisticalComputingLibrary
impl Unpin for StatisticalComputingLibrary
impl UnsafeUnpin for StatisticalComputingLibrary
impl UnwindSafe for StatisticalComputingLibrary
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more