Package org.ojalgo.ann
Class ArtificialNeuralNetwork
java.lang.Object
org.ojalgo.ann.ArtificialNeuralNetwork
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
https://en.wikipedia.org/wiki/Activation_functionstatic enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TrainingConfiguration
private final PhysicalStore.Factory
<Double, ?> private final CalculationLayer[]
-
Constructor Summary
ConstructorsConstructorDescriptionArtificialNeuralNetwork
(NetworkBuilder builder) ArtificialNeuralNetwork
(PhysicalStore.Factory<Double, ?> factory, int inputs, int[] layers) -
Method Summary
Modifier and TypeMethodDescription(package private) void
adjust
(int layer, PhysicalStore<Double> input, PhysicalStore<Double> output, PhysicalStore<Double> upstreamGradient, PhysicalStore<Double> downstreamGradient) static NetworkBuilder
builder
(int numberOfNetworkInputNodes) static NetworkTrainer
builder
(int numberOfInputNodes, int... nodesPerCalculationLayer) Deprecated.static NetworkBuilder
builder
(PhysicalStore.Factory<Double, ?> factory, int numberOfNetworkInputNodes) static NetworkTrainer
builder
(PhysicalStore.Factory<Double, ?> factory, int numberOfInputNodes, int... nodesPerCalculationLayer) Deprecated.(package private) int
(package private) int
countInputNodes
(int layer) (package private) int
(package private) int
countOutputNodes
(int layer) int
depth()
(package private) static void
doIdentity
(PhysicalStore<Double> output) (package private) static void
doReLU
(PhysicalStore<Double> output) (package private) static void
doSigmoid
(PhysicalStore<Double> output) (package private) static void
doSoftMax
(PhysicalStore<Double> output) (package private) static void
doTanh
(PhysicalStore<Double> output) boolean
static ArtificialNeuralNetwork
Read (reconstruct) an ANN from the specified input previously written bywriteTo(DataOutput)
.static ArtificialNeuralNetwork
static ArtificialNeuralNetwork
from
(Path path, OpenOption... options) static ArtificialNeuralNetwork
from
(PhysicalStore.Factory<Double, ?> factory, DataInput input) Read (reconstruct) an ANN from the specified input previously written bywriteTo(DataOutput)
.static ArtificialNeuralNetwork
from
(PhysicalStore.Factory<Double, ?> factory, File file) static ArtificialNeuralNetwork
from
(PhysicalStore.Factory<Double, ?> factory, Path path, OpenOption... options) getActivator
(int layer) double
getBias
(int layer, int output) (package private) ArtificialNeuralNetwork.Activator
double
getWeight
(int layer, int input, int output) (package private) List
<MatrixStore<Double>> int
hashCode()
(package private) PhysicalStore
<Double> invoke
(int layer, PhysicalStore<Double> input, PhysicalStore<Double> output) (package private) DataBatch
newBatch
(int rows, int columns) With batch size 1newInvoker
(int batchSize) If you create multiple invokers you can use them in different threads simutaneously - the invoker contains any/all invocation specific state.(package private) PhysicalStore
<Double> newStore
(int rows, int columns) With batch size 1newTrainer
(int batchSize) Only 1 trainer at the time.(package private) void
(package private) void
scale
(int layer, double factor) (package private) void
setActivator
(int layer, ArtificialNeuralNetwork.Activator activator) (package private) void
setBias
(int layer, int output, double bias) (package private) void
setConfiguration
(TrainingConfiguration configuration) (package private) void
setWeight
(int layer, int input, int output, double weight) toString()
int
width()
void
writeTo
(DataOutput output) Will write (save) the ANN to the specified output.void
void
writeTo
(Path path, OpenOption... options)
-
Field Details
-
myConfiguration
-
myFactory
-
myLayers
-
-
Constructor Details
-
ArtificialNeuralNetwork
ArtificialNeuralNetwork(NetworkBuilder builder) -
ArtificialNeuralNetwork
ArtificialNeuralNetwork(PhysicalStore.Factory<Double, ?> factory, int inputs, int[] layers)
-
-
Method Details
-
builder
-
builder
@Deprecated public static NetworkTrainer builder(int numberOfInputNodes, int... nodesPerCalculationLayer) Deprecated.Usebuilder(int)
instead -
builder
public static NetworkBuilder builder(PhysicalStore.Factory<Double, ?> factory, int numberOfNetworkInputNodes) -
builder
@Deprecated public static NetworkTrainer builder(PhysicalStore.Factory<Double, ?> factory, int numberOfInputNodes, int... nodesPerCalculationLayer) Deprecated. -
from
Read (reconstruct) an ANN from the specified input previously written bywriteTo(DataOutput)
.- Throws:
IOException
-
from
- See Also:
-
from
- See Also:
-
from
public static ArtificialNeuralNetwork from(PhysicalStore.Factory<Double, ?> factory, DataInput input) throws IOExceptionRead (reconstruct) an ANN from the specified input previously written bywriteTo(DataOutput)
.- Throws:
IOException
-
from
- See Also:
-
from
public static ArtificialNeuralNetwork from(PhysicalStore.Factory<Double, ?> factory, Path path, OpenOption... options) - See Also:
-
doIdentity
-
doReLU
-
doSigmoid
-
doSoftMax
-
doTanh
-
depth
public int depth()- Returns:
- The number of calculation layers
-
equals
-
getActivator
-
getBias
public double getBias(int layer, int output) -
getWeight
public double getWeight(int layer, int input, int output) -
hashCode
public int hashCode() -
newInvoker
With batch size 1- See Also:
-
newInvoker
If you create multiple invokers you can use them in different threads simutaneously - the invoker contains any/all invocation specific state.- Parameters:
batchSize
- The batch size - the number of batched invocations- Returns:
- The invoker
-
newTrainer
With batch size 1- See Also:
-
newTrainer
Only 1 trainer at the time.- Parameters:
batchSize
- The batch size - the number of batched training examples- Returns:
- The trainer
-
structure
-
toString
-
width
public int width()- Returns:
- The max number of nodes in any layer
-
writeTo
Will write (save) the ANN to the specified output. Can then later be read back by usingfrom(DataInput)
.- Throws:
IOException
-
writeTo
- See Also:
-
writeTo
- See Also:
-
adjust
void adjust(int layer, PhysicalStore<Double> input, PhysicalStore<Double> output, PhysicalStore<Double> upstreamGradient, PhysicalStore<Double> downstreamGradient) -
countInputNodes
int countInputNodes() -
countInputNodes
int countInputNodes(int layer) -
countOutputNodes
int countOutputNodes() -
countOutputNodes
int countOutputNodes(int layer) -
getOutputActivator
ArtificialNeuralNetwork.Activator getOutputActivator() -
getWeights
List<MatrixStore<Double>> getWeights() -
invoke
-
newBatch
-
newStore
-
randomise
void randomise() -
scale
void scale(int layer, double factor) -
setActivator
-
setBias
void setBias(int layer, int output, double bias) -
setConfiguration
-
setWeight
void setWeight(int layer, int input, int output, double weight)
-
builder(int)
instead