connection.java
来自「神经网络源代码,实现了一个BP神经网络,可以完成基于BP的神经网络算法.」· Java 代码 · 共 87 行
JAVA
87 行
package net.openai.ai.nn.network;import java.io.*;public class Connection implements Serializable { // the neuron the connection is from Neuron fromNeuron = null; // the neuron the connection is to Neuron toNeuron = null; // the weight associated with this connection Weight weight = null; public Connection() { weight = new Weight(); } // creates a connection object based on the two // neurons passed in as arguments public Connection(Neuron fromNeuron, Neuron toNeuron) { if(fromNeuron != null && toNeuron != null) { this.fromNeuron = fromNeuron; this.toNeuron = toNeuron; } } /** * * Set the from neuron * @param fromNeuron The neuron which the connection is to come from. */ public void setFromNeuron(Neuron fromNeuron) { if(fromNeuron != null) this.fromNeuron = fromNeuron; } /** * * Get the from neuron * @return Neuron The neuron which the connection comes from. */ public Neuron getFromNeuron() { return fromNeuron; } /** * * Set the to neuron. * @param toNeuron The neuron which the connection is to go to. */ public void setToNeuron(Neuron toNeuron) { if(toNeuron != null) this.toNeuron = toNeuron; } /** * * Get the to neuron. * @return Neuron The neuron which the connection goes to. */ public Neuron getToNeuron() { return toNeuron; } /** * * Set the weight to be associated with this connection. * @param weight The weight to associate with this connection. */ public void setWeight(Weight weight) { if(weight != null) this.weight = weight; } /** * * Get the weight associated with this connection. * @return Weight The weight associated with this connection. */ public Weight getWeight() { return weight; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?