<commit_before>#pragma once

#include <cmath>
#include <cassert>
#include "scalar.h"

namespace nano
{
        ///
        /// \brief learning rate as an exponential decay function of:
        ///     - alpha0        - the initial learning rate
        ///     - decay         - the decay rate factor
        ///     - iter          - current iteration
        ///
        /// learning rate = alpha0 * (1 + iteration)^decay
        ///
        struct lrate_t
        {
                ///
                /// \brief constructor
                ///
                lrate_t(const scalar_t alpha0, const scalar_t decay) :
                        m_alpha0(alpha0),
                        m_decay(decay),
                        m_iteration(0)
                {
                        assert(decay > scalar_t(0.5));
                        assert(decay <= scalar_t(1));
                        assert(alpha0 > scalar_t(0));
                }

                ///
                /// \brief update the current learning rate for the given iteration
                ///
                scalar_t get()
                {
                        return m_alpha0 / std::pow(static_cast<scalar_t>(++ m_iteration), m_decay);
                }

                // attributes
                scalar_t        m_alpha0;
                scalar_t        m_decay;
		size_t		m_iteration;
        };

}

<commit_msg>add reference for the learning rate schedule<commit_after>#pragma once

#include <cmath>
#include <cassert>
#include "scalar.h"

namespace nano
{
        ///
        /// \brief learning rate as an exponential decay function of:
        ///     - alpha0        - the initial learning rate
        ///     - decay         - the decay rate factor
        ///     - iter          - current iteration
        ///
        /// learning rate = alpha0 * (1 + iteration)^decay
        ///
        /// see "Online Learning and Stochastic Approximations", by <NAME>
        ///
        struct lrate_t
        {
                ///
                /// \brief constructor
                ///
                lrate_t(const scalar_t alpha0, const scalar_t decay) :
                        m_alpha0(alpha0),
                        m_decay(decay),
                        m_iteration(0)
                {
                        assert(decay > scalar_t(0.5));
                        assert(decay <= scalar_t(1));
                        assert(alpha0 > scalar_t(0));
                }

                ///
                /// \brief update the current learning rate for the given iteration
                ///
                scalar_t get()
                {
                        return m_alpha0 / std::pow(static_cast<scalar_t>(++ m_iteration), m_decay);
                }

                // attributes
                scalar_t        m_alpha0;
                scalar_t        m_decay;
		size_t		m_iteration;
        };

}


{'fraction_non_alphanumeric': 0.0952544704264099, 'fraction_numerical': 0.009628610729023384, 'mean_word_length': 0.945819397993311, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5855391', 'n_tokens_mistral': 770, 'n_tokens_neox': 712, 'n_words': 174}