本文整理汇总了C++中OptimizerType类的典型用法代码示例。如果您正苦于以下问题:C++ OptimizerType类的具体用法?C++ OptimizerType怎么用?C++ OptimizerType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OptimizerType类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parameters
LogisticRegression<MatType>::LogisticRegression(
OptimizerType<LogisticRegressionFunction<MatType>>& optimizer) :
parameters(optimizer.Function().GetInitialPoint()),
lambda(optimizer.Function().Lambda())
{
Train(optimizer);
}
示例2: parameters
SoftmaxRegression<OptimizerType>::SoftmaxRegression(
OptimizerType<SoftmaxRegressionFunction>& optimizer) :
parameters(optimizer.Function().GetInitialPoint()),
numClasses(optimizer.Function().NumClasses()),
lambda(optimizer.Function().Lambda()),
fitIntercept(optimizer.Function().FitIntercept())
{
Train(optimizer);
}
示例3: parameters
LogisticRegression<OptimizerType>::LogisticRegression(
OptimizerType<LogisticRegressionFunction>& optimizer) :
parameters(optimizer.Function().GetInitialPoint()),
lambda(optimizer.Function().Lambda())
{
Timer::Start("logistic_regression_optimization");
const double out = optimizer.Optimize(parameters);
Timer::Stop("logistic_regression_optimization");
Log::Info << "LogisticRegression::LogisticRegression(): final objective of "
<< "trained model is " << out << "." << std::endl;
}
示例4:
void LogisticRegression<MatType>::Train(
OptimizerType<LogisticRegressionFunction<MatType>>& optimizer)
{
// Everything is good. Just train the model.
parameters = optimizer.Function().GetInitialPoint();
Timer::Start("logistic_regression_optimization");
const double out = optimizer.Optimize(parameters);
Timer::Stop("logistic_regression_optimization");
Log::Info << "LogisticRegression::LogisticRegression(): final objective of "
<< "trained model is " << out << "." << std::endl;
}
示例5: network
FFN<LayerTypes, OutputLayerType, InitializationRuleType, PerformanceFunction
>::FFN(LayerType &&network,
OutputType &&outputLayer,
const arma::mat& predictors,
const arma::mat& responses,
OptimizerType<NetworkType>& optimizer,
InitializationRuleType initializeRule,
PerformanceFunction performanceFunction) :
network(std::forward<LayerType>(network)),
outputLayer(std::forward<OutputType>(outputLayer)),
performanceFunc(std::move(performanceFunction)),
predictors(predictors),
responses(responses),
numFunctions(predictors.n_cols)
{
static_assert(std::is_same<typename std::decay<LayerType>::type,
LayerTypes>::value,
"The type of network must be LayerTypes.");
static_assert(std::is_same<typename std::decay<OutputType>::type,
OutputLayerType>::value,
"The type of outputLayer must be OutputLayerType.");
initializeRule.Initialize(parameter, NetworkSize(this->network), 1);
NetworkWeights(parameter, this->network);
// Train the model.
Timer::Start("ffn_optimization");
const double out = optimizer.Optimize(parameter);
Timer::Stop("ffn_optimization");
Log::Info << "FFN::FFN(): final objective of trained model is " << out
<< "." << std::endl;
}
示例6:
void FFN<
LayerTypes, OutputLayerType, InitializationRuleType, PerformanceFunction
>::Train(OptimizerType<NetworkType>& optimizer)
{
// Train the model.
Timer::Start("ffn_optimization");
const double out = optimizer.Optimize(parameter);
Timer::Stop("ffn_optimization");
Log::Info << "FFN::FFN(): final objective of trained model is " << out
<< "." << std::endl;
}
示例7:
double SoftmaxRegression<OptimizerType>::Train(
OptimizerType<SoftmaxRegressionFunction>& optimizer)
{
// Train the model.
Timer::Start("softmax_regression_optimization");
const double out = optimizer.Optimize(parameters);
Timer::Stop("softmax_regression_optimization");
Log::Info << "SoftmaxRegression::SoftmaxRegression(): final objective of "
<< "trained model is " << out << "." << std::endl;
return out;
}
示例8: errorFunction
void LogisticRegression<MatType>::Train(
const MatType& predictors,
const arma::Row<size_t>& responses,
OptimizerType& optimizer)
{
LogisticRegressionFunction<MatType> errorFunction(predictors,
responses,
lambda);
errorFunction.InitialPoint() = parameters;
Timer::Start("logistic_regression_optimization");
const double out = optimizer.Optimize(errorFunction, parameters);
Timer::Stop("logistic_regression_optimization");
Log::Info << "LogisticRegression::LogisticRegression(): final objective of "
<< "trained model is " << out << "." << std::endl;
}
示例9: parameters
SparseAutoencoder<OptimizerType>::SparseAutoencoder(
OptimizerType<SparseAutoencoderFunction> &optimizer) :
parameters(optimizer.Function().GetInitialPoint()),
visibleSize(optimizer.Function().VisibleSize()),
hiddenSize(optimizer.Function().HiddenSize()),
lambda(optimizer.Function().Lambda()),
beta(optimizer.Function().Beta()),
rho(optimizer.Function().Rho())
{
Timer::Start("sparse_autoencoder_optimization");
const double out = optimizer.Optimize(parameters);
Timer::Stop("sparse_autoencoder_optimization");
Log::Info << "SparseAutoencoder::SparseAutoencoder(): final objective of "
<< "trained model is " << out << "." << std::endl;
}