http://www.developer.comlang/php/creating-neural-networks-in-php.html

## Training a Neural Network in PHPBefore being able to solve the problem, the artificial neural network has to learn how to solve it. Think of this network as an equation. You have added test data and the expected output, and the network has to solve the equation by finding the connection between input and output. This process is called training. In neural networks, these connections are neuron weights. A few algorithms are used for network training, but After initializing random weights in the network, the next steps are to: - Loop through the test data
- Calculate the actual output
- Calculate the error (desired output - current network output)
- Compute the delta weights backwards
- Update the weights
The process continues until all test data has been correctly classified or the algorithm has reached a stopping criterion. Usually, the programmer tries to teach the network for a maximum of three times, while the maximum number of training rounds (epochs) is 1000. Also, each learning algorithm needs an activation function. For backpropagation, the activation function is hyperbolic tangent ( Let's see how to train a neural network in PHP:
Mean squared error ( Before seeing the working example of an artificial neural network in PHP, it is good practice to save your neural network to a file or a SQL database. If you don't save it, you will have to do the training every time someone executes your application. Simple tasks are learned quickly, but training takes much longer for more complex problems, and you want your users to wait as little as possible. Fortunately, there are save and load functions in the PHP class in this example:
Note that the file extension must be ## The PHP Code for Our Neural NetworkLet's look at the PHP code of the working application that receives red, green and blue values and calculates whether the blue or red color is dominant:
## Neural Network LimitationsThe main limitation of neural networks is that they can solve only linearly separable problems and many problems are not linearly separable. So, non-linearly separable problems require another artificial intelligence algorithm. However, neural networks solve enough problems that require computer intelligence to earn an important place among artificial intelligence algorithms. |