linreg-core 0.8.1

Lightweight regression library (OLS, Ridge, Lasso, Elastic Net, WLS, LOESS, Polynomial) with 14 diagnostic tests, cross validation, and prediction intervals. Pure Rust - no external math dependencies. WASM, Python, FFI, and Excel XLL bindings.
Documentation
//! WASM-specific bindings for linreg-core
//!
//! This module contains all WebAssembly bindings using wasm-bindgen.
//! These functions are only compiled when the "wasm" feature is enabled.
//!
//! All WASM functions accept and return JSON strings for JavaScript interoperability.
//!
//! # Module Structure
//!
//! - [`csv`] - CSV parsing for WASM
//! - [`regression`] - OLS and weighted least squares regression
//! - [`diagnostics`] - All diagnostic test wrappers
//! - [`regularized`] - Ridge, Lasso, Elastic Net regression
//! - [`cross_validation`] - K-Fold Cross Validation
//! - [`loess`] - LOESS regression fitting and prediction
//! - [`stats`] - Statistical utility functions
//! - [`domain`] - Domain checking for security
//! - [`tests`] - Test and validation functions

#![cfg(feature = "wasm")]

pub mod cross_validation;
pub mod csv;
pub mod diagnostics;
pub mod domain;
pub mod feature_importance;
pub mod loess;
pub mod polynomial;
pub mod prediction_intervals;
pub mod regression;
pub mod regularized;
pub mod serialization;
pub mod stats;
pub mod tests;

// Re-export all #[wasm_bindgen] functions for external use
pub use cross_validation::{kfold_cv_elastic_net, kfold_cv_lasso, kfold_cv_ols, kfold_cv_ridge};
pub use csv::parse_csv;
pub use domain::check_domain;
pub use feature_importance::{
    feature_importance_ols,
    permutation_importance_ols, permutation_importance_ridge, permutation_importance_lasso,
    permutation_importance_elastic_net, permutation_importance_loess,
    shap_values_linear, shap_values_ridge, shap_values_lasso, shap_values_elastic_net,
    shap_values_polynomial,
    standardized_coefficients, vif_ranking,
};
pub use loess::{loess_fit, loess_predict};
pub use polynomial::{
    polynomial_elastic_net_wasm, polynomial_lasso_wasm, polynomial_predict_wasm,
    polynomial_regression_wasm, polynomial_ridge_wasm,
};
pub use prediction_intervals::{
    ols_prediction_intervals, ridge_prediction_intervals as wasm_ridge_pi,
    lasso_prediction_intervals as wasm_lasso_pi,
    elastic_net_prediction_intervals as wasm_enet_pi,
};
pub use regression::{ols_regression, wls_regression};
pub use regularized::{
    elastic_net_path_wasm, elastic_net_regression, lasso_regression, make_lambda_path,
    ridge_regression,
};
pub use serialization::{deserialize_model, get_model_metadata, serialize_model};
pub use stats::{
    get_normal_inverse, get_t_cdf, get_t_critical, stats_correlation, stats_five_number_summary,
    stats_max, stats_mean, stats_median, stats_min, stats_mode, stats_quantile, stats_range,
    stats_stddev, stats_variance,
};

// Re-export all diagnostic test functions
pub use diagnostics::{
    anderson_darling_test, breusch_godfrey_test, breusch_pagan_test, cooks_distance_test,
    dfbetas_test, dffits_test, harvey_collier_test, jarque_bera_test, durbin_watson_test,
    python_white_test, r_white_test, rainbow_test, reset_test, shapiro_wilk_test, vif_test,
    white_test,
};

// Re-export test functions
pub use tests::{get_version, test, test_ci, test_housing_regression, test_r_accuracy, test_t_critical};