Struct tangram_linear::BinaryClassifier [−][src]
Expand description
This struct describes a linear binary classifier model. You can train one by calling BinaryClassifier::train
.
Fields
bias: f32
This is the bias the model learned.
weights: Array1<f32>
These are the weights the model learned.
means: Vec<f32>
These are the mean values of each feature in the training set. They are used to compute SHAP values.
Implementations
pub fn train(
features: ArrayView2<'_, f32>,
labels: EnumTableColumnView<'_>,
train_options: &TrainOptions,
progress: Progress<'_>
) -> BinaryClassifierTrainOutput
pub fn train(
features: ArrayView2<'_, f32>,
labels: EnumTableColumnView<'_>,
train_options: &TrainOptions,
progress: Progress<'_>
) -> BinaryClassifierTrainOutput
Train a linear binary classifier.
pub fn compute_loss(
probabilities: ArrayView1<'_, f32>,
labels: ArrayView1<'_, Option<NonZeroUsize>>
) -> f32
Write predicted probabilities into probabilities
for the input features
.
pub fn compute_feature_contributions(
&self,
features: ArrayView2<'_, f32>
) -> Vec<ComputeShapValuesForExampleOutput>
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for BinaryClassifier
impl Send for BinaryClassifier
impl Sync for BinaryClassifier
impl Unpin for BinaryClassifier
impl UnwindSafe for BinaryClassifier
Blanket Implementations
Mutably borrows from an owned value. Read more