Research Article
Component Prediction of Antai Pills Based on One-Dimensional Convolutional Neural Network and Near-Infrared Spectroscopy
Algorithm 1
train the one-dimensional convolutional neural network with stochastic gradient descent.
| INPUT: samples: number of samples | | epochs: the training times of all training samples. | | b: the number of samples selected in one training session. | (1) | Initialize(net) | (2) | for epoch = 1; epoch ≤ epochs; epoch++ | (3) | for size = 1; size ≤ math.ceil(samples/b); size++ | (4) | spectral data ⟵ uniformly random sample b spectral data | (5) | analytes ← uniformly random sample b analytes | (6) | z ⟵ forward(net, spectral data) | (7) | l ⟵ loss(z, analytes) | (8) | grad ⟵ backward(l) | (9) | update(net, grad) | (10) | end for | (11) | end for |
|