Skip to content

Commit

Permalink
Improved code
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Sep 22, 2023
1 parent bebf955 commit 5ef4bac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mstl_params.rs
Expand Up @@ -54,7 +54,7 @@ impl MstlParams {
}

if let Some(lambda) = self.lambda {
if lambda < 0.0 || lambda > 1.0 {
if !(0.0..=1.0).contains(&lambda) {
return Err(Error::Parameter("lambda must be between 0 and 1".to_string()));
}
}
Expand Down Expand Up @@ -133,7 +133,7 @@ impl Default for MstlParams {
}

fn box_cox(y: &[f32], lambda: f32) -> Vec<f32> {
if lambda > 0.0 {
if lambda != 0.0 {
y.iter().map(|yi| (yi.powf(lambda) - 1.0) / lambda).collect()
} else {
y.iter().map(|yi| yi.ln()).collect()
Expand Down

0 comments on commit 5ef4bac

Please sign in to comment.