-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsom.h
34 lines (27 loc) · 852 Bytes
/
som.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef SOM_H
#define SOM_H
#include "abstractMap.h"
#include "cities.h"
#include "dPoint.h"
#include <QObject>
//These values are hyperparameters for the SOM training algorithm
#define INITIAL_LEARNING_RATE 0.9995
#define NEIGHBOURHOOD_MULTIPLIER 0.1
class SOM : public QObject, public AbstractMap
{
Q_OBJECT
public:
SOM();
void InitializeCircular(int numberOfNodes);
QVector<double> getXaxis() const override;
QVector<double> getYaxis() const override;
void train(Cities &cities,int iterations);
private:
static std::function<DPoint (const Point&)> mapperFactory(const Point& city);
static void reducer(DPoint &winner, const DPoint &competitor);
void moveNodes(Point& BMU, const Point& city, double learningRate);
signals:
void trainingIterationDone();
void trainingDone(bool b);
};
#endif // SOM_H