-
Notifications
You must be signed in to change notification settings - Fork 1
/
qmlp.h
49 lines (36 loc) · 1.5 KB
/
qmlp.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef QMLP_H
#define QMLP_H
#include "multilayerperceptron.h"
#include <QMessageBox>
#include <QtCore>
template <typename T> QString toQStr(T pNumber) {return QString::number(pNumber);}
class QMLP : public QObject, public MLP
{
Q_OBJECT
public:
QMLP(qint64 HL = 0, qint64 PL = 0): MLP(HL,PL) {}
QMLP(const QMLP &other): QObject(), MLP(static_cast<MLP>(other)) {}
virtual ~QMLP () {}
QMLP& operator = (const QMLP &other) { clone(other); return *this;}
static void init();
static QMLP load(QIODevice *f);
static void save(QIODevice *f, const QMLP &mlp);
bool learn(QString str);
virtual void display(const string & str) { emit disp(QString::fromStdString(str)); }
virtual bool displayMQE(const clock_t &start, qreal &nextDisplayTime, const qreal & mqe, const qreal &learningRate, const qreal & refreshTime = 0.1);
public slots:
void resetSlot() {reset();}
signals:
void disp(const QString &s);
void newSecond(const qreal &sec = 0);
void learningFinished();
private:
friend QDataStream & operator << (QDataStream & out, const QMLP & mlp);
friend QDataStream & operator >> (QDataStream & in, QMLP & mlp);
};
Q_DECLARE_METATYPE(QMLP)
QDataStream & operator << (QDataStream & out, const QMLP & mlp);
QDataStream & operator >> (QDataStream & in, QMLP & mlp);
QDataStream & operator << (QDataStream & out, const EigenMatrix & mat);
QDataStream & operator >> (QDataStream & in, EigenMatrix & mat);
#endif // QMLP_H