API Reference‎ > ‎


class mlp_nn_trainer_t : 
    public nn_trainer_t<
          mlp_neural_net_t::rvector_t >;

    This trainer class is a specialization of generic nn_trainer_t for mlp_neural_net_t



  • nu


  • mlp_nn_trainer_t(mlp_neural_net_t & nn, size_t epochs, double min_errnoexcept;

    Creates an MLP neural network trainer

    • nn: a reference to training network
    • epochs: max epoch count at which to stop training
    • min_errmin error value at which to stop training

Inherited methods

The following methods and properties are inherited from nn_trainer_t class:
  • size_t get_epochs() const noexcept;
    Return the max number of epochs
  • double get_min_err() const noexcept;
    Return the min error value at which to stop training
  • double get_error() const noexcept;
    Return current epoch error
  • bool train(const Inputinput, const Targettarget, cost_func_t err_cost_f);
    const Inputinput:    [in] sample input
    const Targettarget:  [in] target output corresponding the given input
    cost_func_t err_cost_f:
    [in] function object which is used to calculate the error at each iteration
    Train the net using a single sample. Return true if get_error() < get_min_error()
  • template <class TSet> 
    size_t train(const TSettraining_set, cost_func_t err_cost_f, progress_cbk_tprogress_cbk = nullptr);
    TSet is a generic collection of std::pair of <Input,Target>
    const TSettraining_set:      [in] training samples set
    cost_func_t err_cost_f:        [in] function object which is used to calculate the error at each iteration
    progress_cbk_t * progress_cbk: [in, opt] if specified is called back for each iteration.

    This template method trains the net using a training set of samples, repeating the training procedure for a max number of epoch equal to get_epochs()
    Every epoch it repeats the training for each sample in the set. 
    Training procedure terminates if err_cost_f() return an error value smaller than get_min_err().
    The method returns the number of last epoch within the range 0..get_epochs(). If return value equals get_epochs() then the min error is not reached and training procedure terminated because the maximum number of epochs has been completed.

See nn_trainer_t for other inherited class members.