pub struct ActorNetwork {
pub hidden_weights: Array2<f64>,
pub hidden_bias: Array1<f64>,
pub output_weights: Array2<f64>,
pub output_bias: Array1<f64>,
pub _input_size: usize,
pub hidden_size: usize,
pub output_size: usize,
pub activation: ActivationType,
}
Expand description
Actor network for policy learning
Fields§
Hidden layer weights
Hidden layer biases
output_weights: Array2<f64>
Output layer weights
output_bias: Array1<f64>
Output layer biases
_input_size: usize
Network architecture
output_size: usize
§activation: ActivationType
Activation function type
Implementations§
Source§impl ActorNetwork
impl ActorNetwork
Sourcepub fn new(
input_size: usize,
hidden_size: usize,
output_size: usize,
activation: ActivationType,
) -> Self
pub fn new( input_size: usize, hidden_size: usize, output_size: usize, activation: ActivationType, ) -> Self
Create new actor network
Sourcepub fn forward(
&self,
input: &ArrayView1<'_, f64>,
) -> (Array1<f64>, Array1<f64>, Array1<f64>)
pub fn forward( &self, input: &ArrayView1<'_, f64>, ) -> (Array1<f64>, Array1<f64>, Array1<f64>)
Forward pass through actor network
Sourcepub fn action_probabilities(
&self,
policy_output: &ArrayView1<'_, f64>,
temperature: f64,
) -> Array1<f64>
pub fn action_probabilities( &self, policy_output: &ArrayView1<'_, f64>, temperature: f64, ) -> Array1<f64>
Compute action probabilities with temperature scaling
Sourcepub fn backward_and_update(
&mut self,
input: &ArrayView1<'_, f64>,
hidden_raw: &Array1<f64>,
hidden_activated: &Array1<f64>,
output_gradient: &ArrayView1<'_, f64>,
learning_rate: f64,
)
pub fn backward_and_update( &mut self, input: &ArrayView1<'_, f64>, hidden_raw: &Array1<f64>, hidden_activated: &Array1<f64>, output_gradient: &ArrayView1<'_, f64>, learning_rate: f64, )
Backward pass and update weights
Trait Implementations§
Source§impl Clone for ActorNetwork
impl Clone for ActorNetwork
Source§fn clone(&self) -> ActorNetwork
fn clone(&self) -> ActorNetwork
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 moreAuto Trait Implementations§
impl Freeze for ActorNetwork
impl RefUnwindSafe for ActorNetwork
impl Send for ActorNetwork
impl Sync for ActorNetwork
impl Unpin for ActorNetwork
impl UnwindSafe for ActorNetwork
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
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.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.