feat: refactors packages layout
This commit is contained in:
@@ -1,23 +0,0 @@
|
|||||||
use crate::common::Nominal;
|
|
||||||
|
|
||||||
pub mod knn;
|
|
||||||
pub mod logistic_regression;
|
|
||||||
pub mod decision_tree;
|
|
||||||
pub mod random_forest;
|
|
||||||
|
|
||||||
pub trait Classifier<X, Y>
|
|
||||||
where
|
|
||||||
Y: Nominal
|
|
||||||
{
|
|
||||||
|
|
||||||
fn predict(&self, x: &X) -> Y;
|
|
||||||
|
|
||||||
fn predict_vec(&self, x: &Vec<X>) -> Vec<Y>{
|
|
||||||
let mut result = Vec::new();
|
|
||||||
for xv in x.iter() {
|
|
||||||
result.push(self.predict(xv));
|
|
||||||
}
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
pub mod random_forest;
|
||||||
@@ -3,7 +3,7 @@ extern crate rand;
|
|||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use crate::linalg::Matrix;
|
use crate::linalg::Matrix;
|
||||||
use crate::classification::decision_tree::{DecisionTree, DecisionTreeParameters, SplitCriterion, which_max};
|
use crate::tree::decision_tree::{DecisionTree, DecisionTreeParameters, SplitCriterion, which_max};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct RandomForestParameters {
|
pub struct RandomForestParameters {
|
||||||
+4
-2
@@ -1,5 +1,7 @@
|
|||||||
pub mod classification;
|
pub mod linear;
|
||||||
pub mod regression;
|
pub mod neighbors;
|
||||||
|
pub mod ensemble;
|
||||||
|
pub mod tree;
|
||||||
pub mod cluster;
|
pub mod cluster;
|
||||||
pub mod decomposition;
|
pub mod decomposition;
|
||||||
pub mod linalg;
|
pub mod linalg;
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
pub mod linear_regression;
|
||||||
|
pub mod logistic_regression;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
pub mod knn;
|
||||||
@@ -1 +0,0 @@
|
|||||||
pub mod linear_regression;
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
pub mod decision_tree;
|
||||||
Reference in New Issue
Block a user