pub struct AutoregressiveModel { /* private fields */ }Expand description
Autoregressive neural network for semi-supervised learning
This implements an autoregressive model that learns to generate sequences by predicting the next element given previous elements. For semi-supervised learning, it combines generative modeling with discriminative classification.
Implementations§
Source§impl AutoregressiveModel
impl AutoregressiveModel
Set the hidden layer dimensions
Sourcepub fn sequence_length(self, length: usize) -> Self
pub fn sequence_length(self, length: usize) -> Self
Set the sequence length
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 temperature(self, temp: f64) -> Self
pub fn temperature(self, temp: f64) -> Self
Set the temperature for sampling
Sourcepub fn classification_weight(self, weight: f64) -> Self
pub fn classification_weight(self, weight: f64) -> Self
Set the classification weight
Sourcepub fn generate_sequence(
&self,
initial_context: &ArrayView1<'_, f64>,
length: usize,
) -> Result<Array1<f64>, SklearsError>
pub fn generate_sequence( &self, initial_context: &ArrayView1<'_, f64>, length: usize, ) -> Result<Array1<f64>, SklearsError>
Generate a sequence using the autoregressive model
Sourcepub fn log_likelihood(
&self,
sequence: &ArrayView1<'_, f64>,
) -> Result<f64, SklearsError>
pub fn log_likelihood( &self, sequence: &ArrayView1<'_, f64>, ) -> Result<f64, SklearsError>
Compute log-likelihood of a sequence
Trait Implementations§
Source§impl Clone for AutoregressiveModel
impl Clone for AutoregressiveModel
Source§fn clone(&self) -> AutoregressiveModel
fn clone(&self) -> AutoregressiveModel
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 AutoregressiveModel
impl Debug for AutoregressiveModel
Source§impl Default for AutoregressiveModel
impl Default for AutoregressiveModel
Source§impl Fit<ArrayBase<ViewRepr<&f64>, Dim<[usize; 2]>>, ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>> for AutoregressiveModel
impl Fit<ArrayBase<ViewRepr<&f64>, Dim<[usize; 2]>>, ArrayBase<ViewRepr<&i32>, Dim<[usize; 1]>>> for AutoregressiveModel
Source§type Fitted = AutoregressiveModel
type Fitted = AutoregressiveModel
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 AutoregressiveModel
impl Predict<ArrayBase<ViewRepr<&f64>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<i32>, Dim<[usize; 1]>>> for AutoregressiveModel
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 AutoregressiveModel
impl PredictProba<ArrayBase<ViewRepr<&f64>, Dim<[usize; 2]>>, ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>> for AutoregressiveModel
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 AutoregressiveModel
impl RefUnwindSafe for AutoregressiveModel
impl Send for AutoregressiveModel
impl Sync for AutoregressiveModel
impl Unpin for AutoregressiveModel
impl UnwindSafe for AutoregressiveModel
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