diff --git a/Cargo.toml b/Cargo.toml index a19222a..3d5ccaa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forust-ml" -version = "0.2.25" +version = "0.2.26" edition = "2021" authors = ["James Inlow "] homepage = "https://github.com/jinlow/forust" diff --git a/README.md b/README.md index a9d17b1..6f717a8 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ pip install forust To use in a rust project add the following to your Cargo.toml file. ```toml -forust-ml = "0.2.25" +forust-ml = "0.2.26" ``` ## Usage diff --git a/py-forust/Cargo.toml b/py-forust/Cargo.toml index 4267dc0..da31aac 100644 --- a/py-forust/Cargo.toml +++ b/py-forust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "py-forust" -version = "0.2.25" +version = "0.2.26" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -10,7 +10,7 @@ crate-type = ["cdylib"] [dependencies] pyo3 = { version = "0.19.0", features = ["extension-module"] } -forust-ml = { version = "0.2.25", path = "../" } +forust-ml = { version = "0.2.26", path = "../" } numpy = "0.19.0" ndarray = "0.15.1" serde_plain = { version = "1.0" } diff --git a/rs-example.md b/rs-example.md index a5e5f48..9216f22 100644 --- a/rs-example.md +++ b/rs-example.md @@ -3,7 +3,7 @@ To run this example, add the following code to your `Cargo.toml` file. ```toml [dependencies] -forust-ml = "0.2.25" +forust-ml = "0.2.26" polars = "0.28" reqwest = { version = "0.11", features = ["blocking"] } ``` diff --git a/src/splitter.rs b/src/splitter.rs index 646fce9..dff58b9 100644 --- a/src/splitter.rs +++ b/src/splitter.rs @@ -396,14 +396,22 @@ impl Splitter for MissingBranchSplitter { (right_weight * right_hessian + left_weight * left_hessian) / (right_hessian + left_hessian) } - MissingNodeTreatment::None => constrained_weight( - &self.get_l2(), - missing_gradient, - missing_hessian, - lower_bound, - upper_bound, - constraint, - ), + MissingNodeTreatment::None => { + // If there are no missing records, just default + // to the parent weight. + if missing_hessian == 0. || missing_gradient == 0. { + parent_weight + } else { + constrained_weight( + &self.get_l2(), + missing_gradient, + missing_hessian, + lower_bound, + upper_bound, + constraint, + ) + } + } }; let missing_gain = gain_given_weight( &self.get_l2(),