[−][src]Crate smartcore
SmartCore
Welcome to SmartCore, the most advanced machine learning library in Rust!
SmartCore features various classification, regression and clustering algorithms including support vector machines, random forests, k-means and DBSCAN, as well as tools for model selection and model evaluation.
SmartCore is well integrated with a with wide variaty of libraries that provide support for large, multi-dimensional arrays and matrices. At this moment, all Smartcore's algorithms work with ordinary Rust vectors, as well as matrices and vectors defined in these packages:
Getting Started
To start using SmartCore simply add the following to your Cargo.toml file:
[dependencies] smartcore = "0.2.0"
All machine learning algorithms in SmartCore are grouped into these broad categories:
- Clustering, unsupervised clustering of unlabeled data.
- Martix Decomposition, various methods for matrix decomposition.
- Linear Models, regression and classification methods where output is assumed to have linear relation to explanatory variables
- Ensemble Models, variety of regression and classification ensemble models
- Tree-based Models, classification and regression trees
- Nearest Neighbors, K Nearest Neighbors for classification and regression
- Naive Bayes, statistical classification technique based on Bayes Theorem
- SVM, support vector machines
For example, you can use this code to fit a K Nearest Neighbors classifier to a dataset that is defined as standard Rust vector:
// DenseMatrix defenition use smartcore::linalg::naive::dense_matrix::*; // KNNClassifier use smartcore::neighbors::knn_classifier::*; // Various distance metrics use smartcore::math::distance::*; // Turn Rust vectors with samples into a matrix let x = DenseMatrix::from_2d_array(&[ &[1., 2.], &[3., 4.], &[5., 6.], &[7., 8.], &[9., 10.]]); // Our classes are defined as a Vector let y = vec![2., 2., 2., 3., 3.]; // Train classifier let knn = KNNClassifier::fit(&x, &y, Default::default()).unwrap(); // Predict classes let y_hat = knn.predict(&x).unwrap();
Modules
algorithm | Various algorithms and helper methods that are used elsewhere in SmartCore |
api | Common Interfaces and API |
cluster | Algorithms for clustering of unlabeled data |
dataset | Various datasets Datasets |
decomposition | Matrix decomposition algorithms |
ensemble | Ensemble methods, including Random Forest classifier and regressor |
error | Custom warnings and errors |
linalg | Diverse collection of linear algebra abstractions and methods that power SmartCore algorithms |
linear | Supervised classification and regression models that assume linear relationship between dependent and explanatory variables. |
math | Helper methods and classes, including definitions of distance metrics |
metrics | Functions for assessing prediction error. |
model_selection | Model Selection methods |
naive_bayes | Supervised learning algorithms based on applying the Bayes theorem with the independence assumptions between predictors |
neighbors | Supervised neighbors-based learning methods |
svm | Support Vector Machines |
tree | Supervised tree-based learning methods |