-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnodes.cpp
More file actions
executable file
·47 lines (39 loc) · 928 Bytes
/
nodes.cpp
File metadata and controls
executable file
·47 lines (39 loc) · 928 Bytes
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
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
class NODE{
private:
void InitializeWeights(){
Threshold = -1+2.0*((double)rand()/(double)RAND_MAX);
cout << Threshold << endl;
ThresholdDiff = 0;
for(int i=0;i<WeightSize;i++){
Weight[i] = -1+2.0*((double)rand()/(double)RAND_MAX);
cout << Weight[i] << endl;
WeightDiff[i]=0;}
}
public:
double Output;
double *Weight;
double *WeightDiff;
double Threshold;
double ThresholdDiff;
double Delta;
//NODE(int NoOfNodes);
//double * get_weights();
// double get_output();
int WeightSize;
NODE(int NoOfNodes){
Weight = new double[NoOfNodes];
WeightDiff = new double[NoOfNodes];
WeightSize=NoOfNodes;
InitializeWeights();
}
double* get_weights(){
return Weight;}
double get_output(){
return Output;
}
};
//