feat: documents matrix decomposition methods

This commit is contained in:
Volodymyr Orlov
2020-09-07 16:28:52 -07:00
parent bbe810d164
commit cc1f84e81f
6 changed files with 250 additions and 10 deletions
+41
View File
@@ -1,3 +1,44 @@
//! # Connector for ndarray
//!
//! If you want to use [ndarray](https://docs.rs/ndarray) matrices and vectors with SmartCore:
//!
//! ```
//! use ndarray::{arr1, arr2};
//! use smartcore::linear::logistic_regression::*;
//! // Enable ndarray connector
//! use smartcore::linalg::ndarray_bindings::*;
//!
//! // Iris dataset
//! let x = arr2(&[
//! [5.1, 3.5, 1.4, 0.2],
//! [4.9, 3.0, 1.4, 0.2],
//! [4.7, 3.2, 1.3, 0.2],
//! [4.6, 3.1, 1.5, 0.2],
//! [5.0, 3.6, 1.4, 0.2],
//! [5.4, 3.9, 1.7, 0.4],
//! [4.6, 3.4, 1.4, 0.3],
//! [5.0, 3.4, 1.5, 0.2],
//! [4.4, 2.9, 1.4, 0.2],
//! [4.9, 3.1, 1.5, 0.1],
//! [7.0, 3.2, 4.7, 1.4],
//! [6.4, 3.2, 4.5, 1.5],
//! [6.9, 3.1, 4.9, 1.5],
//! [5.5, 2.3, 4.0, 1.3],
//! [6.5, 2.8, 4.6, 1.5],
//! [5.7, 2.8, 4.5, 1.3],
//! [6.3, 3.3, 4.7, 1.6],
//! [4.9, 2.4, 3.3, 1.0],
//! [6.6, 2.9, 4.6, 1.3],
//! [5.2, 2.7, 3.9, 1.4],
//! ]);
//! let y = arr1(&[
//! 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
//! 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.
//! ]);
//!
//! let lr = LogisticRegression::fit(&x, &y);
//! let y_hat = lr.predict(&x);
//! ```
use std::iter::Sum;
use std::ops::AddAssign;
use std::ops::DivAssign;