Simple classifier interface for cross-validation.
| 2 | |
| 3 | /// Simple classifier interface for cross-validation. |
| 4 | pub trait SimpleClassifier { |
| 5 | fn fit(&mut self, x: &[Vec<f64>], y: &[f64], sample_weight: Option<&[f64]>); |
| 6 | fn predict_proba(&self, x: &[Vec<f64>]) -> Vec<f64>; |
| 7 | fn predict(&self, x: &[Vec<f64>]) -> Vec<f64> { |
| 8 | self.predict_proba(x).into_iter().map(|p| if p >= 0.5 { 1.0 } else { 0.0 }).collect() |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | #[derive(Clone, Copy)] |
| 13 | pub enum Scoring { |
nothing calls this directly
no outgoing calls
no test coverage detected