com.googlecode.fannj
public class Fann extends Object
A standard fully connected back-propagation neural network.
Not thread safe.
A Java binding to the Fast Artificial Neural Network (FANN) native library.This class invokes native code. You must call close() to prevent memory leakage.
Modifier and Type | Field and Description |
---|---|
protected com.sun.jna.Pointer |
ann |
Modifier | Constructor and Description |
---|---|
protected |
Fann() |
|
Fann(List<Layer> layers)
Create a new ANN with the provided layers.
|
|
Fann(String file)
Load an existing FANN definition from a file
|
Modifier and Type | Method and Description |
---|---|
protected void |
addLayers(List<Layer> layers) |
void |
close()
Frees allocated memory.
|
protected static com.sun.jna.Pointer |
fann_create_from_file(String configuration_file) |
protected static com.sun.jna.Pointer |
fann_create_shortcut_array(int numLayers,
int[] layers) |
protected static com.sun.jna.Pointer |
fann_create_sparse_array(float connection_rate,
int numLayers,
int[] layers) |
protected static com.sun.jna.Pointer |
fann_create_standard_array(int numLayers,
int[] layers) |
protected static void |
fann_destroy(com.sun.jna.Pointer ann) |
protected static float |
fann_get_MSE(com.sun.jna.Pointer ann) |
protected static com.sun.jna.Pointer |
fann_get_neuron(com.sun.jna.Pointer ann,
int layer,
int neuron) |
protected static int |
fann_get_num_input(com.sun.jna.Pointer ann) |
protected static int |
fann_get_num_output(com.sun.jna.Pointer ann) |
protected static int |
fann_get_total_neurons(com.sun.jna.Pointer ann) |
protected static com.sun.jna.Pointer |
fann_run(com.sun.jna.Pointer ann,
float[] input) |
protected static int |
fann_save(com.sun.jna.Pointer ann,
String file) |
protected static void |
fann_set_activation_function(com.sun.jna.Pointer ann,
int activation_function,
int layer,
int neuron) |
protected static void |
fann_set_activation_steepness(com.sun.jna.Pointer ann,
float steepness,
int layer,
int neuron) |
int |
getNumInputNeurons() |
int |
getNumOutputNeurons() |
int |
getTotalNumNeurons() |
float[] |
run(float[] input)
Run the ANN on a set of inputs.
|
boolean |
save(String file)
Save this FANN to a file.
|
protected Fann()
public Fann(String file)
file
- public int getNumInputNeurons()
public int getNumOutputNeurons()
public int getTotalNumNeurons()
public boolean save(String file)
file
- public float[] run(float[] input)
input
- length == numInputNeuronspublic void close()
Frees allocated memory.
You must call this method when you are finished to prevent memory leaks.protected static com.sun.jna.Pointer fann_create_standard_array(int numLayers, int[] layers)
protected static com.sun.jna.Pointer fann_create_sparse_array(float connection_rate, int numLayers, int[] layers)
protected static com.sun.jna.Pointer fann_create_shortcut_array(int numLayers, int[] layers)
protected static float fann_get_MSE(com.sun.jna.Pointer ann)
protected static com.sun.jna.Pointer fann_run(com.sun.jna.Pointer ann, float[] input)
protected static void fann_destroy(com.sun.jna.Pointer ann)
protected static int fann_get_num_input(com.sun.jna.Pointer ann)
protected static int fann_get_num_output(com.sun.jna.Pointer ann)
protected static int fann_get_total_neurons(com.sun.jna.Pointer ann)
protected static void fann_set_activation_function(com.sun.jna.Pointer ann, int activation_function, int layer, int neuron)
protected static void fann_set_activation_steepness(com.sun.jna.Pointer ann, float steepness, int layer, int neuron)
protected static com.sun.jna.Pointer fann_get_neuron(com.sun.jna.Pointer ann, int layer, int neuron)
protected static com.sun.jna.Pointer fann_create_from_file(String configuration_file)
protected static int fann_save(com.sun.jna.Pointer ann, String file)