|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectneural.net.Neuron
public class Neuron
Represents a single neuron within an Artificial Neural Net
Field Summary | |
---|---|
static int |
OFFSET
The offset input value |
Constructor Summary | |
---|---|
Neuron(int inputCount,
ActivationFunction activationFunction)
Constructor |
Method Summary | |
---|---|
double |
fire(double[] inputs)
Fire the neuron, ie process the input and return the output |
double |
getInput(int id)
Get an input from the last set of input operated on |
int |
getInputCount()
Get number of inputs for the neuron |
double |
getLastOutput()
Get the last output returned by fire() |
double |
getWeight(int id)
Get a weight for one of the input values |
void |
setWeight(int id,
double weight)
Set a weight for one of the input values |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int OFFSET
Constructor Detail |
---|
public Neuron(int inputCount, ActivationFunction activationFunction)
inputCount
- - number of inputs the neuron acceptsactivationFunction
- - class implementing ActivationFunction, used to calculate activation value of neuronMethod Detail |
---|
public void setWeight(int id, double weight) throws java.lang.Exception
id
- - weight to set, id must be less than the number of inputs + 1 (the offset gets a weight)weight
- - value of the weight
java.lang.Exception
- - throws an exception for invalid idpublic double getWeight(int id) throws java.lang.Exception
id
- - weight to set, id must be less than the number of inputs + 1 (the offset gets a weight)
java.lang.Exception
- - throws an exceptionf for invalid idpublic int getInputCount()
public double getInput(int id) throws java.lang.Exception
id
- - input to retrieve
java.lang.Exception
- - throws an exception for invalid id, or if fire() has not been executed yetpublic double getLastOutput()
public double fire(double[] inputs) throws java.lang.Exception
inputs
- - an array of inputs to act on
java.lang.Exception
- - throws an exception for invalid input size
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |