fix test
This commit is contained in:
@@ -309,6 +309,21 @@ void BINDING_FUNCTION(util::Params& params, util::Timers& timers)
|
||||
{
|
||||
model->Lambda() = lambda;
|
||||
|
||||
// Did we want training accuracy?
|
||||
if (params.Has("print_training_accuracy"))
|
||||
{
|
||||
timers.Start("lr_prediction");
|
||||
arma::Row<size_t> predictions;
|
||||
model->Classify(regressors, predictions);
|
||||
|
||||
const size_t correct = arma::accu(predictions == responses);
|
||||
|
||||
Log::Info << correct << " of " << responses.n_elem << " correct on training"
|
||||
<< " set (" << (double(correct) / double(responses.n_elem) * 100) << ")."
|
||||
<< endl;
|
||||
timers.Stop("lr_prediction");
|
||||
}
|
||||
|
||||
if (optimizerType == "sgd")
|
||||
{
|
||||
ens::SGD<> sgdOpt;
|
||||
@@ -336,21 +351,6 @@ void BINDING_FUNCTION(util::Params& params, util::Timers& timers)
|
||||
timers.Stop("logistic_regression_optimization");
|
||||
}
|
||||
}
|
||||
|
||||
// Did we want training accuracy?
|
||||
if (params.Has("training") && params.Has("print_training_accuracy"))
|
||||
{
|
||||
timers.Start("lr_prediction");
|
||||
arma::Row<size_t> predictions;
|
||||
model->Classify(regressors, predictions);
|
||||
|
||||
const size_t correct = arma::accu(predictions == responses);
|
||||
|
||||
Log::Info << correct << " of " << responses.n_elem << " correct on training"
|
||||
<< " set (" << (double(correct) / double(responses.n_elem) * 100) << ")."
|
||||
<< endl;
|
||||
timers.Stop("lr_prediction");
|
||||
}
|
||||
|
||||
if (params.Has("test"))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user