pub trait Classifier: Send + Sync {
// Required methods
fn fit(
&mut self,
x: ArrayView2<'_, f64>,
y: ArrayView1<'_, f64>,
) -> Result<()>;
fn predict_proba(&self, x: ArrayView2<'_, f64>) -> Result<Array1<f64>>;
fn fresh(&self) -> Box<dyn Classifier>;
// Provided method
fn fit_weighted(
&mut self,
_x: ArrayView2<'_, f64>,
_y: ArrayView1<'_, f64>,
_w: ArrayView1<'_, f64>,
) -> Result<()> { ... }
}Expand description
A classification learner returning P(label = 1 | X), used for
propensity scores in models with a binary treatment such as Irm.
Required Methods§
fn fit(&mut self, x: ArrayView2<'_, f64>, y: ArrayView1<'_, f64>) -> Result<()>
fn predict_proba(&self, x: ArrayView2<'_, f64>) -> Result<Array1<f64>>
fn fresh(&self) -> Box<dyn Classifier>
Provided Methods§
Sourcefn fit_weighted(
&mut self,
_x: ArrayView2<'_, f64>,
_y: ArrayView1<'_, f64>,
_w: ArrayView1<'_, f64>,
) -> Result<()>
fn fit_weighted( &mut self, _x: ArrayView2<'_, f64>, _y: ArrayView1<'_, f64>, _w: ArrayView1<'_, f64>, ) -> Result<()>
Fit minimising a w-weighted loss (needed by Lplr’s
instrument score). The default reports that weights are unsupported.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".