weight.java

来自「神经网络源代码,实现了一个BP神经网络,可以完成基于BP的神经网络算法.」· Java 代码 · 共 54 行

JAVA
54
字号
package net.openai.ai.nn.network;import java.io.*;public class Weight implements Serializable {    double value = 0;    double lastDelta = 0;    public Weight() {	//  set the initial weight to be a random number between -1 and 1	value = (Math.random() - 0.5);    }    /**     *     * Get the weight's value.     * @return double The value of this weight.     */    public double getValue() {	return value;    }        /**     *     * Set the weight's value.     * @param value The value of this weight.     */    public void setValue(double value) {	lastDelta = this.value - value;	this.value = value;    }    /**     *     * Get the weight's lastDelta.     * @return double The lastDelta of this weight.     */    public double getLastDelta() {	return lastDelta;    }        /**     *     * Set the weight's lastDelta.     * @param lastDelta The lastDelta of this weight.     */    public void setLastDelta(double lastDelta) {	this.lastDelta = lastDelta;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?