MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MyCaffe.trainers.pg.simple.TrainerPG< T > Class Template Reference

The TrainerPG implements a simple Policy Gradient trainer inspired by Andrej Karpathy's blog posed referenced. More...

Inheritance diagram for MyCaffe.trainers.pg.simple.TrainerPG< T >:
MyCaffe.trainers.IxTrainerRL MyCaffe.trainers.IxTrainer

Public Member Functions

 TrainerPG (MyCaffeControl< T > mycaffe, PropertySet properties, CryptoRandom random, IxTrainerCallback icallback)
 The constructor. More...
 
void Dispose ()
 Releases all resources used. More...
 
bool Initialize ()
 Initialize the trainer. More...
 
bool Shutdown (int nWait)
 Shutdown the trainer. More...
 
ResultCollection RunOne (int nDelay=1000)
 Run a single cycle on the environment after the delay. More...
 
byte[] Run (int nN, PropertySet runProp, out string type)
 Run a set of iterations and return the resuts. More...
 
bool Test (int nN, ITERATOR_TYPE type)
 Run the test cycle - currently this is not implemented. More...
 
bool Train (int nN, ITERATOR_TYPE type, TRAIN_STEP step)
 Train the network using a modified PG training algorithm optimized for GPU use. More...
 

Detailed Description

The TrainerPG implements a simple Policy Gradient trainer inspired by Andrej Karpathy's blog posed referenced.

See also
1. Deep Reinforcement Learning: Pong from Pixels, by Andrej Karpathy, 2016, Github.io
2. GitHub: karpathy/pg-pong.py, by Andrej Karpathy, 2016, Github
3. CS231n Convolution Neural Networks for Visual Recognition by Karpathy, Stanford
4. MyCaffe: A Complete C# Re-Write of Caffe with Reinforcement Learning by D. Brown, 2018, arXiv

Definition at line 25 of file TrainerPG.cs.

Constructor & Destructor Documentation

◆ TrainerPG()

MyCaffe.trainers.pg.simple.TrainerPG< T >.TrainerPG ( MyCaffeControl< T >  mycaffe,
PropertySet  properties,
CryptoRandom  random,
IxTrainerCallback  icallback 
)

The constructor.

Parameters
mycaffeSpecifies the MyCaffeControl to use for learning and prediction.
propertiesSpecifies the property set containing the key/value pairs of property settings.
randomSpecifies a Random number generator used for random selection.
icallbackSpecifies the callback for parent notifications and queries.

Definition at line 39 of file TrainerPG.cs.

Member Function Documentation

◆ Dispose()

void MyCaffe.trainers.pg.simple.TrainerPG< T >.Dispose ( )

Releases all resources used.

Definition at line 50 of file TrainerPG.cs.

◆ Initialize()

bool MyCaffe.trainers.pg.simple.TrainerPG< T >.Initialize ( )

Initialize the trainer.

Returns
Returns true.

Implements MyCaffe.trainers.IxTrainer.

Definition at line 58 of file TrainerPG.cs.

◆ Run()

byte[] MyCaffe.trainers.pg.simple.TrainerPG< T >.Run ( int  nN,
PropertySet  runProp,
out string  type 
)

Run a set of iterations and return the resuts.

Parameters
nNSpecifies the number of samples to run.
runPropOptionally specifies properties to use when running.
typeReturns the data type contained in the byte stream.
Returns
The results of the run containing the action are returned as a byte stream.

Implements MyCaffe.trainers.IxTrainerRL.

Definition at line 116 of file TrainerPG.cs.

◆ RunOne()

ResultCollection MyCaffe.trainers.pg.simple.TrainerPG< T >.RunOne ( int  nDelay = 1000)

Run a single cycle on the environment after the delay.

Parameters
nDelaySpecifies a delay to wait before running.
Returns
The results of the run containing the action are returned.

Implements MyCaffe.trainers.IxTrainerRL.

Definition at line 100 of file TrainerPG.cs.

◆ Shutdown()

bool MyCaffe.trainers.pg.simple.TrainerPG< T >.Shutdown ( int  nWait)

Shutdown the trainer.

Parameters
nWaitSpecifies a wait in ms. for the shutdown to complete.
Returns
Returns true.

Implements MyCaffe.trainers.IxTrainer.

Definition at line 82 of file TrainerPG.cs.

◆ Test()

bool MyCaffe.trainers.pg.simple.TrainerPG< T >.Test ( int  nN,
ITERATOR_TYPE  type 
)

Run the test cycle - currently this is not implemented.

Parameters
nNSpecifies the number of iterations (based on the ITERATION_TYPE) to run, or -1 to ignore.
typeSpecifies the iteration type (default = ITERATION).
Returns
A value of true is returned when handled, false otherwise.

Implements MyCaffe.trainers.IxTrainer.

Definition at line 132 of file TrainerPG.cs.

◆ Train()

bool MyCaffe.trainers.pg.simple.TrainerPG< T >.Train ( int  nN,
ITERATOR_TYPE  type,
TRAIN_STEP  step 
)

Train the network using a modified PG training algorithm optimized for GPU use.

Parameters
nNSpecifies the number of iterations (based on the ITERATION_TYPE) to run, or -1 to ignore.
typeSpecifies the iteration type (default = ITERATION).
stepSpecifies the stepping mode to use (when debugging).
Returns
A value of true is returned when handled, false otherwise.

Implements MyCaffe.trainers.IxTrainer.

Definition at line 158 of file TrainerPG.cs.


The documentation for this class was generated from the following file: