public class HiddenUnit extends java.lang.Object implements Unit
Modifier and Type | Field and Description |
---|---|
static int |
MAX_INITIAL_WEIGHT |
static int |
MIN_INITIAL_WEIGHT |
protected Unit[] |
units |
protected double |
value |
double[] |
weights |
Modifier | Constructor and Description |
---|---|
protected |
HiddenUnit(Unit[] units,
double[] weights)
Builds a hidden unit taking the provided number of
inputs.
|
protected |
HiddenUnit(Unit[] units,
java.util.Random random)
Builds a hidden unit taking the provided number of
inputs.
|
Modifier and Type | Method and Description |
---|---|
protected double |
getSum()
Returns the sum of all of the inputs and weights
|
double |
getValue()
Returns the current value of this input
|
void |
randomizeWeights(java.util.Random random)
Generates a new weight
|
void |
recompute()
Recomputes the value of this hidden unit, querying it's
prior inputs.
|
protected double |
sigmoid(double x)
Implements the sigmoid function to provide the non-linearity
to this function.
|
public static final int MIN_INITIAL_WEIGHT
public static final int MAX_INITIAL_WEIGHT
public double[] weights
protected Unit[] units
protected double value
protected HiddenUnit(Unit[] units, java.util.Random random)
units
- The input units to this unitrandom
- The random number generatorprotected HiddenUnit(Unit[] units, double[] weights)
units
- The input units to this unitweights
- The weights to usepublic void randomizeWeights(java.util.Random random)
random
- The rngprotected double getSum()
public void recompute()
public double getValue()
protected double sigmoid(double x)
x
- The value to apply the function to