forked from andrewbalan/Neural-network-Qt-C-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
layer.h
57 lines (45 loc) · 1.31 KB
/
layer.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
50
51
52
53
54
55
56
57
#ifndef LAYER_H
#define LAYER_H
#include "ui_layerview.h"
#include <QWidget>
#include <QDebug>
#include <QtMath>
class Layer: public QWidget
{
Q_OBJECT
private:
const Layer* prev;
const int nodesNumber;
int inputLength;
double** weights;
double* values;
double* input;
double* z; // linear combination
double* error;
double **derivative;
Ui::layerView ui;
public:
explicit Layer(int numberOfNodes, Layer* previousLayer, QWidget *parent = 0);
~Layer();
void setInput(double* , int);
double getInput(int index);
void eval();
double const * getValues() const;
double **getWeights() const;
int getNodesNumber() const;
int getInputLength() const;
double getLinearCombination(int i) const;
double getWeight(unsigned int row, unsigned int col) const;
void setWeight(unsigned int row, unsigned int col, double value);
double getDerivative(unsigned int row, unsigned int col) const;
void setDerivative(unsigned int row, unsigned int col, double value);
void uiRefreshTables();
void uiInitLabels();
void uiInitTables();
double getError(int index);
void setError(int index, double value);
static double sigmoid(double);
static double sigmoidGradient(double z);
double getValue(int i);
};
#endif // LAYER_H