Skip to content

Instantly share code, notes, and snippets.

@arunreddy
Created March 2, 2017 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arunreddy/6fc4b10e0f4d20a058f558b116c5b535 to your computer and use it in GitHub Desktop.
Save arunreddy/6fc4b10e0f4d20a058f558b116c5b535 to your computer and use it in GitHub Desktop.
StandardSGD <LogisticRegressionFunction<>> sgdOpt(lrf);
sgdOpt.MaxIterations() = maxIterations;
sgdOpt.Tolerance() = tolerance;
sgdOpt.StepSize() = stepSize;
Log::Info << "Training model with SGD optimizer." << endl;
// This will train the model.
model.Train(sgdOpt);
Error:
------------------------------------------
mlpack/methods/logistic_regression/logistic_regression_main.cpp:248:25:
error: no matching function for call to ‘mlpack::regression::LogisticRegression<>::Train(mlpack::optimization::StandardSGD<mlpack::regression::LogisticRegressionFunction<> >&)’
model.Train(sgdOpt);
mlpack/methods/logistic_regression/logistic_regression.hpp:121:8: note: candidate: template<template<class> class typedef OptimizerType OptimizerType> void mlpack::regression::LogisticRegression<MatType>::Train(const MatType&, const arma::Row<long unsigned int>&) [with OptimizerType = OptimizerType; MatType = arma::Mat<double>]
void Train(const MatType& predictors,
note: template argument deduction/substitution failed:
logistic_regression/logistic_regression_main.cpp:248:25: note: cannot convert ‘sgdOpt’ (type ‘mlpack::optimization::StandardSGD<mlpack::regression::LogisticRegressionFunction<> > {aka mlpack::optimization::SGD<mlpack::regression::LogisticRegressionFunction<>, mlpack::optimization::EmptyUpdate>}’) to type ‘const arma::Mat<double>&’
model.Train(sgdOpt);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment