本文整理汇总了C++中Net::currentParameters方法的典型用法代码示例。如果您正苦于以下问题:C++ Net::currentParameters方法的具体用法?C++ Net::currentParameters怎么用?C++ Net::currentParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Net
的用法示例。
在下文中一共展示了Net::currentParameters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: agent_end
int agent_end(double reward)
{
episodeReturn += reward;
logger << "agend end, return = " << episodeReturn << "\n";
if(episodeReturn > bestReturn)
{
bestReturn = episodeReturn;
bestParameters = net.currentParameters();
}
RandomNumberGenerator rng;
opt.setError(-episodeReturn + 0.1 * episodeReturn * rng.sampleNormalDistribution<double>());
if(opt.terminated())
opt.restart();
return 0;
}
示例2: agent_init
int agent_init(int num_state_variables, int num_action_variables, int argc, const char* agent_param[])
{
num_states = num_state_variables;
num_actions = num_action_variables;
parameters = 0;
hiddenUnits = 10;
if(argc > 0)
parameters = atoi(agent_param[0]);
if(argc > 1)
hiddenUnits = atoi(agent_param[1]);
net.inputLayer(num_states);
if(parameters > 0)
{
net.compressedLayer(hiddenUnits, parameters, TANH, "dct");
net.compressedOutputLayer(num_actions, hiddenUnits + 1, LOGISTIC, "dct");
}
else
{
net.fullyConnectedLayer(hiddenUnits, TANH);
net.outputLayer(num_actions, LOGISTIC);
}
bestParameters = net.currentParameters();
bestReturn = -std::numeric_limits<double>::max();
StoppingCriteria stop;
stop.maximalFunctionEvaluations = 5000;
stop.maximalRestarts = 1000;
opt.setOptimizable(net);
opt.setStopCriteria(stop);
opt.restart();
logger << net.dimension() << " parameters, " << num_states
<< " state components, " << num_actions << " action components\n";
return 0;
}