46 const Sampler<InputIter>& sampling_policy = Sampler<InputIter>{}) {
53 if (learn_factor == 0) {
58 for (
auto it = sampling_policy.start(begin, end); it != end; it = sampling_policy.next(it)) {
61 auto input_weights = weight_func(*it);
66 std::tie(bmu_x, bmu_y, nd_distance) = som.findBMU(*it, weight_func);
70 std::tie(size_x, size_y) = som.getSize();
72 for (
std::size_t cell_y = 0; cell_y < size_y; ++cell_y) {
73 for (
std::size_t cell_x = 0; cell_x < size_x; ++cell_x) {
74 auto cell = som(cell_x, cell_y);
77 auto neighborhood_factor =
m_neighborhood_func({bmu_x, bmu_y}, {cell_x, cell_y}, i, iter_no);
80 if (neighborhood_factor != 0) {
81 for (
std::size_t wi = 0; wi < som.getDimensions(); ++wi) {
82 cell[wi] = cell[wi] + neighborhood_factor * learn_factor * (input_weights[wi] - cell[wi]);