## 3 Expert Systems for Features Classification
### Optimization of the Learning Process of ANN Expert System for IMs Fault Diagnosis  
ANN expert systems are quite optimal in problem solving and may even be better than SVM when the distribution of problem solutions is highly non-linear. In contrast, the complexity to train and optimize an ANN expert system that solves the problem is greater than in the case of an SVM system. The optimization of the structure of an ANN expert system implies the selection of the number of neurons per layer and the number of layers. These choices are relevant, since they influence the quality of learning and the accuracy of the results. For each concrete problem to solve, there is an optimal structural configuration. Training an unoptimized structure may lead to under-training or over-training the problem. As of today, there is not a well defined method to find an optimal structural network in a direct way. However, in the case of neural networks for classification, several methodological rules have been published that discuss the structural limits of the network [10; 11]. For classification problems these researches recommend a hidden layer range in the network between one and two layers, a heuristic search algorithm for fitting optimal network structure, and the best internal configuration for each neuron [9]. A stochastic search with heuristic optimization using the pyramid rule has been chosen to search the optimal structural network for IMs fault diagnosis. In the pyramid rule it is assumed that the best initial structure for searching optimal network has a trapezoidal pyramid shape where the network base are the inputs and the top are the outputs. In the case of classification problems for ANN developed in the artificial intelligence field, as shown in Table 1, for each hidden layer's neuron is assigned a \"hyperbolic tangent Sigmoid\" transfer function. On the other hand, on the output layer, for each neuron a 'Competitive _SoftMax_' transfer function is used, whose output acquires the maximum value while the other outputs are cancelled. It must be emphasized that both optimizing methods for ANN network structure and configuration used in this work are only valid and optimal when the ANN is used to solve classification problems. Therefore, these methods are valid for IMs fault diagnosis since it is a classification problem (healthy/faulty). \begin{table}
\begin{tabular}{c c c} \hline \hline
**Layer Type** & **Transfer Function** & **In(\(i\))/Out(\(o\))** **Tie** \\ \hline Hidden Layer & Hyperbolic Tangent Sigmoid & \(o=\frac{\sqrt{-i}-i^{-o}}{P+i^{-o}}\) \\ \hline Output Layer & Competitive Softmax & \(o=1\), n max \\  & & \(o=0\), the others \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Transfer functions used to solve classification problems with ANN expert systems for IMs fault diagnosis. Figure 9: Scheme about training and classification for the iteration of \(k\) feature in the _’leave one out cross validation’_ training algorithm. In each step of this ANN structural optimization algorithm, a specific network structure is generated (specific number of layers and number of neurons per layer). For each generated structure an optimal training and validation must be carried out to obtain a valid approximation hit rate for this ANN structure. The highest hit rate when the ANN structural optimization algorithm has finished is declared as the best approximation hit rate and its structure is the optimum one to solve the IMs classification problem. For ANN, the _'leave one out cross validation'_ method is not optimal to obtain a good approximation of the hit ratio, due to the operative of the algorithms used to train ANN expert systems. Accordingly, in this research, it has been implemented for training the ANN a _'training/validation/test cross validation'_ method. This method, shown in the scheme of Figure 10, iterates in a loop of 100 iterations (100 basic trainings) where the fault characteristics are distributed in each iteration between the training, validation, and test sets.