pub struct EnergyBasedModel { /* private fields */ }Expand description
Energy-based model for semi-supervised learning
This implements an energy-based model that learns to assign low energy to data samples and high energy to unlikely samples. The model combines energy minimization with classification for semi-supervised learning.
Implementations§
Source§impl EnergyBasedModel
impl EnergyBasedModel
Set the hidden layer dimensions
Sourcepub fn learning_rate(self, lr: f64) -> Self
pub fn learning_rate(self, lr: f64) -> Self
Set the learning rate
Sourcepub fn regularization(self, reg: f64) -> Self
pub fn regularization(self, reg: f64) -> Self
Set the regularization parameter
Sourcepub fn n_negative_samples(self, n_samples: usize) -> Self
pub fn n_negative_samples(self, n_samples: usize) -> Self
Set the number of negative samples
Sourcepub fn temperature(self, temp: f64) -> Self
pub fn temperature(self, temp: f64) -> Self
Set the temperature parameter
Sourcepub fn classification_weight(self, weight: f64) -> Self
pub fn classification_weight(self, weight: f64) -> Self
Set the classification weight
Sourcepub fn energy_to_probability(&self, energy: f64) -> f64
pub fn energy_to_probability(&self, energy: f64) -> f64
Compute Boltzmann probability from energy
Sourcepub fn langevin_sample(
&self,
initial_sample: &ArrayView1<'_, f64>,
n_steps: usize,
step_size: f64,
) -> Result<Array1<f64>, SklearsError>
pub fn langevin_sample( &self, initial_sample: &ArrayView1<'_, f64>, n_steps: usize, step_size: f64, ) -> Result<Array1<f64>, SklearsError>
Sample from the model using Langevin dynamics
Sourcepub fn log_partition_function(
&self,
n_samples: usize,
) -> Result<f64, SklearsError>
pub fn log_partition_function( &self, n_samples: usize, ) -> Result<f64, SklearsError>
Compute the partition function approximation
Trait Implementations§
Source§impl Clone for EnergyBasedModel
impl Clone for EnergyBasedModel
Source§fn clone(&self) -> EnergyBasedModel
fn clone(&self) -> EnergyBasedModel
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EnergyBasedModel
impl Debug for EnergyBasedModel
Source§impl Default for EnergyBasedModel
impl Default for EnergyBasedModel
Source§impl Fit<ArrayBase<ViewRepr<&f64>, Dim<[usize; 2]>>, ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>> for EnergyBasedModel
impl Fit<ArrayBase<ViewRepr<&f64>, Dim<[usize; 2]>>, ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>> for EnergyBasedModel
Source§type Fitted = EnergyBasedModel
type Fitted = EnergyBasedModel
The fitted model type
Source§fn fit(
self,
X: &ArrayView2<'_, f64>,
y: &ArrayView1<'_, i32>,
) -> Result<Self::Fitted, SklearsError>
fn fit( self, X: &ArrayView2<'_, f64>, y: &ArrayView1<'_, i32>, ) -> Result<Self::Fitted, SklearsError>
Fit the model to the provided data with validation
Source§fn fit_with_validation(
self,
x: &X,
y: &Y,
_x_val: Option<&X>,
_y_val: Option<&Y>,
) -> Result<(Self::Fitted, FitMetrics), SklearsError>where
Self: Sized,
fn fit_with_validation(
self,
x: &X,
y: &Y,
_x_val: Option<&X>,
_y_val: Option<&Y>,
) -> Result<(Self::Fitted, FitMetrics), SklearsError>where
Self: Sized,
Fit with custom validation and early stopping
Source§impl Predict<ArrayBase<ViewRepr<&f64>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<i32>, Dim<[usize; 1]>>> for EnergyBasedModel
impl Predict<ArrayBase<ViewRepr<&f64>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<i32>, Dim<[usize; 1]>>> for EnergyBasedModel
Source§fn predict(&self, X: &ArrayView2<'_, f64>) -> Result<Array1<i32>, SklearsError>
fn predict(&self, X: &ArrayView2<'_, f64>) -> Result<Array1<i32>, SklearsError>
Make predictions on the provided data
Source§fn predict_with_uncertainty(
&self,
x: &X,
) -> Result<(Output, UncertaintyMeasure), SklearsError>
fn predict_with_uncertainty( &self, x: &X, ) -> Result<(Output, UncertaintyMeasure), SklearsError>
Make predictions with confidence intervals
Source§impl PredictProba<ArrayBase<ViewRepr<&f64>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>> for EnergyBasedModel
impl PredictProba<ArrayBase<ViewRepr<&f64>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>> for EnergyBasedModel
Source§fn predict_proba(
&self,
X: &ArrayView2<'_, f64>,
) -> Result<Array2<f64>, SklearsError>
fn predict_proba( &self, X: &ArrayView2<'_, f64>, ) -> Result<Array2<f64>, SklearsError>
Predict class probabilities
Auto Trait Implementations§
impl Freeze for EnergyBasedModel
impl RefUnwindSafe for EnergyBasedModel
impl Send for EnergyBasedModel
impl Sync for EnergyBasedModel
impl Unpin for EnergyBasedModel
impl UnwindSafe for EnergyBasedModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more