# Bearing Fault Diagnosis Based on Small Sample Learning of Maml-Triplet
## 2 Maml-Triplet Learning Method
### Maml Meta Learning Method  
In the standard supervised learning, as shown in Formula (1), the function of deep learning is to obtain the function \(f\) that maps an input data \(x\), such as a signal, to the corresponding fault tag \(y\) of the signal. In the supervised meta learning method, the idea is very similar. According to a dataset \(\mathcal{D}\), which includes multiple fault classification tasks, a function \(F\) is found, as shown in Formula (2). Its function is to find a function \(f\) that maps the input signal data to the fault tag in the standard supervised learning. In other words, the supervised meta learning method aims to find a function \(F\) with the ability to find the function \(f\) according to the dataset. The Maml learning method is one of the meta learning methods. \[\text{Supervised learning}:f(x)\to y \tag{1}\]  
\[\text{Supervised meta learning}:F(\mathcal{D})\to f \tag{2}\]  
The role of the Maml meta learning method in the Maml-Triplet method is to obtain a model in the source dataset that can be quickly applied to a few shot task. The Maml meta learning method obtains a better initial value of the model through preliminary training. Then, based on the initial weights, a small amount of update weights for specific small sample training data tasks can achieve better results. It can be understood as searching for a group of weight parameters with high sensitivity. Based on these highly sensitive weight parameters, ideal results can be achieved in new small sample tasks with only a small number of iterations. As shown in Figure 4, the neural network \(f_{1}(\theta)\) composed of weights \(\theta\) can be divided into the inner loop and outer loop in the process of maml meta learning training. In the inner loop process, when adapting to new tasks \(\mathcal{D}_{i}^{sup}\), the neural network uses the cross entropy loss function \(\mathcal{L}\Big{(}\theta,\ \mathcal{D}_{i}^{sup}\Big{)}\) for each classification task and uses the gradient descent method to update the neural network weight \(\theta\) to the weight \(\theta^{\prime}\), as shown in Formulas (3) and (4). Note that the weight \(\theta^{\prime}\) update process occurs in each classification task and does not change the weight parameters of the external network model. \[\mathcal{L}\left(\theta,\ \mathcal{D}_{i}^{sup}\right)=\sum_{x^{j},y^{j}\sim \mathcal{D}_{i}^{sup}}y^{j}\log f_{1\theta}\left(x^{j}\right) \tag{3}\]  
\[\theta^{\prime}_{i}\leftarrow\theta-\alpha_{1}\
abla_{\theta}\mathcal{L}\left( \theta,\ \mathcal{D}_{i}^{sup}\right) \tag{4}\]  
\(\mathcal{D}_{i}^{sup}\) is a classification task in the support set dataset; \(x^{j},y^{j}\) is a pair of input and output data in \(\mathcal{D}_{i}^{sup}\); and \(\alpha_{1}\) is the super parameter inner loop learning rate. During the outer loop process, the weight of the neural network \(f_{1}(\theta)\) needs to be reset for each classification task \(\mathcal{D}_{i}^{qu}\) as follows: \(\theta^{\prime}_{i}\). For each classification task \(\mathcal{D}_{i}^{qu}\), the cross entropy loss function \(\mathcal{L}(\theta^{\prime}_{i},\ \mathcal{D}^{qu})\) is still selected as shown in Formulas (5)-(\(\mathcal{D}\)), and the gradient descent method is used to update the neural network weight \(\theta\). At this point, an iteration is completed. \[\mathcal{L}\left(\theta^{\prime}_{i},\ \mathcal{D}_{i}^{qu}\right)=\sum_{x^{j},y ^{j}\sim\mathcal{D}_{i}^{qu}}y^{j}\log f_{1\theta^{\prime}_{i}}\left(x^{j}\right) \tag{5}\]  
Figure 4: Weight update process under the Maml–Triplet training framework.