Jannis (0.1preAlpha) | ||
Frames | No Frames |
1: /* BiNeuron.java - Copyright (c) 2005 by Stefan Thesing 2: <p>This file is part of Jannis.</p> 3: <p>Jannis is free software; you can redistribute it and/or modify 4: it under the terms of the GNU General Public License as published by 5: the Free Software Foundation; either version 2 of the License, or 6: (at your option) any later version.</p> 7: <p>Jannis is distributed in the hope that it will be useful, 8: but WITHOUT ANY WARRANTY; without even the implied warranty of 9: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10: GNU General Public License for more details.</p> 11: <p>You should have received a copy of the GNU General Public License 12: along with Jannis; if not, write to the<br> 13: Free Software Foundation, Inc.,<br> 14: 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA<br> 15: */ 16: package de.webdings.jannis.neuralnet; 17: 18: 19: 20: /** 21: * BiNeuron is a concrete subclass of {@link Neuron}. 22: * The activation function of this neuron type is a 23: * binary threshhold function. This means that neurons 24: * of this type have a threshhold value <code>sigma</code>. 25: * The neuron fires if the overall activation the neuron 26: * receives is equal or higher than <code>sigma</code>. 27: * 28: * @author Stefan Thesing<br> 29: * Website: <a href="http://www.webdings.de">http://www.webdings.de</a> 30: * @version 0.1 10.08.2005 31: */ 32: public class BiNeuron extends Neuron { 33: //attributes 34: /** 35: * <code>sigma</code> is the activation treshold value 36: * of the BiNeuron. If the net activation for this 37: * BiNeuron is equal or higher than sigma, 38: * {@link #tresholdReached() tresholdReached} 39: * will return <code>true</code> 40: */ 41: protected float sigma; 42: 43: //constructors 44: /** 45: * Constructs a BiNeuron using the specified value for sigma and 46: * using default values for the attributes inherited from 47: * {@link Neuron}:<br> 48: * a=0<br> 49: * net=0<br> 50: * fired=false<br> 51: * shouldHaveFired=<code>false</code><br> 52: * numberOfConnections=0 53: * @param sigma 54: */ 55: public BiNeuron(float sigma) { 56: this.sigma = sigma; 57: a = 0; 58: net = 0; 59: numberOfConnections = 0; 60: connections = new Synapse[numberOfConnections]; 61: fired = false; 62: } 63: 64: /** 65: * Constructs a BiNeuron using default values:<br> 66: * a=0<br> 67: * net=0<br> 68: * fired=false<br> 69: * shouldHaveFired=<code>false</code><br> 70: * numberOfConnections=0<br> 71: * sigma=0.8 72: */ 73: public BiNeuron() { 74: this(0.8f); 75: } 76: //methods 77: /** 78: * represents the activations function of the 79: * neuron. 80: * @return <code>true</code> if the net activation this neuron 81: * receives is equal or higher than sigma. 82: */ 83: public boolean tresholdReached() { 84: return(net>=sigma); 85: } 86: 87: /** 88: * @return Returns sigma. 89: */ 90: public float getSigma() { 91: return sigma; 92: } 93: /** 94: * @param sigma The value for sigma to set. 95: */ 96: public void setSigma(float sigma) { 97: this.sigma = sigma; 98: } 99: 100: /** 101: * For <code>BiNeurons</code>, this function returns a String containing 102: * sigma. 103: * @see de.webdings.jannis.neuralnet.Neuron#getActivationFunction() 104: * 105: */ 106: public String getActivationFunction() { 107: return Float.toString(this.getSigma()); 108: } 109: }
Jannis (0.1preAlpha) |
© 2005 by Stefan Thesing;
Verbatim copying and redistribution of this entire page are permitted provided this notice is preserved.