📄 node.java
字号:
package ann;
public class Node implements java.io.Serializable,Cloneable {
public double activation;
public double threshold;
public double weights[];
public double detweightslast[];
public double detthresholdlast;
public double error;
public int numOfweights;
public double amultinum;
public ArrayList arWeight=new ArrayList();
public Node() {
activation = 0;
error = 0;
threshold = 0;
amultinum = 1;
}
public Node(int numOfweights0) {
amultinum = 1;
numOfweights = numOfweights0;
weights = new double[numOfweights];
detweightslast = new double[numOfweights];
detthresholdlast = 0;
error = 0;
int i;
for (i = 0; i < numOfweights; i++) {
weights[i] = (2 * Math.random() - 1) * amultinum;
detweightslast[i] = 0;
}
threshold = (2 * Math.random() - 1) * amultinum;
}
public Node(double act, double thr, int numOfweights0) {
amultinum = 1;
numOfweights = numOfweights0;
activation = act;
threshold = thr;
weights = new double[numOfweights];
detweightslast = new double[numOfweights];
}
public void setWeight(ArrayList weight){
weights = new double[weight.size()];
for(int i=0;i<weight.size();i++){
weights[i] = ((Double)weight.get(i)).doubleValue();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -