fix: minor refactoring

This commit is contained in:
Volodymyr Orlov
2020-03-31 18:24:01 -07:00
parent 8bb6013430
commit 5766364311
15 changed files with 49 additions and 52 deletions
+3 -3
View File
@@ -68,7 +68,7 @@ impl<T: FloatExt> Node<T> {
}
}
struct NodeVisitor<'a, T: FloatExt + Debug, M: Matrix<T>> {
struct NodeVisitor<'a, T: FloatExt, M: Matrix<T>> {
x: &'a M,
y: &'a Vec<usize>,
node: usize,
@@ -115,7 +115,7 @@ fn impurity<T: FloatExt>(criterion: &SplitCriterion, count: &Vec<usize>, n: usiz
return impurity;
}
impl<'a, T: FloatExt + Debug, M: Matrix<T>> NodeVisitor<'a, T, M> {
impl<'a, T: FloatExt, M: Matrix<T>> NodeVisitor<'a, T, M> {
fn new(node_id: usize, samples: Vec<usize>, order: &'a Vec<Vec<usize>>, x: &'a M, y: &'a Vec<usize>, level: u16) -> Self {
NodeVisitor {
@@ -147,7 +147,7 @@ pub(in crate) fn which_max(x: &Vec<usize>) -> usize {
return which;
}
impl<T: FloatExt + Debug> DecisionTreeClassifier<T> {
impl<T: FloatExt> DecisionTreeClassifier<T> {
pub fn fit<M: Matrix<T>>(x: &M, y: &M::RowVector, parameters: DecisionTreeClassifierParameters) -> DecisionTreeClassifier<T> {
let (x_nrows, num_attributes) = x.shape();
+3 -3
View File
@@ -56,7 +56,7 @@ impl<T: FloatExt> Node<T> {
}
}
struct NodeVisitor<'a, T: FloatExt + Debug, M: Matrix<T>> {
struct NodeVisitor<'a, T: FloatExt, M: Matrix<T>> {
x: &'a M,
y: &'a M,
node: usize,
@@ -67,7 +67,7 @@ struct NodeVisitor<'a, T: FloatExt + Debug, M: Matrix<T>> {
level: u16
}
impl<'a, T: FloatExt + Debug, M: Matrix<T>> NodeVisitor<'a, T, M> {
impl<'a, T: FloatExt, M: Matrix<T>> NodeVisitor<'a, T, M> {
fn new(node_id: usize, samples: Vec<usize>, order: &'a Vec<Vec<usize>>, x: &'a M, y: &'a M, level: u16) -> Self {
NodeVisitor {
@@ -84,7 +84,7 @@ impl<'a, T: FloatExt + Debug, M: Matrix<T>> NodeVisitor<'a, T, M> {
}
impl<T: FloatExt + Debug> DecisionTreeRegressor<T> {
impl<T: FloatExt> DecisionTreeRegressor<T> {
pub fn fit<M: Matrix<T>>(x: &M, y: &M::RowVector, parameters: DecisionTreeRegressorParameters) -> DecisionTreeRegressor<T> {
let (x_nrows, num_attributes) = x.shape();