feat: adds F1 and roc_auc_score

This commit is contained in:
Volodymyr Orlov
2020-06-08 14:47:59 -07:00
parent ee581abf70
commit 14113b4152
10 changed files with 167 additions and 6 deletions
+10
View File
@@ -22,6 +22,10 @@ impl<T: FloatExt + 'static> BaseVector<T> for MatrixMN<T, U1, Dynamic> {
fn len(&self) -> usize {
self.len()
}
fn to_vec(&self) -> Vec<T> {
self.row(0).iter().map(|v| *v).collect()
}
}
impl<T: FloatExt + Scalar + AddAssign + SubAssign + MulAssign + DivAssign + Sum + 'static>
@@ -384,6 +388,12 @@ mod tests {
assert_eq!(5., BaseVector::get(&v, 1));
}
#[test]
fn vec_to_vec() {
let v = RowDVector::from_vec(vec![1., 2., 3.]);
assert_eq!(vec![1., 2., 3.], v.to_vec());
}
#[test]
fn get_set_dynamic() {
let mut m = DMatrix::from_row_slice(2, 3, &[1.0, 2.0, 3.0, 4.0, 5.0, 6.0]);