docs.rs failed to build ndarray-glm-0.0.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
ndarray-glm-0.0.12
ndarray-glm
Rust library for solving linear, logistic, and generalized linear models through
iteratively reweighted least squares, using the ndarray-linalg
module.
Status
This package is in early alpha and the interface is likely to undergo many changes.
Prerequisites
fortran and BLAS must be installed:
sudo apt update && sudo apt install gfortran libblas-dev
To use the OpenBLAS backend, install also libopenblas-dev
and use this crate with the "openblas-src" feature.
Example
use array;
use ;
// define some test data
let data_y = array!;
let data_x = array!;
// The design matrix can optionally be standardized, where the mean of each independent
// variable is subtracted and each is then divided by the standard deviation of that variable.
let data_x = standardize;
// The model is general over floating point type.
// If the second argument is left "_", it will be inferred if possible.
// L2 regularization can be applied with l2_reg().
let model = new.l2_reg.build?;
let fit = model.fit?;
println!;
Features
- Linear regression
- Logistic regression
- Generalized linear model IRLS
- Linear offsets
- Allow non-float domain types
- L2 (ridge) Regularization
- L1 (lasso) Regularization
- Generic over floating point type
- Poisson
- Exponential
- Gamma (which effectively reduces to exponential with an arbitrary dispersion parameter)
- Inverse Gaussian
- Other exponential family distributions
- Option for data standardization/normalization
- Weighted regressions
- Weight the covariance matrix with point-by-point error bars
- Allow for off-diagonal correlations between points
- Fix likelihood functions
- Check the tolerance conditions for termination
- Non-canonical link functions
- Goodness-of-fit tests
- Log-likelihood difference from saturated model
- Aikaike and Bayesian information criteria
- generalized R^2?
TODO
- Generalize GLM interface to allow multi-parameter fits like a gamma distribution.
- Exact Z-scores by re-minimizing after fixing each parameter to zero (?)
- Unit tests for correct convergence with linear offsets
- Calculate/estimate dispersion parameter from the data
References
- Author's notes
- https://www.stat.cmu.edu/~ryantibs/advmethods/notes/glm.pdf
- https://bwlewis.github.io/GLM/
- https://statmath.wu.ac.at/courses/heather_turner/glmCourse_001.pdf
- Maalouf, M., & Siddiqi, M. (2014). Weighted logistic regression for large-scale imbalanced and rare events data. Knowledge-Based Systems, 59, 142–148.
- Disperson parameter lecture
- Convergence problems in GLMs