📄 neuron.java
字号:
/* * Neuron.java 1.0 09 Jun 2004 * * NeuralNetworkToolkit * Copyright (C) 2004 Universidade de Bras�lia * * This file is part of NeuralNetworkToolkit. * * NeuralNetworkToolkit is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * NeuralNetworkToolkit is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with NeuralNetworkToolkit; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 - USA. */package neuralnetworktoolkit.neuralnetwork;import java.io.Serializable;import neuralnetworktoolkit.activationfunctions.*;/** * Class that implements some basic features of a neuron. * * @version 1.0 09 Jun 2004 * * @author <a href="mailto:hugoiver@yahoo.com.br">Hugo Iver V. Gon�alves</a> * @author <a href="mailto:rodbra@pop.com.br">Rodrigo C. M. Coimbra</a> */public class Neuron implements INeuron, Serializable { /** Neuron activation function. */ private IActivationFunction activationFunction; /** Neuron output value. */ private double outputValue; /** Neuron input value. */ private double input; /** Neuron delta value. */ private double delta; /** * Creates a new neuron setting "null" values to attributes. */ public Neuron() { this.activationFunction = null; this.outputValue = 0; this.input = 0; this.delta = 0; } //Neuron() /** * Creates a new neuron setting a activation function. * Output and input values are seted to 0 and delta to 1. * * @param activationFunction Activation function to be seted. */ public Neuron(IActivationFunction activationFunction) { this.activationFunction = activationFunction; this.outputValue = 0; this.input = 0; this.delta = 1; } //Neuron() /* (non-Javadoc) * @see neuralnetworktoolkit.INeuron#calculateOutputValue() */ public double calculateOutputValue() { outputValue = activationFunction.functionValue(input); return outputValue; } //calculateOutputValue() /* (non-Javadoc) * @see neuralnetworktoolkit.INeuron#setActivationFunction(neuralnetworktoolkit.IActivationFunction) */ public void setActivationFunction(IActivationFunction activationFunction) { this.activationFunction = activationFunction; } //setActivationFunction() /* (non-Javadoc) * @see neuralnetworktoolkit.INeuron#getActivationFunction() */ public IActivationFunction getActivationFunction() { return activationFunction; } //getActivationFunction() /* (non-Javadoc) * @see neuralnetworktoolkit.INeuron#getOutputValue() */ public double getOutputValue() { return outputValue; } //getOutputValue() /* (non-Javadoc) * @see neuralnetworktoolkit.INeuron#setDelta(double) */ public void setDelta(double delta) { this.delta = delta; } //setDelta() /* (non-Javadoc) * @see neuralnetworktoolkit.INeuron#getDelta() */ public double getDelta() { return delta; } //getDelta() /* (non-Javadoc) * @see neuralnetworktoolkit.INeuron#setInput(double) */ public void setInput(double input) { this.input = input; } //setInput() /* (non-Javadoc) * @see neuralnetworktoolkit.INeuron#getInput() */ public double getInput() { return input; } //getInput()} //Neuron
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -