## 2 Materials and Methods
### Classification by a Sample-Encoding Generalization of the Kohonen Neural Network
#### 2.2.1 Sample Similarity and the Two-Sample Hotelling \(T^{2}\) Statistic  
Let \(\mathbf{X}=\{\mathbf{x}_{1},...,\mathbf{x}_{N}\}\) and \(\mathbf{W}=\{\mathbf{w}_{1},...,\mathbf{w}_{M}\}\) be samples of independent realizations of two \(D\)-variate multinomial random variables of equal covariance matrices and with means \(\mu_{X}\) and \(\mu_{W}\). Let \(\tilde{\mathbf{X}}\) and \(\tilde{\mathbf{W}}\) be the sample means of \(\mathbf{X}\) and \(\mathbf{W}\), respectively:  
\[\tilde{\mathbf{X}}=\frac{1}{N}\sum\limits_{i=1}^{n}\mathbf{x}_{i};\ \ \ \tilde{ \mathbf{W}}=\frac{1}{M}\sum\limits_{i=1}^{m}\mathbf{w}_{i}, \tag{1}\]  
and \(\mathbf{C}_{X},\mathbf{C}_{W}\) the sample covariances:  
\[\begin{array}{l}\mathbf{C}_{\mathbf{X}}=\frac{1}{N-1}\sum\limits_{i=1}^{N}( \mathbf{x}_{i}-\tilde{\mathbf{X}})(\mathbf{x}_{i}-\tilde{\mathbf{X}})^{T},\\ \mathbf{C}_{\mathbf{W}}=\frac{1}{M-1}\sum\limits_{i=1}^{M}(\mathbf{w}_{i}- \tilde{\mathbf{W}})(\mathbf{w}_{i}-\tilde{\mathbf{W}})^{T}.\end{array} \tag{2}\]  
Finally, let \(\mathbf{C}\) be the pooled (combined) covariance estimate of \(\mathbf{X},\mathbf{W}\) given by:  
\[\mathbf{C}=\frac{(N-1)\mathbf{C}_{\mathbf{X}}+(M-1)\mathbf{C}_{\mathbf{W}}}{N +M-2}. \tag{3}\]  
The two-sample Hotelling \(T^{2}\) statistic is defined by [27]:  
\[T^{2}=\frac{NM}{N+M}(\tilde{\mathbf{X}}-\tilde{\mathbf{W}})^{T}\mathbf{C}^{-1 }(\tilde{\mathbf{X}}-\tilde{\mathbf{W}}). \tag{4}\]  
This statistic is ordinarily used in statistical hypothesis testing to test the null hypothesis \(H_{0}:\mu_{X}=\mu_{W}\) against the hypothesis \(H_{1}:\mu_{X}\
eq\mu_{W}\)[14]. For large samples, the distribution under the null hypothesis of the \(T^{2}\) statistic is approximately the \(\chi^{2}\) (Chi-squared) distribution with \(D\) degrees of freedom. For small sample sizes, as in our case of knee kinematic data, it is better approximated, under the null hypothesis, by the \(F\) distribution with \(D\) degrees of freedom for the numerator, and \(N+M-1-D\) degrees of freedom for the denominator:  
\[\frac{N+M-D-1}{(N+M-2)D}T^{2}\sim F(D,N+M-1-D). \tag{5}\]  
The \(F\) distribution in Label (5) can be a good approximation of the \(T^{2}\) statistic distribution when the dimension of the data is less than the size of the samples [28]. For high-dimensional vectors, like knee kinematic data vectors, this study is dealing with dimensionality reduction, for instance by principal component analysis (PCA) or wavelet representation, affords a means to satisfy this condition. The \(F\) distribution with \(11\) degrees of freedom for the numerator and denominator, close to what we have in the knee data classification application of this study.  
The two-samples \(T^{2}\) statistic is in a fixed positive proportion to the squared Mahalanobis distance between the two samples means [29], as evident in Equation (4). Therefore, it is a legitimate measure of similarity of two samples, particularly when it is used to determine among a set of samples the closest to a given reference sample, as it is used in the sample-encoding generalization of the Kohonen memory which we describe next.