Traditional Chinese medicine water decoction taste evaluation method based on FTACV and machine learning
Through the method based on FTACV and machine learning, the harmonic component spectrum of the decoction of Chinese medicine water was extracted and the five elements convolutional neural network was constructed, which solved the problem of poor accuracy and reliability of the decoction of Chinese medicine water, and achieved high accuracy and ability Repeat taste evaluation.
Patent Information
- Application Number
- CN202411477876.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-02-18
AI Technical Summary
The accuracy and reliability of the taste detection results of the traditional Chinese medicine decoction liquid in the prior art are poor, and the data processing is complicated.
Using the taste evaluation method of Chinese medicine decoction liquid based on FTACV and machine learning, the original time domain spectrum of FTACV is obtained using a three-electrode system, and the harmonic component spectrum is extracted through Fourier transformation and normalization processing, and a five-element convolutional neural network is constructed for Data processing to obtain the five flavor prediction values of traditional Chinese medicine samples.
It improves the accuracy, reliability and repeatability of taste detection of Chinese medicine decoction liquid, avoids the influence of human factors, and reduces the detection cost.
Smart Images

Figure CN119470577A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of bionic sensors and machine learning, and in particular to a method for evaluating the taste of a traditional Chinese medicine decoction. Background Art
[0002] The origin of flavor dates back to the Western Zhou Dynasty. The theory of "five flavors" and its matching and efficacy were produced from the Spring and Autumn Period to the Western Han Dynasty. The theory of "five flavors" was applied to the field of traditional Chinese medicine in the Eastern Han Dynasty and was widely developed in the Sui and Tang Dynasties. The theoretical system of "five flavors" of traditional Chinese medicine was constructed in the Song, Jin and Yuan Dynasties. Formulating prescriptions based on flavors is an important formula composition methodology from the traditional Chinese medicine classic "Tangye Jingfa". The analysis of the five flavors of traditional Chinese medicine is of great significance for a deep understanding of the principles of traditional Chinese medicine compatibility and the methodology of prescription science.
[0003] At present, the following technologies are mainly used for the five flavors analysis of traditional Chinese medicine: 1) Oral tasting method, in which volunteers taste Chinese medicine slices, decoctions, and oral liquids to give taste evaluations. The disadvantage is that it is not suitable for unknown samples or toxic samples, and the results are highly subjective. 2) Gas chromatography-mass spectrometry method, which uses gas chromatography to separate the volatile active ingredients in traditional Chinese medicine and analyze and evaluate them. It has the advantages of small sample usage and high detection sensitivity. Its disadvantage is that the detection equipment is large and expensive, and it cannot be detected online. 3) Biosensor method, generally, taste bud cell tissues, cell membranes, receptors, etc. are made into biosensors, and the chemical sensing signals of the organism to the outside world are converted into electrical signals or optical signals. This method has the advantages of high sensitivity and strong specificity. Its disadvantage is that biosensors cannot be prepared in large quantities due to the limitation of cell tissue sources, and biosensors have short service life, narrow analysis range, and harsh detection conditions. 4) Bionic sensing method, generally using electronic nose or electronic tongue to evaluate the taste of traditional Chinese medicine, the advantage is that the overall smell of traditional Chinese medicine is the research object, the evaluation is fast, it can be used for unknown samples or toxic samples, and it is safer and more reliable than the oral tasting method. Its disadvantage is that in the process of taste evaluation, the electronic nose and electronic tongue sensor array need to be calibrated with a standard solution to obtain the taste response signal of the reference sample, and must be used in conjunction with accurate qualitative or quantitative analysis instruments to complete the detection and evaluation of the sample.
[0004] Traditional taste analysis methods usually rely on manual evaluation. In addition, electronic noses and electronic tongues, as important representatives of modern sensing technology, have also been widely used in the field of taste analysis. These devices rely on sensor arrays to detect and analyze complex chemical information. However, although sensor arrays have made significant progress in improving detection accuracy and sensitivity, there are still some defects that cannot be ignored in practical applications.
[0005] First, during long-term use, the sensor array may experience signal drift, that is, the output signal of the sensor deviates from its initial calibration value over time. This phenomenon will affect the accuracy and reliability of the detection results. Therefore, the sensor array needs to be calibrated regularly during use to ensure its accuracy and stability. However, due to the complexity and diversity of the sensor array, the calibration process may become difficult and time-consuming. Secondly, in the sensor array, different detection units may affect each other due to physical proximity, chemical cross-reaction or electromagnetic interference. This mutual interference will cause the sensor response to be unstable, thereby affecting the accuracy of the detection results. Finally, multiple sensors in the sensor array may detect the same or similar chemical information, resulting in data redundancy. Data redundancy not only increases the complexity of data processing, but also may lead to a waste of computing resources. Summary of the invention
[0006] In view of the technical problems that the detection results of the taste of traditional Chinese medicine decoction in the prior art are poor in accuracy and reliability and the data processing is complicated, the present invention proposes a method for evaluating the taste of traditional Chinese medicine decoction based on FTACV and machine learning. By using a more cost-effective three-electrode system instead of the sensor array of the electronic nose and electronic tongue as a bionic sensor, and using Fourier transform alternating current voltammetry (FTACV) as a signal acquisition method, and adopting a neural network model for data processing, the accuracy, reliability and repeatability of the detection are effectively improved.
[0007] In order to achieve the above object, the technical solution of the present invention is implemented as follows: a method for evaluating the taste of Chinese herbal decoction based on FTACV and machine learning, comprising the following steps:
[0008] S1: Obtain the Chinese medicine sample to be tested, and use the three-electrode system to obtain the FTACV original time domain spectrum of the Chinese medicine sample to be tested;
[0009] S2: Use Fourier transform alternating current voltammetry to process the original FTACV time domain spectrum and extract the harmonic component spectrum used to represent the information of the Chinese medicine sample to be tested;
[0010] S3: preprocessing the harmonic component spectrum using normalization method;
[0011] S4: Construct a five-element convolutional neural network, input the preprocessed harmonic component spectrum into the five-element convolutional neural network for calculation, and obtain the five-flavor prediction values corresponding to the tested Chinese medicine sample.
[0012] In the three-electrode system, the working electrode is a platinum sheet electrode, the counter electrode is a platinum column electrode, and the reference electrode is an Ag / AgCl electrode; when acquiring the FTACV original time domain spectrum, cyclic voltammetry is used to perform a two-stage potential scan, and a curve of current versus scanning voltage is recorded as the FTACV original time domain spectrum of the traditional Chinese medicine sample to be tested.
[0013] The method for data processing of the original time domain spectrum of FTACV described in step S2 is: perform Fourier transform on the original time domain spectrum of FTACV of the Chinese medicine sample to be tested to obtain the frequency domain spectrum X[k]; square the modulus of the frequency domain spectrum to obtain the power spectrum P[k], and the power spectrum P[k] contains the fundamental frequency to sixth harmonic components of the current; interpolate and smooth the power spectrum P[k] and then perform inverse Fourier transform to obtain the time domain spectrum of the fundamental frequency to the sixth harmonic of the current; fold and scale the time domain spectrum of the fundamental frequency to the sixth harmonic of the current to obtain the component spectrum of the fundamental frequency to the sixth harmonic of the current for representing the information of the Chinese medicine sample to be tested.
[0014] The calculation formula of the frequency domain spectrum X[k] is:
[0015]
[0016] Among them, x[n] represents the discrete time series corresponding to the original time domain spectrum of FTACV, N is the sequence length, i represents the imaginary unit, and k is the frequency index;
[0017] The calculation formula for the time domain spectrum from the fundamental frequency to the sixth harmonic of the current is:
[0018]
[0019] The folding and scaling operations are as follows: taking a negative value for the current value corresponding to the second stage scan in the time domain spectrum from the fundamental frequency to the sixth harmonic of the current, merging the two-stage data into a continuous data, and then pairing the voltage and current according to time to obtain the fundamental frequency to the sixth harmonic components respectively, scaling the fundamental frequency to the sixth harmonic components respectively so that the signal strength is between -1 and 1, and obtaining the component spectrum from the fundamental frequency to the sixth harmonic of the current.
[0020] The method for preprocessing the harmonic component spectrum using the normalization method is: preprocessing the harmonic component spectrum using the normalization method that takes into account the data center trend and distribution range and controls the scaling and offset degree based on the sigmoid function, and the specific steps are:
[0021] 3.1. Calculate statistics: Represent the component spectrum from the fundamental frequency to the sixth harmonic of the current as 6 one-dimensional arrays, each one-dimensional array is x. First, calculate the mean value x of the data in each one-dimensional array x. mean , maximum value x max and the minimum value xmin ;
[0022] 3.2. Determine the range: Calculate the half range x of the data range in the one-dimensional array x div ;
[0023] 3.3. Calculate the scale factor: Based on the half range x div Calculate the scale factor scalor with given parameters α and β;
[0024] 3.4. Calculate the bias term: Based on the mean x mean The bias term bias is calculated relative to the position of the parameter β; if the mean x mean Greater than The bias term bias is positive; if the mean x mean Less than Then the bias term bias is negative, otherwise it is 0;
[0025] 3.5. Data normalization: If the half range x div If it is not 0, the one-dimensional array x is normalized;
[0026] After normalization, the input data F0 is obtained.
[0027] The formula for calculating the scale factor scalor is:
[0028]
[0029] The formula for calculating the bias term is:
[0030]
[0031] The normalization formula is:
[0032]
[0033] The five-row convolutional neural network includes an input layer, a five-row convolutional layer, a five-row weight layer, a PReLU layer, an average pooling layer, an embedding layer, a Transformer encoder layer, a fully connected layer and an output layer connected in sequence;
[0034] The five-line convolution layer consists of five fixed five-line convolution kernels, each of which is constructed based on sine waves and time series.
[0035] The method of inputting the preprocessed harmonic component spectrum into the five-line convolutional neural network for calculation in step S4 is: using the input layer to obtain input data F0, using the five-line convolutional layer to calculate the time series data F of each channel in the input data F0 0jExpand the data 5 times in sequence to extract the five-line attributes, j = {1, 2, 3, 4, 5, 6}, and obtain the output data F corresponding to each channel 1j ; Use the five-element weight layer to output the data F 1j Extract the time series data with the largest weight, and add the feature offset based on five rows after the time series data with the largest weight to obtain the output data F 2j , all output data F 2j The output data F2 is combined; the PReLU layer is used to increase the nonlinear expression ability of the network through parameterized rectified linear units to obtain the output data F3; the average pooling layer is used to reduce the spatial dimension of the output data F3 while retaining the most important feature information to obtain the output data F4; the embedding layer is used to map the pooled output data F4 to a higher dimensional space to capture higher-level abstract features to obtain the output data F5; the Transformer encoder layer is used to process the output data F5 through the self-attention mechanism to enhance the model's ability to capture long-distance correlations in the input data; the fully connected layer is used to map the features extracted by the Transformer encoder layer to the space required for the classification task; the output layer uses the output layer to output the five-flavor classification results according to the output data of the fully connected layer, including the probability values of sour, bitter, sweet, pungent, and salty corresponding to the Chinese medicine samples.
[0036] The method to construct the five-element convolution kernel is: define the sine wave function: Where x = 0, 1, 2…, m, a total of m points, m is divisible by 5, divide these m y values into 5 equal parts, and get 5 convolution kernels. Each convolution kernel is a one-dimensional array with a total of m / 5 real elements.
[0037] The beneficial effects of the present invention are:
[0038] 1. Using FTACV spectrum acquisition technology, the electrochemical characteristic data of Chinese medicine decoction can be quickly and accurately obtained, laying the foundation for subsequent machine learning analysis. Compared with the traditional manual tasting method, this method is more objective and quantitative, avoiding the influence of human factors.
[0039] 2. The neural network model is used for machine learning analysis, which can effectively extract the features related to the five flavors in the FTACV spectrum and realize the automatic classification and recognition of the taste of Chinese herbal decoctions. This data-driven intelligent analysis method greatly improves the accuracy and repeatability of the taste evaluation of Chinese herbal decoctions.
[0040] 3. Compared with the electronic nose and electronic tongue technology, the invention uses the FTACV spectrum with the following advantages: no complex sensor array is required, the test uses commercial electrodes with stable performance and low cost; it can more accurately capture the electrochemical characteristics of Chinese medicine decoctions and provide a richer source of information; the training and optimization of machine learning models are more controllable, and the prediction accuracy is higher.
[0041] 4. This invention provides a new technical means for the quality control and standardization of traditional Chinese medicine, which is helpful to promote the modernization of the traditional Chinese medicine industry. Through automated and intelligent taste analysis, the properties of traditional Chinese medicine can be better evaluated, providing a scientific basis for the compatibility and use of traditional Chinese medicine. This invention has a good application prospect in the field of taste analysis of traditional Chinese medicine decoctions, and provides innovative technical support for the research and industrial development of traditional Chinese medicine. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 Flow chart of the method of the present invention.
[0044] Figure 2 This is a structural diagram of the five-element convolutional neural network of the present invention.
[0045] Figure 3 This is the original data chart of FTACV of the Chinese herbal medicine lily decoction.
[0046] Figure 4 This is the power spectrum of the FTACV data of the Chinese herbal medicine lily after Fourier transformation.
[0047] Figure 5 This is the time domain spectrum of the FTACV fundamental frequency inverse Fourier transform of the Chinese herbal medicine lily decoction.
[0048] Figure 6 This is the FTACV fundamental frequency component spectrum of the Chinese herbal medicine lily decoction.
[0049] Figure 7 This is the FTACV spectrum of the fundamental frequency to the sixth harmonic components of the Chinese herbal medicine lily decoction. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] A method for evaluating the taste of traditional Chinese medicine decoction based on FTACV and machine learning, such as Figure 1 As shown, the steps include:
[0052] S1: Obtain the Chinese medicine sample to be tested, and use the three-electrode system to obtain the FTACV original time domain spectrum of the Chinese medicine sample to be tested.
[0053] Obtain the Chinese medicine sample to be tested (this embodiment takes the Chinese medicine decoction of lily as an example): Prepare the sample to be tested, i.e., the Chinese medicine decoction, by weighing 3.3 g of the Chinese medicine decoction into a 150 ml conical flask, soaking it in 100 ml of deionized water for 30 min, heating and boiling it for 30 min, letting it stand and cool, and then filtering to remove the residue for standby use.
[0054] Experimental preparation: including a three-electrode system: the working electrode is a platinum sheet electrode, the counter electrode is a platinum column electrode, and the reference electrode is an Ag / AgCl electrode; a CHI electrochemical workstation is used, which includes an electrolytic cell and a magnetic stirrer;
[0055] Use a pipette to transfer 40 ml of the Chinese medicine sample to be tested into the electrolytic cell. Install the working electrode, reference electrode and auxiliary electrode in the electrolytic cell, and make sure they are in the correct position and not short-circuited. Use an alligator clip or BNC connector to connect the working electrode to the "Working Electrode" port of the electrochemical workstation; use a dedicated wire to connect the reference electrode to the "Reference Electrode" port; use an alligator clip or a BNC connector to connect the auxiliary electrode to the "AuxiliaryElectrode" port; place the electrolytic cell on a magnetic stirrer, put a magnet in the electrolytic cell, turn on the magnetic stirrer, and adjust the stirring speed to stir the solution evenly; turn on the electrochemical workstation, set the starting voltage to 0.5V, the ending voltage to -0.5V, the frequency to 50HZ, and the amplitude to 0.1V (the range is adjusted according to different samples, ranging from 0.001 to 0.5V), use Fourier transform cyclic voltammetry to perform two-stage potential scanning, and test each sample 4 times in parallel for subsequent classification and detection of the taste of traditional Chinese medicine. Record the curve of current versus scanning voltage as the original time domain spectrum of the tested traditional Chinese medicine sample FTACV, and save the results in a csv format file.
[0056] S2: Use Fourier transform alternating current voltammetry to process the original FTACV time domain spectrum and extract the harmonic component spectrum used to represent the information of the Chinese medicine sample to be tested.
[0057] First, taking the Chinese medicine decoction of lily as an example, the original time domain spectrum of FTACV of the Chinese medicine sample to be tested (such as Figure 3 ) is Fourier transformed to obtain the power spectrum. Figure 4 As shown, the power spectrum can show the composition of the fundamental frequency and the harmonics.
[0058] The original time domain spectrum of the tested traditional Chinese medicine sample FTACV is a discrete time series with a length of N, represented by x[n]. The frequency domain spectrum X[k] is obtained by discrete Fourier transform, and the formula is:
[0059]
[0060] X[k] represents the complex value of the signal at the kth frequency component, k is the frequency index ranging from 0 to N-1, i represents the imaginary unit, the real part represents the amplitude of the kth frequency component of the signal, and the imaginary part represents the phase information of the kth frequency component of the signal.
[0061] Squaring the modulus of the frequency domain spectrum gives the power spectrum P[k]:
[0062]
[0063] According to the power P[k]) and phase information of the signal at the kth frequency component, the power spectrum can be subjected to inverse Fourier transform to obtain time series data. In order to make the result of inverse Fourier transform more reliable, the power spectrum P[k] is first interpolated and smoothed, which can be used to fill in missing data points and remove noise, and then inverse Fourier transform is performed:
[0064]
[0065] right Figure 4 By performing inverse Fourier transform on the fundamental frequency and harmonic frequency regions in the signal, harmonic components of different time scales can be obtained. After Fourier and inverse Fourier transform, different types of current signals are separated from the total current signal. The current of the high-order harmonic (harmonic frequency) component is not sensitive to the background charge and discharge process, that is, the directional movement process of ions in the electrolyte solution in the electric field during three-electrode detection, but is more sensitive to the electron transfer process on the two-phase interface, that is, the electron transfer process between the electrode and the sample adsorbed on the electrode during three-electrode detection, which can better reflect the electrochemical characteristics of the sample being tested and is not affected by the electrochemical reaction rate.
[0066] Figure 5 Yes Figure 4The time domain spectrum obtained after the inverse Fourier transform of the mid-base frequency region. In addition, considering that the potential scan when obtaining the original FTACV time domain spectrum is divided into two stages, the first stage is the scan from the starting potential to the ending potential, and the second stage is the scan from the ending potential to the starting potential. The two stages are in opposite phases, and the current response in the second stage is usually opposite to that in the first stage. Therefore, Figure 5 In the time domain spectrum of , the current in the second stage should be taken as its negative value, that is, the time domain spectrum is folded, specifically, the current value corresponding to the time t>128s in the time domain spectrum is taken as a negative value, so as to merge the two stages of data into a continuous data. Then the voltage (V) and current (I) are paired according to time to obtain Figure 6 , Figure 6 yes Figure 5 The fundamental frequency component spectrum after the time domain spectrum is folded. From t=0s to t=128s (the first stage), the voltage drops linearly from 0.5V to -0.5V, and from t=128s to t=256s (the second stage), the voltage rises linearly from -0.5V to 0.5V.
[0067] After the same operation on the high-order harmonic region, the high-order harmonic region in the power spectrum can be inverse Fourier transformed to obtain the high-order harmonic components. Because the subsequent machine learning is based on normalized data, the fundamental frequency and 2x to 6x harmonic component spectra are scaled so that the signal strength is between -1 and 1. The scaled component spectra of each high-order harmonic are as follows: Figure 7 shown.
[0068] S3: Use the normalization method to preprocess the harmonic component spectrum.
[0069] According to the characteristics of the harmonic component spectrum data of the Chinese medicine sample information to be tested, a custom normalization method is used to process the one-dimensional data group x (a one-dimensional array represents a set of current I values in a harmonic component, and a channel represents a harmonic component). The custom normalization method takes into account the central trend (mean) and distribution range (half the difference between the maximum and minimum values) of the data, and controls the degree of scaling and offset based on the sigmoid function. This normalization method can make the data more stable and enable data with different distributions to be suitable for subsequent five-row convolution operations.
[0070] The specific steps are:
[0071] 3.1. Calculate statistics: Represent the component spectrum from the fundamental frequency to the sixth harmonic of the current as 6 one-dimensional arrays, each one-dimensional array is x, and first calculate the mean x of each one-dimensional array x mean , maximum value x max and the minimum value x min .
[0072] 3.2. Determine the range: Calculate the half range x of the data range in the one-dimensional array x div , which is half the difference between the maximum and minimum values.
[0073] 3.3. Calculate the scale factor: Based on the half range x div And given parameters α, β to calculate the scale factor scalor. The calculation of the scale factor is based on the sigmoid function, which adjusts the degree of scaling according to the distribution range of the data. The formula is:
[0074]
[0075] 3.4. Calculate the bias term: Based on the mean x mean The position relative to the parameter β determines the bias term bias. If the mean x mean Greater than The bias is positive; if the mean x mean Less than The bias is negative; otherwise it is 0. The formula is:
[0076]
[0077] 3.5. Data normalization: If the half range x div If it is not 0, the input array x is normalized. The formula is:
[0078]
[0079] If the half range x div If it is 0, it means that all the data are the same and the data is meaningless, then the result is set to None, indicating that the normalization operation cannot be performed. After normalization, the input data F0 is obtained.
[0080] S4: Construct a five-element convolutional neural network, input the preprocessed harmonic component spectrum into the five-element convolutional neural network for calculation, and obtain the five-flavor prediction values corresponding to the tested Chinese medicine sample.
[0081] The custom five-element convolutional neural network of the present invention is a deep learning model designed specifically for processing FTACV signal data (harmonic component spectrum of the Chinese medicine sample information to be tested). The network uses a series of innovative components to improve its ability to understand the input data. The following is a detailed description of the network structure, including the data shape changes at each step.
[0082] Five-element convolutional neural network: including the sequentially connected input layer, five-element convolution layer, five-element weight layer, PReLU layer, average pooling layer, embedding layer, Transformer encoder layer, fully connected layer and output layer;
[0083] The five-line convolution layer consists of five fixed five-line convolution kernels, each of which is constructed based on sine waves and time series;
[0084] The construction method is: Define the sine wave function: Where x = 0, 1, 2..., 64, a total of 65 points, these 65 y values are divided into 5 equal parts to get 5 convolution kernels. Each five-row convolution kernel is a one-dimensional array with a total of 13 real number elements. These five-row convolution kernels slide on the input data to extract different features;
[0085] The fully connected layer includes fully connected layer 1, fully connected layer 2, fully connected layer 3, and fully connected layer 4 which are linked in sequence;
[0086] Calculation process:
[0087] There are 6 one-dimensional arrays x in the input data of a sample, corresponding to the fundamental frequency to the sixth harmonic, that is, imput_channels = 6; each one-dimensional array x has 256 elements, that is Figure 7 The curve of the medium current I has 256 points in total, that is, input_dim=256.
[0088] In the input layer, the input data is F0, and the shape is (batch_size, input_channels, input_dim), batch_size is the batch size, which is 32, and input_channels is the number of input channels, which is 6, indicating 6 time series. The time series of each channel is defined as F 0j , the shape is (batch_size, 1, input_dim), j = {1, 2, 3, 4, 5, 6}, which respectively represent the fundamental frequency and the second to sixth harmonic components obtained by FTACV data processing, input_dim is the input dimension, which indicates the sequence length, and takes 256, which means that each harmonic component consists of 256 points, where each point is a current data;
[0089] In the five convolutional layers, five convolution kernels are applied to a time series F at a time. i Slide up to perform convolution operation to extract different features. After convolution, the time series data of each channel is expanded to 5 times of the original, corresponding to the extracted five rows of attributes; the data shape of the convolution kernel is (output_channels=5, input_channels=1, kernel_size=13), the kernel size kernel_size value is 5, and the output data corresponding to each operation is F 1j, j = {1,2,3,4,5,6}, the shape is (32,5,256); the output of the five-row convolutional layer is represented as F1, the shape is (32,25,256), and the five-row convolutional layer can only operate on one channel at a time;
[0090] In the five-element weight layer, the five-element weight layer will compress the size of the five-element convolution layer output data to the size of the input. The specific method is: calculate each output data F 1j The five-row weights are obtained from the output data F 1j The time series data with the largest weight is selected as the output of the channel. The previous data is expanded by 5 times. The most relevant group is selected from the five times. The most relevant data of size 256 is selected from the data of size 5*256. A feature offset based on five elements is added to the selected result. For each channel, the output data obtained from the five-element weight layer is F 2j , j = {1,2,3,4,5,6}, the shape is compressed to (32,1,256). The output of the final five-row weight layer is represented as F2, with a shape of (32,5,256). The five-row weight layer can only operate on one channel;
[0091] In the PReLU layer, a parametric rectified linear unit is introduced to increase the nonlinear expression ability of the network, which helps the network learn more complex feature representations. The input and output shapes of the PReLU layer are both (32, 5, 256), and the output data is represented as F3.
[0092] The calculation formula of PReLU is as follows:
[0093] f(x)=max(0,x)+amin(0,x)
[0094] Among them, x is the input, that is, the output representation F2 of the five-element weight layer, and a is a learnable parameter.
[0095] In the average pooling layer, this layer reduces the spatial dimension of the output data F3 by average pooling while retaining the most important feature information, thereby reducing computational complexity and preventing overfitting. The pooling kernel size is 2, the stride is 2, and the output data after pooling is F4, and the shape becomes (32,5,128).
[0096] In the embedding layer: The embedding layer maps the pooled output data F4 to a higher dimensional space to capture higher-level abstract features. This layer maps the data from size (32, 5, 128) to size (32, 128, 1024), the default value of d_model is 1024, and the output data of the embedding layer is represented as F5;
[0097] In the Transformer encoder layer, the self-attention mechanism in the Transformer architecture is used to capture the global dependencies in the output data F5. The Transformer encoder uses a multi-head attention mechanism and a feedforward neural network to enhance the model's ability to capture long-range dependencies in the input data. The output data is F6, and the shape remains unchanged.
[0098] In the fully connected layer: the four fully connected layers are responsible for further mapping the features extracted by the transformer encoder layer to the space required for the classification task. After the output data F5 output by the transformer encoder layer passes through the fully connected layer 1, the data shape becomes (32,512). After passing through the subsequent fully connected layer 2 and fully connected layer 3, the data shape remains unchanged. In the fully connected layer 4, the output tensor F6 is obtained, and the shape is (batch_size, num_classes = 5).
[0099] At the output layer, the Sigmoid activation function is used on the output tensor F6 to generate probability estimates for each category, and the final output vector F7 is obtained, with a shape of (batch_size, num_classes = 5), where num_classes represents the number of categories. The final output tensor F7 is output. For the five-flavor classification task, this will generate 5 probability values, corresponding to the probability values of sour, bitter, sweet, pungent, and salty.
[0100] Neural network training: To increase the randomness of neural network training, data shuffling was enabled and the batch size (Bachsize=32). During the neural network training process, the loss function was binary cross entropy loss (BCELoss), and ASGD (averaged stochastic gradient descent) was selected as the optimizer, and the learning rate (LR=0.001) was set. A learning rate scheduler (StepLR) was also created, which adjusts the learning rate at each specified step size (step_size=20) and multiplies it by a decay factor (gamma=0.9). In the training loop, the specified number of training rounds (num_epochs=400) was traversed. In each round, all batches of data in the data loader were traversed, the input and label were moved to the computing device, and then forward propagation, loss calculation, backpropagation and optimization steps were performed. The loss of each batch was counted, and the learning rate was updated after each round. To prevent overfitting, an early stopping mechanism (early stopping=100) was implemented. If the loss does not decrease in several consecutive rounds of training, the training will be stopped and the current best performing model weights will be saved.
[0101] Evaluation of the neural network model: Using a variety of Chinese medicine decoctions or mixture solutions such as Xiaoxiepi Decoction as input samples, and using 12 volunteers' oral evaluations as output labels, the neural network model optimized by the present invention predicted the taste of multiple samples, with a success rate of about 90%. As shown in Table 1, the oral taste of some Chinese medicine decoctions included in the "Fuxing Jue" is compared with the FTACV prediction results. Table 1 ignores the taste probability with a predicted value lower than 0.01.
[0102] Table 1.
[0103]
[0104]
[0105]
[0106]
[0107] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for evaluating the taste of Chinese herbal decoction based on FTACV and machine learning, characterized in that: The following steps are involved: S1: Obtain the Chinese medicine sample to be tested, and use the three-electrode system to obtain the FTACV original time domain spectrum of the Chinese medicine sample to be tested; S2: Use Fourier transform alternating current voltammetry to process the original FTACV time domain spectrum and extract the harmonic component spectrum used to represent the information of the Chinese medicine sample to be tested; S3: preprocessing the harmonic component spectrum using normalization method; S4: Construct a five-element convolutional neural network, input the preprocessed harmonic component spectrum into the five-element convolutional neural network for calculation, and obtain the five-flavor prediction values corresponding to the tested Chinese medicine sample.
2. The method for evaluating the taste of Chinese herbal decoction based on FTACV and machine learning according to claim 1, characterized in that: In the three-electrode system, the working electrode is a platinum sheet electrode, the counter electrode is a platinum column electrode, and the reference electrode is an Ag / AgCl electrode; when acquiring the FTACV original time domain spectrum, cyclic voltammetry is used to perform a two-stage potential scan, and a curve of current versus scanning voltage is recorded as the FTACV original time domain spectrum of the traditional Chinese medicine sample to be tested.
3. The method for evaluating the taste of Chinese herbal decoction based on FTACV and machine learning according to claim 2, characterized in that: The method for data processing of the original time domain spectrum of FTACV described in step S2 is: perform Fourier transform on the original time domain spectrum of FTACV of the Chinese medicine sample to be tested to obtain the frequency domain spectrum X[k]; square the modulus of the frequency domain spectrum to obtain the power spectrum P[k], and the power spectrum P[k] contains the fundamental frequency to sixth harmonic components of the current; interpolate and smooth the power spectrum P[k] and then perform inverse Fourier transform to obtain the time domain spectrum of the fundamental frequency to the sixth harmonic of the current; fold and scale the time domain spectrum of the fundamental frequency to the sixth harmonic of the current to obtain the component spectrum of the fundamental frequency to the sixth harmonic of the current for representing the information of the Chinese medicine sample to be tested.
4. The method for evaluating the taste of Chinese herbal decoction based on FTACV and machine learning according to claim 3, characterized in that: The calculation formula of the frequency domain spectrum X[k] is: Among them, x[n] represents the discrete time series corresponding to the original time domain spectrum of FTACV, N is the sequence length, i represents the imaginary unit, and k is the frequency index; The calculation formula for the time domain spectrum from the fundamental frequency to the sixth harmonic of the current is:
5. The method for evaluating the taste of Chinese herbal decoction based on FTACV and machine learning according to claim 4, characterized in that: The folding and scaling operations are as follows: taking a negative value for the current value corresponding to the second stage scan in the time domain spectrum from the fundamental frequency to the sixth harmonic of the current, merging the two-stage data into a continuous data, and then pairing the voltage and current according to time to obtain the fundamental frequency to the sixth harmonic components respectively, scaling the fundamental frequency to the sixth harmonic components respectively so that the signal strength is between -1 and 1, and obtaining the component spectrum from the fundamental frequency to the sixth harmonic of the current.
6. The method for evaluating the taste of Chinese herbal decoction based on FTACV and machine learning according to claim 5, characterized in that: The method for preprocessing the harmonic component spectrum using the normalization method is: preprocessing the harmonic component spectrum using the normalization method that takes into account the data center trend and distribution range and controls the scaling and offset degree based on the sigmoid function, and the specific steps are: 3.
1. Calculate statistics: The component spectrum from the fundamental frequency to the sixth harmonic of the current is represented as 6 one-dimensional arrays, each one-dimensional array is x, and the mean value x of the data in each one-dimensional array x is first calculated. mean , maximum value x max and the minimum value x min ; 3.
2. Determine the range: Calculate the half range x of the data range in the one-dimensional array x div ; 3.
3. Calculate the scale factor: Based on the half range x div Calculate the scale factor scalor with given parameters α and β; 3.
4. Calculate the bias term: Based on the mean x mean The bias term bias is calculated relative to the position of the parameter β; if the mean x mean Greater than The bias term bias is positive; if the mean x mean Less than Then the bias term bias is negative, otherwise it is 0; 3.
5. Data normalization: If the half range x div If it is not 0, the one-dimensional array x is normalized; After normalization, the input data F0 is obtained.
7. The method for evaluating the taste of Chinese herbal decoction based on FTACV and machine learning according to claim 6, characterized in that: The formula for calculating the scale factor scalor is: The formula for calculating the bias term is: The normalization formula is:
8. The method for evaluating the taste of Chinese herbal decoction based on FTACV and machine learning according to any one of claims 1 to 7, characterized in that: The five-row convolutional neural network includes an input layer, a five-row convolutional layer, a five-row weight layer, a PReLU layer, an average pooling layer, an embedding layer, a Transformer encoder layer, a fully connected layer and an output layer connected in sequence; the five-row convolutional layer is composed of five fixed five-row convolutional kernels, and each five-row convolutional kernel is constructed based on a sine wave and a time series.
9. The method for evaluating the taste of Chinese herbal decoction based on FTACV and machine learning according to claim 8, characterized in that: The method of inputting the preprocessed harmonic component spectrum into the five-line convolutional neural network for calculation in step S4 is: using the input layer to obtain input data F0, using the five-line convolutional layer to calculate the time series data F of each channel in the input data F0 0j Expand the data 5 times in sequence to extract the five-line attributes, j = {1, 2, 3, 4, 5, 6}, and obtain the output data F corresponding to each channel 1j ; Use the five-element weight layer to output the data F 1j Extract the time series data with the largest weight, and add the feature offset based on five rows after the time series data with the largest weight to obtain the output data F 2j , all output data F 2j The five flavors F3 are combined into output representation F2; the PReLU layer is used to increase the nonlinear expression ability of the network through parameterized rectified linear units to obtain output data F3; the average pooling layer is used to reduce the spatial dimension of the output data F3 while retaining the most important feature information to obtain output data F4; the embedding layer is used to map the pooled output data F4 to a higher dimensional space to capture higher-level abstract features to obtain output data F5; the Transformer encoder layer is used to process the output data F6 through the self-attention mechanism to enhance the model's ability to capture long-distance correlations in the input data; the fully connected layer is used to map the features extracted by the Transformer encoder layer to the space required for the classification task; the output layer uses the output layer to output the five-flavor classification results according to the output data of the fully connected layer, including the probability values of sour, bitter, sweet, pungent, and salty corresponding to the Chinese medicine samples.
10. The method for evaluating the taste of Chinese herbal decoction based on FTACV and machine learning according to claim 9, characterized in that: The method to construct the five-element convolution kernel is: define the sine wave function: Where x = 0, 1, 2…, m, a total of m points, m is divisible by 5, divide these m y values into 5 equal parts, and get 5 convolution kernels. Each convolution kernel is a one-dimensional array with a total of m / 5 real elements.
Citation Information
Cited By
Preparation method of traditional Chinese medicine compound medicine for treating rapid atrial fibrillation
CN120809099A