Struct renforce::util::approx::VLinear
[−]
[src]
pub struct VLinear<F: Float + Debug, S: Space> { /* fields omitted */ }
Represents a linear function approximator f(x) = wT g(x) + b where g: S -> Rn maps states to a vector of features Weights updated using squared error cost C = 1/2(wT g(x) + b - y)2
Methods
impl<F: Float + Debug, S: Space> VLinear<F, S>
[src]
fn new() -> VLinear<F, S>
Creates a new Linear V-Function Approximator
fn with_features(feats: Vec<Box<Feature<S, F>>>) -> VLinear<F, S>
Creates a new Linear V-Function Approximator with the given features
fn add_feature(self, feature: Box<Feature<S, F>>) -> VLinear<F, S>
Adds the specified feature to the end of the feature vector, giving it a random weight
Trait Implementations
impl<F: Debug + Float + Debug, S: Debug + Space> Debug for VLinear<F, S>
[src]
impl<F: Clone + Float + Debug, S: Clone + Space> Clone for VLinear<F, S>
[src]
fn clone(&self) -> VLinear<F, S>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<F: Float + Debug, S: Space> VFunction<S> for VLinear<F, S>
[src]
fn eval(&self, state: &S::Element) -> f64
Evaluate the function on the given state
fn update(&mut self, state: &S::Element, new_val: f64, alpha: f64)
Update the function using the given information (alpha is learning rate)
impl<F: Float + Debug, S: Space> ParameterizedFunc<F> for VLinear<F, S>
[src]
fn num_params(&self) -> usize
Returns number of parameters used by the function
fn get_params(&self) -> Vec<F>
Returns the parameters used by the function
fn set_params(&mut self, params: Vec<F>)
Changes the parameters used by the function
impl<S: Space, A: Space, F: Float + Debug> FeatureExtractor<S, A, F> for VLinear<F, S>
[src]
fn num_features(&self) -> usize
Number of features that can be calculated
fn extract(&self, state: &S::Element, _: &A::Element) -> Vec<F>
Vector containg the values of all the features for this state
impl<S: Space, A: Space, F: Float + Debug> DifferentiableFunc<S, A, F> for VLinear<F, S>
[src]
fn get_grad(&self, state: &S::Element, _: &A::Element) -> Vec<F>
Calculates the gradient of the output with respect to this function's parameters
fn calculate(&self, state: &S::Element, _: &A::Element) -> F
Calculates the result of calling function on given input