[][src]Struct lfa::LFA

pub struct LFA<B, W, O = SGD> {
    pub basis: B,
    pub weights: W,
    pub optimiser: O,
}

Linear function approximator.

Fields

basis: B

Basis representation used to generate feature vectors.

weights: W

Weights collection.

optimiser: O

Optimisation routine used during updates.

Implementations

impl<B, W, O> LFA<B, W, O>[src]

pub fn new(basis: B, weights: W, optimiser: O) -> Self[src]

Construct an arbitrary LFA using a given basis representation, initial collection of weights and optimisation routine.

impl<B, O> LFA<B, ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>, O>[src]

pub fn scalar(basis: B, optimiser: O) -> Self where
    B: Space
[src]

Construct an ScalarLFA using a given basis representation and optimisation routine. The weights are initialised with a vector of zeros.

pub fn evaluate<I>(&self, input: I) -> Result<f64> where
    B: Basis<I, Value = Features>, 
[src]

Evaluate the function approximator for a given input.

pub fn update<I>(&mut self, input: I, error: f64) -> Result<()> where
    B: Basis<I, Value = Features>,
    O: Optimiser
[src]

Update the function approximator for a given input and error.

pub fn update_with<I>(
    &mut self,
    input: I,
    f: impl Fn(&Features, f64) -> f64
) -> Result<()> where
    B: Basis<I, Value = Features>,
    O: Optimiser
[src]

Update the function approximator for a given input, deferring the error computation to a closure provided by the user.

impl<B, O> LFA<B, ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, O>[src]

pub fn vector(basis: B, optimiser: O, n_outputs: usize) -> Self where
    B: Space
[src]

Construct an VectorLFA with a chosen number of outputs using a given basis representation and optimisation routine. The weights are initialised with a matrix of zeros.

pub fn n_outputs(&self) -> usize[src]

Return the dimensionality of the output..

pub fn evaluate<I>(&self, input: I) -> Result<Array1<f64>> where
    B: Basis<I, Value = Features>, 
[src]

Evaluate the function approximator for a given input.

pub fn evaluate_index<I>(&self, input: I, index: usize) -> Result<f64> where
    B: Basis<I, Value = Features>, 
[src]

Evaluate the ith output of the function approximator for a given input.

pub fn iter<'a, I>(&'a self, input: I) -> OutputIter<'a> where
    B: Basis<I, Value = Features>, 
[src]

Iterate sequentially over the outputs of the function approximator for a given input.

Panics if the basis computation fails.

pub fn try_iter<'a, I>(&'a self, input: I) -> Result<OutputIter<'a>> where
    B: Basis<I, Value = Features>, 
[src]

Iterate sequentially over the outputs of the function approximator for a given input.

pub fn update<I, E>(&mut self, input: I, errors: E) -> Result<()> where
    B: Basis<I, Value = Features>,
    O: Optimiser,
    E: IntoIterator<Item = f64>, 
[src]

Update the function approximator for a given input and error.

pub fn update_index<I>(
    &mut self,
    input: I,
    index: usize,
    error: f64
) -> Result<()> where
    B: Basis<I, Value = Features>,
    O: Optimiser
[src]

Update the ith output of the function approximator for a given input and error.

pub fn update_with<I>(
    &mut self,
    input: I,
    f: impl Fn(&Features, Array1<f64>) -> Array1<f64>
) -> Result<()> where
    B: Basis<I, Value = Features>,
    O: Optimiser
[src]

Update the function approximator for a given input, deferring the error computation to a closure provided by the user.

Trait Implementations

impl<B: Clone, W: Clone, O: Clone> Clone for LFA<B, W, O>[src]

impl<B: Debug, W: Debug, O: Debug> Debug for LFA<B, W, O>[src]

Auto Trait Implementations

impl<B, W, O> RefUnwindSafe for LFA<B, W, O> where
    B: RefUnwindSafe,
    O: RefUnwindSafe,
    W: RefUnwindSafe

impl<B, W, O> Send for LFA<B, W, O> where
    B: Send,
    O: Send,
    W: Send

impl<B, W, O> Sync for LFA<B, W, O> where
    B: Sync,
    O: Sync,
    W: Sync

impl<B, W, O> Unpin for LFA<B, W, O> where
    B: Unpin,
    O: Unpin,
    W: Unpin

impl<B, W, O> UnwindSafe for LFA<B, W, O> where
    B: UnwindSafe,
    O: UnwindSafe,
    W: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.