pub struct NeuralController {
pub weights: Vec<Vec<Vec<f64>>>,
pub biases: Vec<Vec<f64>>,
pub lr: f64,
pub replay: ReplayBuffer,
}Expand description
Simple multi-layer perceptron (MLP) neural network controller.
Fields§
§weights: Vec<Vec<Vec<f64>>>Layer weights: each element is a weight matrix (out×in).
biases: Vec<Vec<f64>>Layer biases: each element is a bias vector.
lr: f64Learning rate.
replay: ReplayBufferReplay buffer.
Implementations§
Source§impl NeuralController
impl NeuralController
Sourcepub fn new(layer_sizes: &[usize], lr: f64) -> Self
pub fn new(layer_sizes: &[usize], lr: f64) -> Self
Create an MLP controller with given layer sizes.
layer_sizes includes input and output dimensions.
Sourcepub fn forward(&self, input: &[f64]) -> (Vec<f64>, Vec<Vec<f64>>)
pub fn forward(&self, input: &[f64]) -> (Vec<f64>, Vec<Vec<f64>>)
Forward pass: returns output and all layer activations (for backprop).
Sourcepub fn gradient_update(&mut self, input: &[f64], target: &[f64])
pub fn gradient_update(&mut self, input: &[f64], target: &[f64])
Gradient update step (simple policy gradient / supervised).
target is the desired output, input is the current state.
Trait Implementations§
Source§impl Clone for NeuralController
impl Clone for NeuralController
Source§fn clone(&self) -> NeuralController
fn clone(&self) -> NeuralController
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NeuralController
impl RefUnwindSafe for NeuralController
impl Send for NeuralController
impl Sync for NeuralController
impl Unpin for NeuralController
impl UnsafeUnpin for NeuralController
impl UnwindSafe for NeuralController
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.