-
Notifications
You must be signed in to change notification settings - Fork 0
/
node.java
49 lines (46 loc) · 1.05 KB
/
node.java
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
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package neuralnets;
import java.math.*;
/**
*
* @author AMRoche
*/
public class node {
public String nodeName;
public double weight;
public String calcType;
public double tier;
public double error;
public double output;
public double calculation(double input) {
if (calcType == "sigmoid") {
return 1 / (1 + (Math.exp(input*-1)));
}
if(calcType == "summation"){
output = input;
return output;
}
if(calcType == "none"){
output = input;
return output;
}
else {
return 0;
}
}
node(){}
node(String Nodie, String Calculon, double tyer, double out){
if(Calculon != ""){
calcType = Calculon;
}
else{
calcType = "sigmoid";
}
this.nodeName = Nodie;
this.output = out;
this.tier = tyer;
}
}