mlpack
master
|
Implementation of the variance reduced classification reinforcement layer. More...
Public Member Functions | |
VRClassReward (const double scale=1, const bool sizeAverage=true) | |
Create the VRClassReward object. More... | |
template<class LayerType , class... Args> | |
void | Add (Args...args) |
void | Add (LayerTypes layer) |
template<typename eT > | |
void | Backward (const arma::Mat< eT > &&input, const arma::Mat< eT > &&target, arma::Mat< eT > &&output) |
Ordinary feed backward pass of a neural network. More... | |
OutputDataType & | Delta () const |
Get the delta. More... | |
OutputDataType & | Delta () |
Modify the delta. More... | |
bool | Deterministic () const |
Get the value of the deterministic parameter. More... | |
bool & | Deterministic () |
Modify the value of the deterministic parameter. More... | |
template<typename eT > | |
double | Forward (const arma::Mat< eT > &&input, const arma::Mat< eT > &&target) |
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f. More... | |
InputDataType & | InputParameter () const |
Get the input parameter. More... | |
InputDataType & | InputParameter () |
Modify the input parameter. More... | |
OutputDataType & | OutputParameter () const |
Get the output parameter. More... | |
OutputDataType & | OutputParameter () |
Modify the output parameter. More... | |
template<typename Archive > | |
void | Serialize (Archive &, const unsigned int) |
Serialize the layer. More... | |
Private Attributes | |
OutputDataType | delta |
Locally-stored delta object. More... | |
bool | deterministic |
If true dropout and scaling is disabled, see notes above. More... | |
InputDataType | inputParameter |
Locally-stored input parameter object. More... | |
std::vector< LayerTypes > | network |
Locally-stored network modules. More... | |
OutputDataType | outputParameter |
Locally-stored output parameter object. More... | |
double | reward |
Locally stored reward parameter. More... | |
const double | scale |
Locally-stored value to scale the reward. More... | |
const bool | sizeAverage |
If true take the average over all batches. More... | |
Implementation of the variance reduced classification reinforcement layer.
This layer is meant to be used in combination with the reinforce normal layer (ReinforceNormalLayer), which expects that an reward: (1 for success, 0 otherwise).
InputDataType | Type of the input data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
OutputDataType | Type of the output data (arma::colvec, arma::mat, arma::sp_mat or arma::cube). |
Definition at line 54 of file layer_types.hpp.
mlpack::ann::VRClassReward< InputDataType, OutputDataType >::VRClassReward | ( | const double | scale = 1 , |
const bool | sizeAverage = true |
||
) |
Create the VRClassReward object.
scale | Parameter used to scale the reward. |
sizeAverage | Take the average over all batches. |
|
inline |
Definition at line 97 of file vr_class_reward.hpp.
References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::network.
|
inline |
Definition at line 104 of file vr_class_reward.hpp.
References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::network, and mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Serialize().
void mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Backward | ( | const arma::Mat< eT > && | input, |
const arma::Mat< eT > && | target, | ||
arma::Mat< eT > && | output | ||
) |
Ordinary feed backward pass of a neural network.
The negative log likelihood layer expectes that the input contains log-probabilities for each class. The layer also expects a class index, in the range between 1 and the number of classes, as target when calling the Forward function.
input | The propagated input activation. |
target | The target vector, that contains the class index in the range between 1 and the number of classes. |
output | The calculated error. |
|
inline |
Get the delta.
Definition at line 82 of file vr_class_reward.hpp.
References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::delta.
|
inline |
Modify the delta.
Definition at line 84 of file vr_class_reward.hpp.
References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::delta.
|
inline |
Get the value of the deterministic parameter.
Definition at line 87 of file vr_class_reward.hpp.
References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::deterministic.
|
inline |
Modify the value of the deterministic parameter.
Definition at line 89 of file vr_class_reward.hpp.
References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::deterministic.
double mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Forward | ( | const arma::Mat< eT > && | input, |
const arma::Mat< eT > && | target | ||
) |
Ordinary feed forward pass of a neural network, evaluating the function f(x) by propagating the activity forward through f.
input | Input data that contains the log-probabilities for each class. |
target | The target vector, that contains the class index in the range between 1 and the number of classes. |
|
inline |
Get the input parameter.
Definition at line 72 of file vr_class_reward.hpp.
References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::inputParameter.
|
inline |
Modify the input parameter.
Definition at line 74 of file vr_class_reward.hpp.
References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::inputParameter.
|
inline |
Get the output parameter.
Definition at line 77 of file vr_class_reward.hpp.
References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::outputParameter.
|
inline |
Modify the output parameter.
Definition at line 79 of file vr_class_reward.hpp.
References mlpack::ann::VRClassReward< InputDataType, OutputDataType >::outputParameter.
void mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Serialize | ( | Archive & | , |
const unsigned | int | ||
) |
Serialize the layer.
Referenced by mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Add().
|
private |
Locally-stored delta object.
Definition at line 123 of file vr_class_reward.hpp.
Referenced by mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Delta().
|
private |
If true dropout and scaling is disabled, see notes above.
Definition at line 132 of file vr_class_reward.hpp.
Referenced by mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Deterministic().
|
private |
Locally-stored input parameter object.
Definition at line 126 of file vr_class_reward.hpp.
Referenced by mlpack::ann::VRClassReward< InputDataType, OutputDataType >::InputParameter().
|
private |
Locally-stored network modules.
Definition at line 135 of file vr_class_reward.hpp.
Referenced by mlpack::ann::VRClassReward< InputDataType, OutputDataType >::Add().
|
private |
Locally-stored output parameter object.
Definition at line 129 of file vr_class_reward.hpp.
Referenced by mlpack::ann::VRClassReward< InputDataType, OutputDataType >::OutputParameter().
|
private |
Locally stored reward parameter.
Definition at line 120 of file vr_class_reward.hpp.
|
private |
Locally-stored value to scale the reward.
Definition at line 114 of file vr_class_reward.hpp.
|
private |
If true take the average over all batches.
Definition at line 117 of file vr_class_reward.hpp.