Avoid redefinition issue (NoDecay) if we include SGD and SVRG at the same time.

This commit is contained in:
Marcus Edel
2018-02-14 20:39:12 +01:00
parent e9ecbe05e8
commit d35a3cfc41
4 changed files with 20 additions and 60 deletions
@@ -42,6 +42,25 @@ class NoDecay
{
// Nothing to do here.
}
/**
* This function is called in each iteration after the Update step for SVRG.
*
* @param iterate Parameters that minimize the function.
* @param iterate0 The last function parameters at time t - 1.
* @param gradient The current gradient matrix at time t.
* @param fullGradient The computed full gradient.
* @param stepSize Step size to be used for the given iteration.
*/
void Update(const arma::mat& /* iterate */,
const arma::mat& /*iterate0 */,
const arma::mat& /* gradient */,
const arma::mat& /* fullGradient */,
const size_t /* numBatches */,
double& /* stepSize */)
{
// Nothing to do here.
}
};
} // namespace optimization
@@ -1,7 +1,6 @@
set(SOURCES
svrg.hpp
svrg_impl.hpp
no_decay.hpp
barzilai_borwein_decay.hpp
svrg_update.hpp
)
@@ -1,58 +0,0 @@
/**
* @file no_decay.hpp
* @author Marcus Edel
*
* Definition of the policy type for the decay class.
*
* You should define your own decay update that looks like NoDecay.
*
* mlpack is free software; you may redistribute it and/or modify it under the
* terms of the 3-clause BSD license. You should have received a copy of the
* 3-clause BSD license along with mlpack. If not, see
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
*/
#ifndef MLPACK_CORE_OPTIMIZERS_SVRG_NO_DECAY_HPP
#define MLPACK_CORE_OPTIMIZERS_SVRG_NO_DECAY_HPP
#include <mlpack/prereqs.hpp>
namespace mlpack {
namespace optimization {
/**
* Definition of the NoDecay class. Use this as a template for your own.
*/
class NoDecay
{
public:
/**
* This constructor is called before the first iteration.
*/
NoDecay() { }
/**
* Update step for SVRG. The function parameters are updated in the negative
* direction of the gradient.
*
* @param iterate Parameters that minimize the function.
* @param iterate0 The last function parameters at time t - 1.
* @param gradient The current gradient matrix at time t.
* @param fullGradient The computed full gradient.
* @param stepSize Step size to be used for the given iteration.
*/
void Update(const arma::mat& /* iterate */,
const arma::mat& /*iterate0 */,
const arma::mat& /* gradient */,
const arma::mat& /* fullGradient */,
const size_t /* numBatches */,
double& /* stepSize */)
{
// Nothing to do here.
}
};
} // namespace optimization
} // namespace mlpack
#endif // MLPACK_CORE_OPTIMIZERS_SVRG_NO_DECAY_HPP
+1 -1
View File
@@ -13,9 +13,9 @@
#define MLPACK_CORE_OPTIMIZERS_SVRG_SVRG_HPP
#include <mlpack/prereqs.hpp>
#include <mlpack/core/optimizers/sgd/decay_policies/no_decay.hpp>
#include "svrg_update.hpp"
#include "no_decay.hpp"
#include "barzilai_borwein_decay.hpp"
namespace mlpack {