12 #ifndef _MLPACK_METHODS_PERCEPTRON_LEARNING_POLICIES_SIMPLE_WEIGHT_UPDATE_HPP 13 #define _MLPACK_METHODS_PERCEPTRON_LEARNING_POLICIES_SIMPLE_WEIGHT_UPDATE_HPP 28 namespace perceptron {
49 template<
typename VecType>
53 const size_t incorrectClass,
54 const size_t correctClass,
55 const double instanceWeight = 1.0)
57 weights.col(incorrectClass) -= instanceWeight * trainingPoint;
58 biases(incorrectClass) -= instanceWeight;
60 weights.col(correctClass) += instanceWeight * trainingPoint;
61 biases(correctClass) += instanceWeight;
Linear algebra utility functions, generally performed on matrices or vectors.
void UpdateWeights(const VecType &trainingPoint, arma::mat &weights, arma::vec &biases, const size_t incorrectClass, const size_t correctClass, const double instanceWeight=1.0)
This function is called to update the weightVectors matrix.
The core includes that mlpack expects; standard C++ includes and Armadillo.