# Automatic Classification of Morphologically Similar Fish Species Using Their Head Contours
## 2 Materials and Methods
### Extreme Learning Machines, Training and Classification  
A _single-hidden layer feed-forward neural_ (SLFN) network is trained as a classifier following the extreme learning machines (ELM) framework [46; 47]. The main idea under ELM is that a SLFN network can be trained by randomly assigning both input weights and bias. Proceeding this way, the only parameters to determine in the SLFN network setting are the weights that connect the hidden layer neurons to the outlets (named output weights) and the number \(H\) of hidden neurons. This strategy changes the problem of computing the SLFN output weights to a linear problem. The resulting linear over-determined system can be quickly solved using a Moore-Penrose pseudo-inverse in one single step [46; 47]. Focusing on our classification problem, each individual \(i\) in a set of \(N\) is characterized with \(L\) features organized in a vector \(\mathbf{x}_{i}=[x_{0}\cdots x_{L-1}]^{T}\). The matrix \(\mathbf{X}=[\mathbf{x}_{1}\cdots\mathbf{x}_{i}\cdots\mathbf{x}_{N}]\) of size \(L\times N\) organizes the features of all \(N\) specimens. These individuals are classified into \(C\) classes. For each class, there is a vector \(\mathbf{t}_{c}\) that indicates with either a \(1\) or a \(-1\) in the position \(i\) whether the individual \(i\) belongs (1) or does not belong (\(-1\)) to the class \(c\). The vectors \(\mathbf{t}_{c}\) are arranged in the matrix \(\mathbf{T}=[\mathbf{t}_{1}\cdots\mathbf{t}_{c}\cdots\mathbf{t}_{C}]^{T}\) of size \(N\times C\) so that in each row of \(\mathbf{T}\) only one \(1\) appears. Considering that \(H\) is the number of hidden neurons, the input weight matrix \(\mathbf{W}\) will have a size of \(L\times H\) in which its element \(w_{ll}\) is the weight that connects the feature \(l\) with the hidden node \(h\). As there are \(H\) hidden nodes, there is a vector of bias \(\mathbf{b}\) containing the bias \(b_{h}\) of each node. Now, considering the individual \(i\), the flow of information into the network can be written as \(\mathbf{x}_{i}^{T}\mathbf{W}+\mathbf{b}^{T}\). Taking into account the activation function, which is typically a sigmoid, we have \(sig(\mathbf{x}_{i}^{T}\mathbf{W}+\mathbf{b}^{T})\), where \(sig(\mathbf{A})\) applies the sigmoid function to each \(a_{ij}\). Then, when the resulting \(1\times H\) row vector is multiplied by the output weight matrix \(\mathbf{B}\) of size \(H\times C\) the resulting \(1\times C\) row vector will indicate the class to which the individual \(i\) belongs. If we group the same equation for all previously classified individuals, ideally we will have the equation:  
\[sig(\mathbf{X}^{T}\mathbf{W}+\mathbf{u}\mathbf{b}^{T})\mathbf{B}=\mathbf{T}, \tag{10}\]  
where \(\mathbf{u}\) is the \(N\times 1\) all-ones vector We define the \(N\times H\) matrix \(\mathbf{H}\) as:  
\[\mathbf{H}=sig(\mathbf{X}^{T}\mathbf{W}+\mathbf{u}\mathbf{b}^{T}). \tag{11}\]  
Then, the ANN formulation can be compactly written as:  
\[\mathbf{H}\mathbf{B}=\mathbf{T}. \tag{12}\]  
Once \(H\) is decided, \(\mathbf{W}\) and \(\mathbf{b}\) are randomly selected from a Gaussian distribution function with a mean of zero and a standard deviation of one. The only unknown parameter is \(\mathbf{B}\). Note that Equation (12) is over-determined. For ELM networks, it is common to choose a number \(H\) of hidden nodes lower than the number \(N\) of classified cases used for training, that is, \(N>H\). Intuitively, if we see Equation (12) in terms of vectors \(\mathbf{b}_{i}\) and \(\mathbf{t}_{i}\) of \(\mathbf{B}\), and \(\mathbf{T}\) respectively, we have \(\mathbf{H}\mathbf{b}_{i}=\mathbf{t}_{i}\), for \(i\) going from \(1\) to \(C\), meaning that for \(N\) equations, we have \(H\) unknown weights. The output weight matrix \(\mathbf{B}\), provided that \(\left(\mathbf{H}^{T}\mathbf{H}\right)^{-1}\) is non singular, is computed by:\[\mathbf{B}=\left(\mathbf{H}^{T}\mathbf{H}\right)^{-1}\mathbf{H}^{T}\mathbf{T}= \mathbf{H}^{\dagger}\mathbf{T}, \tag{13}\]  
where \(\mathbf{H}^{\dagger}\) is the Moore-Penrose inverse.