2 个版本
使用旧的 Rust 2015
0.1.1 | 2018年5月27日 |
---|---|
0.1.0 | 2018年5月27日 |
#707 in 机器学习
9KB
66 行
Deeprust 代码库
Rust 中的机器学习库
安装包
cargo install deeprust
或者你也可以在 Cargo.toml 依赖部分提及库名来安装它
基本示例
- 导入库
extern crate deeprust;
- 根据你要构建的应用程序使用可用的 API,例如,我想获取我的模型性能的混淆矩阵
#[macro_use(Confusionmatrix)]
extern crate deeprust;
use deeprust::metrics::confusion_matrix;
fn main() {
// assigning random values to the confusion matrix
let sample = Confusionmatrix!(100,50,10,5);
println!("The total predictions {}", sample.total());
// Calculating the accuracy of the model
println!("Accuracy of the model {:.2}", sample.accuracy());
// Calculating the precision of the model
println!("Precision of the model {:.2}", sample.precision());
// Calculating the true positive rate of the model
println!("True positive rate of the model {:.2}",
sample.true_poitive_rate());
// Calculating the false positive rate of the model
println!("False positive rate of the model {:.2}",
sample.false_positive_rate());
// Calculating the misclassification rate of the model
println!("Misclassification rate of the model {:.2}",
sample.misclassification_rate());
// Calculating the specificity of the model
println!("Specificity of the model {:.2}", sample.specificity());
// Calculating the prevalance of the model
println!("Prevalance of the model {:.2}", sample.prevalance());
}
有关 API 的更多详细信息,请参阅官方文档。那里有更多示例
本地设置项目
- 克隆仓库
// Downloading the project
git clone https://github.com/dvigneshwer/deeprust
cd to_proj_dir
cd ./code/deeprust
- 运行构建脚本
bash ./build_project.sh