34 #ifndef SHARK_ML_OPTIMIZER_ADAM_H 35 #define SHARK_ML_OPTIMIZER_ADAM_H 66 m_avgGrad = blas::repeat(0.0,startingPoint.size());
67 m_secondMoment = blas::repeat(0.0,startingPoint.size());
130 noalias(m_avgGrad) = m_beta1 * m_avgGrad + (1-m_beta1) * m_derivative;
131 noalias(m_secondMoment) = m_beta2 * m_secondMoment + (1-m_beta2)*
sqr(m_derivative);
134 double bias1 = 1-std::pow(m_beta1,m_counter);
135 double bias2 = 1-std::pow(m_beta2,m_counter);
139 noalias(
m_best.
point) -= (m_eta/bias1) * m_avgGrad/(m_epsilon + sqrt(m_secondMoment/bias2));
145 archive>>m_secondMoment;
147 archive>>m_derivative;
159 archive<<m_secondMoment;
161 archive<<m_derivative;
171 RealVector m_avgGrad;
172 RealVector m_secondMoment;
173 unsigned int m_counter;