The success of an artificial neural network (ANN) strongly depends on the variety of the connection weights and the network structure. Among many methods used in the literature to accurately select the network weights or structure in isolate; a few researchers have attempted to select both the weights and structure of ANN automatically by using metaheuristic algorithms. This paper proposes modified bat algorithm with a new solution representation for both optimizing the weights and structure of ANNs. The algorithm, which is based on the echolocation behaviour of bats, combines the advantages of population-based and local search algorithms. In this work, ability of the basic bat algorithm and some modified versions which are based on the consideration of the personal best solution in the velocity adjustment, the mean of personal best and global best solutions through velocity adjustment and the employment of three chaotic maps are investigated. These modifications are aimed to improve the exploration and exploitation capability of bat algorithm. Different versions of the proposed bat algorithm are incorporated to handle the selection of the structure as well as weights and biases of the ANN during the training process. We then use the Taguchi method to tune the parameters of the algorithm that demonstrates the best ability compared to the other versions. Six classifications and two time series benchmark datasets are used to test the performance of the proposed approach in terms of classification and prediction accuracy. Statistical tests demonstrate that the proposed method generates some of the best results in comparison with the latest methods in the literature. Finally, our best method is applied to a real-world problem, namely to predict the future values of rainfall data and the results show satisfactory of the method. 
Optimization of neural network model using modified bat-inspired algorithm