Training an artificial neural network using PSO
Particle Swarm Optimization can be used to optimize a neural network with more than one hidden layer. Instead of optimizing a single weight matrix, and two bias vectors, you are just optimizing more of them. However, PSO is not often used for larger neural networks, because, particle swarm optimization is not all that efficient at working with a large amount of data, which you need to train larger neural networks. Particle Swarm Optimization involves taking many particles, and evaluating the fitness in all of them. If you have let’s say 1,000,000 training examples, you are doing a lot more error calculations, even if you used a small batch size, than if you used another technique lake Backproppogation, or a related technique. Backproppogation and related techniques are used much more in larger neural networks because they are more efficient at working with larger sets of data. As for why the code that you have been using breaks with networks with more than one hidden layer, I cannot explain, but it is fairly easy to write your own basic implementation of PSO to train multi layer neural networks.