Skip to content

Commit

Permalink
Improved code
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Sep 18, 2023
1 parent d0b4015 commit 21758bb
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ pub struct AnomalyDetectionParams {
}

pub fn params() -> AnomalyDetectionParams {
AnomalyDetectionParams {
alpha: 0.05,
max_anoms: 0.1,
direction: Direction::Both,
verbose: false
}
AnomalyDetectionParams::new()
}

#[derive(Debug)]
Expand All @@ -37,6 +32,15 @@ impl AnomalyDetectionResult {
}

impl AnomalyDetectionParams {
pub fn new() -> Self {
Self {
alpha: 0.05,
max_anoms: 0.1,
direction: Direction::Both,
verbose: false
}
}

pub fn alpha(&mut self, value: f32) -> &mut Self {
self.alpha = value;
self
Expand Down Expand Up @@ -69,3 +73,9 @@ impl AnomalyDetectionParams {
})
}
}

impl Default for AnomalyDetectionParams {
fn default() -> Self {
Self::new()
}
}

0 comments on commit 21758bb

Please sign in to comment.