Skip to content

Commit

Permalink
Add method for prediction error
Browse files Browse the repository at this point in the history
  • Loading branch information
mhovd committed Jun 23, 2024
1 parent 077ede8 commit 819ce74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub mod prelude {
pub mod simulator {
pub use crate::simulator::{
get_population_predictions,
likelihood::{PopulationPredictions, SubjectPredictions, Prediction},
likelihood::{PopulationPredictions, Prediction, SubjectPredictions},
Equation,
};
}
Expand Down
3 changes: 3 additions & 0 deletions src/simulator/likelihood.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ impl Prediction {
pub fn errorpoly(&self) -> Option<(f64, f64, f64, f64)> {
self.errorpoly
}
pub fn prediction_error(&self) -> f64 {
self.prediction - self.observation
}
pub fn percentage_error(&self) -> f64 {
((self.prediction - self.observation) / self.observation) * 100.0
}
Expand Down

0 comments on commit 819ce74

Please sign in to comment.