Class nmesh
NMesh object. This class is the base class.
Warning: A lot of effort and sanity has gone into optimizing
this, so some methods may not look pretty but it's all for the greater
good of performance. PHP is not typically recognised for it's speed,
nor are neural networks, so this combination was never destined to be
enjoyable or even possible yet here it is in all its glory.
Based on the PHPNN class
Methods summary
public
|
|
public
The
|
#
run( $inputarray )
Takes some input and runs the network
Takes some input and runs the network
Parameters
Returns
The output data
|
public
Array
|
#
quick_train( $id, $epochs, $lr, $inputs, $outputs )
Do a quick unsupervised training set
Do a quick unsupervised training set
Parameters
- $id
- of the network
- $epochs
- of epochs to run
- $lr
- of inputs
- $inputs
- of desired outputs
- $outputs
Returns
Array of results
|
public
The
|
#
train( $inputarray, $outputarray, $learningrate )
Main function to train the network based on some inputs and
desired outputs
Main function to train the network based on some inputs and
desired outputs
Parameters
- $inputarray
- to train
- $outputarray
- outputs
- $learningrate
- rate at which it learns
Returns
The global MSE (how intelligent the network is)
|
public
The
|
#
calculate_deltas( $outputarray, $lr )
This peforms the backpropagation algorithm on the network
This peforms the backpropagation algorithm on the network
Parameters
- $outputarray
- on the last run, teach it to return this
- $lr
- learning rate
Returns
The global MSE of this training epoch
|
public
|
|
public
|
#
remove_inputs( $inputs )
Network manipulation to remove an amount of neurons
Network manipulation to remove an amount of neurons
Parameters
- $inputs
- of input neurons to remove
|
public
|
#
add_inputs( $inputs )
Add an amount of input neurons
Add an amount of input neurons
Parameters
- $inputs
- of input neurons to add
|
public
|
#
remove_outputs( $outputs )
Remove some outputs
Parameters
- $outputs
- of output neurons to remove
|
public
|
|
public
|
#
add_layer( $neuronal_bias = 1, $initial_weightrange = 1 )
Add a hidden layer to the network
Add a hidden layer to the network
Parameters
- $neuronal_bias
- Bias
- $initial_weightrange
- of random weights
|
public
|
#
add_neuron( $count = 1, $bias = 1, $weightrange = 1 )
Add a neuron to hidden layers
Add a neuron to hidden layers
Parameters
- $count
- of neurons to add
- $bias
- $weightrange
|
public
|
#
remove_layer( $layer = null )
Remove a layer from the network
Remove a layer from the network
Parameters
- $layer
- of the layer to remove (must be hidden layer)
|
public
|
#
remove_neuron( $count = 0 )
Remove a neuron from hidden layers
Remove a neuron from hidden layers
Parameters
|
public
|
#
nmesh( $input_neurons, $output_neurons, $hidden_neurons_per_layer, $hidden_layers, $neuronal_bias = 1, $initial_weightrange = 1 )
Constructor for creating a neural network object
Constructor for creating a neural network object
|