Temperature compensation method and device of TMR sensor based on DOA-RBF
By applying a DOA-RBF-based method in TMR sensors, using the dandelion algorithm to quickly find the hyperparameters of radial basis neural networks, the problems of slow hyperparameter determination speed and low compensation accuracy in the prior art are solved, and high-precision temperature compensation is achieved.
Patent Information
- Application Number
- CN202410217664.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-27
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2044-02-27
AI Technical Summary
In the prior art, it is determined that the hyperparameter speed in RBFNN is slow and the compensation accuracy is low, which affects the temperature compensation effect of the TMR sensor.
Using the DOA-RBF-based method, the dandelion algorithm is used to quickly optimize the hyperparameters in the radial basis neural network, determine the global optimal solution of the radial basis neural network, and determine the target radial basis neural network through the S-fold cross-validation method.
It realizes the global optimal solution for the hyperparameters of radial basis neural networks quickly, and improves the temperature compensation accuracy of TMR sensors.
Smart Images

Figure CN118068237B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of temperature compensation of a tunneling magnetoresistance power sensor, and in particular to a method and device for temperature compensation of a TMR sensor based on DOA-RBF. Background Art
[0002] Among magnetic sensors, TMR (Tunneling Magneto-Resistance) sensors have the advantages of small size, low cost, and high spatial resolution. TMR sensors can support the testing of AC current and DC current with a frequency of up to 10MHz. From the monitoring of steady-state and transient currents of transmission lines, transformer cores, clamps, bushing end screens, insulator leakage current monitoring, distribution cabinet ground loop current monitoring, to high-precision measurement of smart meters and other scenarios, magnetic sensors have huge application space and prospects. Similarly, the application of TMR sensors has also been extended to the fields of biomedical testing and automobile navigation and positioning. Since the magnetoresistive element is composed of metal materials, the resistivity of most metal materials will be affected by temperature, that is, the resistance is dependent on temperature. Therefore, as the temperature changes, there are different voltage outputs under the same input signal, which has certain limitations on the application of the sensor. Temperature compensation must be performed for calibration to ensure the measurement accuracy of the sensor.
[0003] In existing research, there are two main methods for temperature compensation of sensors: one is analog domain compensation, which has a relatively complex circuit and has a less obvious effect on suppressing temperature drift; the other is digital domain compensation, which uses information fusion technology to reduce interference and achieve higher compensation accuracy. Moreover, this method does not involve the physical structure of the sensor, and the compensation method is simpler. The existing mainstream methods in digital domain compensation are numerical analysis methods and artificial intelligence algorithms. In traditional numerical analysis methods, due to its limited data fusion capability, there is a disadvantage of low compensation accuracy, which limits the application of high-precision measurement of sensors. In artificial intelligence algorithms, RBFNN (Radial Basis Function Neural Network) has the characteristics of simple structure, fast learning speed, excellent approximation performance and generalization ability, and can be used for temperature compensation of sensors. How to quickly determine the hyperparameters in RBFNN and ensure the accuracy of the network is a hot spot and difficulty, which has practical use value. Summary of the invention
[0004] In view of this, the present invention provides a TMR sensor temperature compensation method and device based on DOA-RBF to solve the problems of slow speed of determining hyperparameters in RBFNN and low compensation accuracy.
[0005] In a first aspect, the present invention provides a TMR sensor temperature compensation method based on DOA-RBF, the method comprising:
[0006] Initializing a population, wherein the data dimension of each individual in the population is determined by a hyperparameter of a radial basis neural network;
[0007] Obtain the output voltage value set and the corresponding temperature value set of the TMR sensor;
[0008] Dividing the output voltage value set and the corresponding temperature value set of the TMR sensor into a training set and a test set, training each radial basis neural network based on the training set and the test set, and obtaining output data of each radial basis neural network, wherein one individual in the population corresponds to one radial basis neural network;
[0009] Obtaining a fitness value of each individual in the population based on the output data;
[0010] The individual with the smallest current fitness value in the population is used as the global optimal solution of the radial basis neural network hyperparameters;
[0011] When the current iterative update number is less than the iterative update number threshold, iteratively updating the population;
[0012] Execute the step of training each radial basis neural network based on the training set and the test set based on the updated population;
[0013] When the current iterative update number is greater than or equal to an iterative update number threshold, obtaining a global optimal solution of the radial basis neural network hyperparameters applicable to the TMR sensor;
[0014] Based on the global optimal solution of the radial basis neural network hyperparameters, determining the target radial basis neural network by an S-fold cross validation method;
[0015] Obtaining an output voltage value of the TMR sensor and a temperature value of the TMR sensor;
[0016] The output voltage value and the temperature value are input into the target radial basis function neural network to obtain the magnetic field value of the compensated TMR sensor.
[0017] The embodiment of the present invention provides a TMR sensor temperature compensation method based on DOA-RBF, which uses the dandelion algorithm to quickly optimize the hyperparameters in the radial basis function neural network so as to quickly determine the global optimal solution of the hyperparameters in the radial basis function neural network, and the target radial basis function neural network determined based on the hyperparameters is used for the temperature compensation of the TMR sensor, achieving the effect of high compensation accuracy.
[0018] In an optional implementation, the neural network parameters of the radial basis neural network include: data center, expansion width, and weight and bias of the output layer;
[0019] The step of training each radial basis neural network based on the training set and the test set to obtain output data of each radial basis neural network includes:
[0020] Normalize the data of the training set and the test set;
[0021] Training each radial basis neural network based on the normalized training set and the test set, and obtaining output data of each radial basis neural network, wherein the data center of each radial basis neural network is determined based on the data of the normalized training set and the data of the test set, the expansion width of each radial basis neural network is determined based on the minimum distance between the data centers and the overlap coefficient in the hyperparameter, and the weight and bias of the output layer of each radial basis neural network are obtained by using the least squares method;
[0022] The step of performing the training of each radial basis neural network based on the training set and the test set based on the updated population includes:
[0023] The step of training each radial basis neural network based on the normalized training set and test set is performed based on the updated population.
[0024] In an optional implementation, the step of training each radial basis neural network based on the normalized training set and the test set to obtain output data of each radial basis neural network includes:
[0025] Training each radial basis neural network based on the normalized training set to obtain first output data of the radial basis neural network;
[0026] Training each radial basis neural network based on the normalized test set to obtain second output data of the radial basis neural network;
[0027] The obtaining the fitness value of each individual in the population based on the output data comprises:
[0028] Determine a mean square error of the training set and a mean square error of the test set based on the first output data and the second output data;
[0029] Based on the mean square error of the training set and the mean square error of the test set, a fitness value of each individual in the population is determined.
[0030] In an optional implementation, determining the mean square error of the training set and the mean square error of the test set based on the first output data and the second output data includes:
[0031] Inputting the first output data and the first standard data into a mean square error calculation model of a preset training set to obtain the mean square error of the training set;
[0032] The mean square error calculation model of the preset training set includes:
[0033]
[0034] Among them, MSE1 is the mean square error of the training set, S1 j is the first standard data of the jth training sample in the training set, S1' j is the first output data of the jth training sample in the training set, N1 is the number of training samples in the training set;
[0035] Inputting the second output data and the second standard data into a mean square error calculation model of a preset test set to obtain the mean square error of the test set;
[0036] The mean square error calculation model of the preset test set includes:
[0037]
[0038] Among them, MSE2 is the mean square error of the test set, S2 j is the second standard data of the jth test sample in the test set, S2' j is the second output data of the jth test sample in the test set, and N2 is the number of test samples in the test set.
[0039] In an optional implementation, determining the fitness value of each individual in the population based on the mean square error of the training set and the mean square error of the test set includes:
[0040] Inputting the mean square error of the training set and the mean square error of the test set into a preset individual fitness value calculation model to obtain the individual fitness value;
[0041] The fitness value calculation model of the preset individual includes:
[0042] f(X i )=0.8×MSE1 i +0.2×MSE2 i
[0043] Among them, f(X i ) is the fitness value of the i-th individual in the population, MSE1i is the mean square error of the radial basis neural network corresponding to the i-th individual in the training set, MSE2 i is the mean square error of the radial basis neural network corresponding to the i-th individual in the test set.
[0044] In an optional implementation, the iterative updating of the population includes:
[0045] Determine the weather conditions of the dandelion seeds during the rising phase based on random numbers and preset thresholds;
[0046] Determining a first position update result of the population based on the weather in which the dandelion seeds are located during the ascending phase;
[0047] determining an average position of the population based on a first position update result of the population;
[0048] Determining a second position update result of the population in a descending phase based on the average position of the population;
[0049] Determining a third position update result of the population during a landing phase based on the second position update result of the population;
[0050] The step of performing the training of each radial basis neural network based on the normalized training set and test set based on the updated population includes:
[0051] The step of training each radial basis neural network based on the normalized training set and test set is performed based on the third position update result of the population.
[0052] In an optional implementation, determining the weather of the dandelion seeds in the rising stage based on the random number and the preset threshold comprises:
[0053] When the random number is less than the preset threshold, it is determined that the weather in which the dandelion seeds are located during the rising stage is sunny;
[0054] When the random number is greater than or equal to the preset threshold, it is determined that the weather in which the dandelion seeds are located in the rising stage is rainy.
[0055] In an optional implementation, determining the first position update result of the population based on the weather in which the dandelion seeds are located during the ascending phase includes:
[0056] In the case that the weather in which the dandelion seeds are located during the ascending stage is sunny, the third position update result of the population at the t-th iteration, the randomly generated position in the search space in the t-th iteration, the adaptive parameter for adjusting the search step length, the lift coefficient and wind speed generated by the dandelion due to the separation vortex are input into a preset population first position update result calculation model to obtain the first position update result of the population;
[0057] The preset population first position update result calculation model includes:
[0058] X1 t+1 =X3 t +α×v x ×v y ×lnY×(X s -X3 t )
[0059] Among them, X1 t+1 is the first position update result of the population at the t+1th iteration, X3 t is the third position update result of the population at the tth iteration, α is the adaptive parameter for adjusting the search step length, and v x 、v y is the lift coefficient of the dandelion due to the separation vortex, lnY is the wind speed, X s represents the randomly generated position in the search space at the tth iteration;
[0060] In the case that the weather in which the dandelion seeds are located during the rising stage is rainy, the third position update result of the population at the t-th iteration and the parameters for adjusting the local search domain are input into a preset population first position update result calculation model to obtain the first position update result of the population;
[0061] The calculation model of the first position update result of the preset population includes:
[0062] X1 t+1 =X3 t ×k
[0063] Among them, X1 t+1 is the first position update result of the population at the t+1th iteration, X3 t is the third position update result of the population at the tth iteration, and k is a parameter for adjusting the local search domain.
[0064] In an optional implementation, determining the average position of the population based on the first position update result of the population includes:
[0065] Input the position of each individual in the first position update result of the population iteration t+1 and the number of individuals in the population into a preset population average position calculation model to obtain the average position of the population;
[0066] The average position calculation model of the preset population includes:
[0067]
[0068] Among them, X1 mean,t+1 represents the average position of the first position update result of the population in the t+1th iteration, N pop is the number of individuals in the population, X1 i Update the position of the i-th individual in the result for the first position of the population at iteration t+1.
[0069] In an optional implementation, determining the second position update result of the population in the descending phase based on the average position of the population includes:
[0070] Input the average position of the first position update result of the population's t+1th iteration, the adaptive parameter for adjusting the search step size, the Brownian motion random number that obeys the normal distribution, and the first position update result of the population's t+1th iteration into a preset population's second position update result calculation model to obtain the population's second position update result;
[0071] The second position update result calculation model of the preset population includes:
[0072] X2 t+1 =X1 t+1 -α×βr t+1 ×(X1 mean,t+1 -α×βr t+1 ×X1 t+1 )
[0073] Among them, X2 t+1 is the second position update result of the population at the t+1th iteration, X1 t+1 is the first position update result of the population at the t+1th iteration, α is the adaptive parameter for adjusting the search step length, X1 mean,t+1 represents the average position of the first position update result of the population in the t+1th iteration, βr t+1 is the Brownian motion random number that obeys the normal distribution in the t+1th iteration of the population.
[0074] In an optional implementation, determining a third position update result of the population in the landing phase based on the second position update result of the population includes:
[0075] Inputting the second position update result of the population, the global optimal solution of the current radial basis neural network hyperparameters, the Levy flight function, the adaptive parameter for adjusting the search step size, and the linear increasing function between [0, 2] into the third position update result calculation model of the preset population to obtain the third position update result of the population;
[0076] The calculation model of the third position update result of the preset population includes:
[0077] X3 t+1 =X elite +Levy( )×α×(X elite -X2 t+1 ×δ)
[0078] Among them, X3 t+1 is the third position update result of the population at the t+1th iteration, X2 t+1 is the second position update result of the population at the t+1th iteration, Levy() is the Levy flight function, α is the adaptive parameter for adjusting the search step length, and X elite is the global optimal solution of the current radial basis neural network hyperparameters, and δ is a linear increasing function between [0,2].
[0079] The embodiment of the present invention uses the dandelion algorithm to quickly optimize the hyperparameters in the radial basis function neural network, so as to quickly determine the global optimal solution of the hyperparameters in the radial basis function neural network, and the target radial basis function neural network determined based on the hyperparameters is used for temperature compensation of the TMR sensor, achieving the effect of high compensation accuracy.
[0080] In a second aspect, the present invention provides a TMR sensor temperature compensation device based on DOA-RBF, the device comprising:
[0081] A population initialization module, used for initializing a population, wherein the data dimension of each individual in the population is determined by a hyperparameter of a radial basis neural network;
[0082] A sample acquisition module, used to acquire an output voltage value set and a corresponding temperature value set of the TMR sensor;
[0083] an output data acquisition module, used to divide the output voltage value set and the corresponding temperature value set of the TMR sensor into a training set and a test set, train each radial basis neural network based on the training set and the test set, and acquire output data of each radial basis neural network, wherein one individual in the population corresponds to one radial basis neural network;
[0084] A fitness value acquisition module, used for acquiring the fitness value of each individual in the population based on the output data;
[0085] A global optimal solution determination module, used for taking the individual with the smallest current fitness value in the population as the global optimal solution of the radial basis neural network hyperparameters;
[0086] An iterative update module, used for iteratively updating the population when the current iterative update number is less than the iterative update number threshold;
[0087] A loop execution module, used for executing the step of training each radial basis neural network based on the training set and the test set based on the updated population;
[0088] A global optimal solution acquisition module, used for acquiring a global optimal solution of a radial basis neural network hyperparameter applicable to the TMR sensor when the current iterative update number is greater than or equal to an iterative update number threshold;
[0089] A target radial basis neural network determination module is used to determine the target radial basis neural network through an S-fold cross validation method based on the global optimal solution of the radial basis neural network hyperparameters;
[0090] An output voltage value and temperature value acquisition unit, used to acquire the output voltage value of the TMR sensor and the temperature value of the TMR sensor;
[0091] The temperature compensation module is used to input the output voltage value and the temperature value into the target radial basis function neural network to obtain the magnetic field value of the TMR sensor after compensation.
[0092] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the DOA-RBF-based TMR sensor temperature compensation method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0093] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the DOA-RBF-based TMR sensor temperature compensation method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0094] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0095] Figure 1 is a flow chart of a TMR sensor temperature compensation method based on DOA-RBF according to an embodiment of the present invention;
[0096] Figure 2 is a schematic diagram of a target radial basis neural network according to an embodiment of the present invention;
[0097] Figure 3 is a flow chart of another TMR sensor temperature compensation method based on DOA-RBF according to an embodiment of the present invention;
[0098] Figure 4 is a flow chart of another TMR sensor temperature compensation method based on DOA-RBF according to an embodiment of the present invention;
[0099] Figure 5 (a) is a schematic diagram of an output data waveform of a TMR sensor before compensation according to an embodiment of the present invention;
[0100] Figure 5 (b) is a schematic diagram of an output data waveform of a compensated TMR sensor according to an embodiment of the present invention;
[0101] Figure 6 is a schematic diagram of the error between the actual output magnetic field value and the ideal output magnetic field value of the temperature compensated TMR sensor according to an embodiment of the present invention;
[0102] Figure 7 is a schematic diagram of changes in the optimal solution of the hyperparameters of the radial basis neural network obtained by using different algorithms according to an embodiment of the present invention as the number of iterative updates increases;
[0103] Figure 8 is a structural block diagram of a TMR sensor temperature compensation device based on DOA-RBF according to an embodiment of the present invention;
[0104] Fig. 9 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0105] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 those skilled in the art without creative work are within the scope of protection of the present invention.
[0106] TMR sensors are made of metal materials, and the resistivity of most metal materials is affected by temperature, that is, resistance is temperature-dependent. Therefore, as the temperature changes, different voltage outputs exist under the same input signal, which limits the application of the sensor. Temperature compensation must be performed to ensure the accuracy of the sensor.
[0107] In artificial intelligence algorithms, RBFNN (Radial Basis Function Neural Network) has the characteristics of simple structure, fast learning speed, excellent approximation performance and generalization ability, and can be used for temperature compensation of sensors.
[0108] In the related art, the speed of determining the hyperparameters in the RBFNN is slow and the accuracy of the RBFNN corresponding to the hyperparameters for temperature compensation of the sensor is low.
[0109] The embodiment of the present invention provides a TMR sensor temperature compensation method based on DOA-RBF, which uses the Dandelion Optimization Algorithm (DOA) to quickly optimize the hyperparameters in the radial basis function neural network to quickly determine the global optimal solution of the hyperparameters in the radial basis function neural network, and the target RBFNN determined based on the global optimal solution of the hyperparameters is used for temperature compensation of the sensor with high compensation accuracy.
[0110] According to an embodiment of the present invention, an embodiment of a TMR sensor temperature compensation method based on DOA-RBF is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0111] In this embodiment, a TMR sensor temperature compensation method based on DOA-RBF is provided, which can be used in the above-mentioned mobile terminal, such as a central processing unit, a server, etc. Figure 1 is a flow chart of a TMR sensor temperature compensation method based on DOA-RBF according to an embodiment of the present invention, such as Figure 1 As shown, the process includes the following steps:
[0112] Step S101, initialize a population, and the data dimension of each individual in the population is determined by the hyperparameters of the radial basis neural network.
[0113] Among them, the hyperparameters of the radial basis neural network include: the number of hidden layer neurons in the RBFNN, the overlap coefficient and the regularization parameter.
[0114] The data dimension of each individual in the population is 3-dimensional, corresponding to the three hyperparameters of the radial basis neural network.
[0115] The initial population expression is:
[0116] X i =rand×(UB-LB)+LB
[0117] Among them, X i represents the i-th individual in the population, rand represents a random number in [0, 1], UB represents the upper limit of the hyperparameter search, and LB represents the lower limit of the hyperparameter search.
[0118] It should be noted that each hyperparameter has a range, UB represents the upper limit of the hyperparameter range, and LB represents the lower limit of the hyperparameter range.
[0119] Step S102, obtaining an output voltage value set and a corresponding temperature value set of the TMR sensor.
[0120] In order to use the obtained target radial basis function neural network for temperature compensation of the TMR sensor, an output voltage value set and a corresponding temperature value set of the TMR sensor are obtained.
[0121] Step S103, dividing the output voltage value set of the TMR sensor and the corresponding temperature value set into a training set and a test set, training each radial basis neural network based on the training set and the test set, and obtaining output data of each radial basis neural network.
[0122] Among them, one individual in the population corresponds to a radial basis neural network.
[0123] After obtaining the output voltage value set and the corresponding temperature value set of the TMR sensor, the output voltage value set and the corresponding temperature value set of the TMR sensor are divided into a training set and a test set, and each radial basis neural network is trained based on the training set and the test set to obtain the output data of each sample in each radial basis neural network.
[0124] Step S104, obtaining the fitness value of each individual in the population based on the output data.
[0125] After obtaining the output data of each sample in each radial basis neural network, the fitness value of each individual in the population is obtained based on the output data of the radial basis neural network corresponding to each individual.
[0126] Step S105, taking the individual with the smallest current fitness value in the population as the global optimal solution of the radial basis neural network hyperparameters.
[0127] Among them, after obtaining the fitness value of each individual in the population, the individual with the smallest current fitness value is taken as the global optimal solution of the radial basis neural network hyperparameters.
[0128] Step S106: When the current iterative update number is less than the iterative update number threshold, iteratively update the population.
[0129] The current iterative update number of the initialized population is 0. In this embodiment, the individuals in the population are iteratively updated by the Dandelion algorithm to obtain the global optimal solution of the hyperparameters of the radial basis neural network.
[0130] The iterative update number threshold is determined by a technician. Exemplarily, the iterative update number threshold can be set to 100. However, after the population iteration number reaches 15 times, the global optimal solution of the radial basis neural network hyperparameters has basically converged.
[0131] Step S107, executing the step of training each radial basis neural network based on the training set and the test set based on the updated population.
[0132] Among them, after each iterative update of the population, it is necessary to re-execute the above-mentioned training of each radial basis neural network based on the training set and the test set and the corresponding steps thereafter to update the global optimal solution of the hyperparameters of the radial basis neural network.
[0133] Step S108, when the current iterative update number is greater than or equal to the iterative update number threshold, obtaining a global optimal solution of the radial basis neural network hyperparameters suitable for the TMR sensor.
[0134] It can be understood that when the current number of iterative updates of the population is greater than or equal to the iterative update number threshold, the global optimal solution of the radial basis neural network hyperparameters obtained is the optimal solution that has converged, and the target radial basis neural network can be determined based on the optimal solution. The target radial basis neural network is used for temperature compensation of the TMR sensor.
[0135] Step S109, based on the global optimal solution of the radial basis neural network hyperparameters, determine the target radial basis neural network through the S-fold cross-validation method.
[0136] Specifically, the number of S-fold cross validations is determined, and the original training set is re-divided into new training sets and validation sets according to the number. The number of S-fold cross validations is determined by a technician. For example, the number of S-fold cross validations is 5.
[0137] According to the global optimal solution of the final RBF neural network hyperparameters obtained in the above steps, the network parameters of the corresponding radial basis neural network are trained based on the new training set and validation set generated by S-fold cross validation;
[0138] Iterate according to the calculation rules of S-fold cross validation and obtain the target radial basis neural network according to the fitness value.
[0139] Exemplarily, iterations are performed according to the calculation rules of S-fold cross validation to obtain five trained radial basis neural networks, and based on the fitness values of the five trained radial basis neural networks, the radial basis neural network with the smallest fitness value is obtained as the target radial basis neural network.
[0140] Figure 2 FIG. 2 is a schematic diagram showing a target radial basis neural network according to an embodiment of the present invention. The target radial basis neural network may be as follows: Figure 2 The radial basis neural network shown.
[0141] Where x11 represents the output voltage value of the TMR sensor, and x12 represents the temperature value. C11 represents the first dimension data of the first data center, and C12 represents the second dimension data of the first data center. ε represents the expansion width. Φ represents the output of the hidden layer. ω represents the weight, and b represents the bias. out represents the output magnetic field after temperature compensation.
[0142] The method for calculating the fitness value is the same as the calculation method described later, which will not be repeated here.
[0143] It should be further explained that the target radial basis function neural network can finally realize the temperature compensation of the TMR sensor, and the corresponding expression is:
[0144]
[0145] Among them, out represents the output of the target radial basis neural network, ω n and represents the weight of the output layer, b represents the bias of the output layer, Φ(x,C j ) represents the output of each neuron in the hidden layer of the RBF neural network, and the expression is
[0146]
[0147] Among them, C j Represents the jth data center, and its dimension is the same as the dimension of the input data. j It represents the expansion width. The smaller the value, the more selective the basis function is. x is the input data, which is a two-dimensional data, namely the voltage value output by the TMR sensor and the temperature value of the TMR sensor.
[0148] Exemplarily, the network parameters of the target radial basis neural network may be the data shown in Table 1.
[0149] Table 1
[0150]
[0151] Step S110, obtaining the output voltage value of the TMR sensor and the temperature value of the TMR sensor.
[0152] After the target radial basis function neural network is determined, the network can be used for temperature compensation of the TMR sensor to obtain the output voltage value of the TMR sensor and the temperature value of the TMR sensor.
[0153] Step S111, inputting the output voltage value and the temperature value into the target radial basis function neural network to obtain the magnetic field value of the compensated TMR sensor.
[0154] After obtaining the output voltage value of the TMR sensor and the temperature value of the TMR sensor, the output voltage value and the temperature value are input into the target radial basis function neural network to obtain the compensated magnetic field value of the TMR sensor. The compensated magnetic field value of the TMR sensor has a smaller error than the true magnetic field value.
[0155] The DOA-RBF-based TMR sensor temperature compensation method provided in this embodiment uses the Dandelion algorithm to quickly optimize the hyperparameters in the RBF neural network to obtain the global optimal solution of the hyperparameters of the radial basis neural network. The optimization time for obtaining the global optimal solution of the hyperparameters of the radial basis neural network is short, and the global optimal solution can be quickly converged. The target radial basis neural network determined based on the hyperparameters is used for temperature compensation of the TMR sensor, and the compensation accuracy is high.
[0156] In this embodiment, a TMR sensor temperature compensation method based on DOA-RBF is provided, which can be used in the above-mentioned mobile terminal, such as a central processing unit, a server, etc. Figure 3 is a flow chart of a TMR sensor temperature compensation method based on DOA-RBF according to an embodiment of the present invention, such as Figure 3 As shown, the process includes the following steps:
[0157] Step S301, initialize a population, and the data dimension of each individual in the population is determined by the hyperparameters of the radial basis neural network.
[0158] For details, please see Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0159] Step 302: Obtain an output voltage value set and a corresponding temperature value set of the TMR sensor.
[0160] For details, please see Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.
[0161] Step S303, dividing the output voltage value set of the TMR sensor and the corresponding temperature value set into a training set and a test set, training each radial basis neural network based on the training set and the test set, and obtaining output data of each radial basis neural network.
[0162] Specifically, the above step S303 includes:
[0163] Step S3031, dividing the output voltage value set of the TMR sensor and the corresponding temperature value set into a training set and a test set, and normalizing the data of the training set and the data of the test set.
[0164] Step S3032: training each radial basis neural network based on the normalized training set and test set to obtain output data of each radial basis neural network.
[0165] The network parameters of each radial basis neural network include data center, expansion width, and weight and bias of the output layer. The data center of each radial basis neural network is determined based on the data of the training set and the data of the test set after normalization, the expansion width of each radial basis neural network is determined based on the minimum distance between data centers and the overlap coefficient in the hyperparameters, and the weight and bias of the output layer of each radial basis neural network are obtained using the least squares method.
[0166] Specifically, the k-means clustering algorithm is used to determine the data center in the RBF neural network. The number of data centers in the training process comes from the first dimension data of the population data, that is, the number of hidden layer neurons in the RBFNN.
[0167] The minimum distance between data centers is determined, and the expansion width is determined by combining the second-dimensional data overlap coefficient of the population data.
[0168] The structural risk minimization strategy is adopted, and the least squares algorithm is used to solve the weight and bias of the output layer of the RBF neural network.
[0169] Step S304, obtaining the fitness value of each individual in the population based on the output data.
[0170] For details, please see Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.
[0171] Step S305: taking the individual with the smallest current fitness value in the population as the global optimal solution of the radial basis neural network hyperparameters.
[0172] For details, please see Figure 1 Step S105 of the illustrated embodiment will not be described in detail here.
[0173] Step S306: When the current iterative update number is less than the iterative update number threshold, iteratively update the population.
[0174] For details, please see Figure 1 Step S106 of the illustrated embodiment will not be described in detail here.
[0175] Step S307, executing the step of training each radial basis neural network based on the training set and the test set based on the updated population.
[0176] Specifically, the above step S307 includes:
[0177] Step S3071, based on the updated population, executes the step of training each radial basis neural network based on the normalized training set and test set.
[0178] Step S308, when the current iterative update number is greater than or equal to the iterative update number threshold, obtaining a global optimal solution of the radial basis neural network hyperparameters suitable for the TMR sensor.
[0179] For details, please see Figure 1 Step S108 of the illustrated embodiment will not be described in detail here.
[0180] Step S309, based on the global optimal solution of the radial basis neural network hyperparameters, determine the target radial basis neural network through the S-fold cross-validation method.
[0181] For details, please see Figure 1 Step S109 of the illustrated embodiment will not be described in detail here.
[0182] Step S310, obtaining the output voltage value of the TMR sensor and the temperature value of the TMR sensor.
[0183] For details, please see Figure 1 Step S110 of the illustrated embodiment will not be described in detail here.
[0184] Step S311, input the output voltage value and the temperature value into the target radial basis function neural network to obtain the magnetic field value of the compensated TMR sensor.
[0185] For details, please see Figure 1 Step S111 of the illustrated embodiment will not be described in detail here.
[0186] The DOA-RBF-based TMR sensor temperature compensation method provided in this embodiment uses the Dandelion algorithm to quickly optimize the hyperparameters in the RBF neural network to obtain the global optimal solution of the hyperparameters of the radial basis neural network. The optimization time for obtaining the global optimal solution of the hyperparameters of the radial basis neural network is short, and the global optimal solution can be quickly converged. The target radial basis neural network determined based on the hyperparameters is used for temperature compensation of the TMR sensor, achieving a high compensation accuracy effect.
[0187] In some optional implementations, the above step S3032 includes:
[0188] Step a1: training each radial basis neural network based on the normalized training set to obtain first output data of the radial basis neural network.
[0189] The first output data includes the data output by each training sample in the training set in each radial basis neural network training.
[0190] The data output by the radial basis function neural network is the magnetic field value of the TMR sensor.
[0191] Step a2: training each radial basis neural network based on the normalized test set to obtain second output data of the radial basis neural network.
[0192] The second output data includes the data output by each test sample in the test set during each radial basis neural network training.
[0193] The above step S304 includes:
[0194] Step b1, determining a mean square error of a training set and a mean square error of a test set based on the first output data and the second output data.
[0195] After obtaining the first output data and the second output data, the mean square error of the output data of the training set in each radial basis neural network and the mean square error of the output data of the test set in each radial basis neural network are determined according to the obtained first output data and the second output data.
[0196] Step b2, based on the mean square error of the training set and the mean square error of the test set, determine the fitness value of each individual in the population.
[0197] Among them, after obtaining the mean square error of the output data of the training set in each radial basis neural network and the mean square error of the output data of the test set in each radial basis neural network, the fitness value of each individual in the population is determined according to the mean square error of the training set and the mean square error of the test set.
[0198] In some optional implementations, the above step b1 includes:
[0199] Step b11: input the first output data and the first standard data into a mean square error calculation model of a preset training set to obtain the mean square error of the training set.
[0200] Among them, the mean square error calculation model of the preset training set includes:
[0201]
[0202] Among them, MSE1 is the mean square error of the training set, S1 j is the first standard data of the jth training sample in the training set, S1' j is the first output data of the jth training sample in the training set, and N1 is the number of training samples in the training set.
[0203] The first standard data is the standard magnetic field value of the TMR sensor under the corresponding training sample.
[0204] Step b12: input the second output data and the second standard data into a mean square error calculation model of a preset test set to obtain the mean square error of the test set.
[0205] Among them, the mean square error calculation model of the preset test set includes:
[0206]
[0207] Among them, MSE2 is the mean square error of the test set, S2 j is the second standard data of the jth test sample in the test set, S2' j is the second output data of the jth test sample in the test set, and N2 is the number of test samples in the test set.
[0208] The second standard data is a standard magnetic field value of the TMR sensor under the corresponding test sample.
[0209] In some optional implementations, the above step b2 includes:
[0210] Step b21, input the mean square error of the training set and the mean square error of the test set into the preset individual fitness value calculation model to obtain the individual fitness value.
[0211] Among them, the fitness value calculation model of the preset individual includes:
[0212] f(X i )=0.8×MSE1 i +0.2×MSE2 i
[0213] Among them, f(X i) is the fitness value of the i-th individual in the population, MSE1 i is the mean square error of the radial basis neural network corresponding to the i-th individual in the training set, MSE2 i is the mean square error of the radial basis neural network corresponding to the i-th individual in the test set.
[0214] In some optional implementations, the above step S306 includes:
[0215] Step c1, determining the weather of the dandelion seeds in the rising stage based on the random number and the preset threshold.
[0216] Figure 4 FIG. 1 is a flow chart of another TMR sensor temperature compensation method based on DOA-RBF according to an embodiment of the present invention. Figure 4 As shown, the Dandelion algorithm iteratively updates the population, and each iterative update includes three stages, namely, the ascending stage, the descending stage, and the landing stage.
[0217] In the rising stage, the dandelion seeds will rise to different heights under the influence of wind speed, air humidity, etc. There are two situations, which are determined by the selection of random numbers. Then, the population rising stage is updated according to the weather in which the dandelion seeds are in the rising stage.
[0218] The random number expression Rand at this stage, that is, the random number in this embodiment is generated based on an arbitrary real number.
[0219] The preset threshold is set by a technician. Generally, the preset threshold is 1.5.
[0220] Step c2, determining the first position update result of the population based on the weather conditions of the dandelion seeds during the rising phase.
[0221] Step c3, determining the average position of the population based on the first position update result of the population.
[0222] After the first position update result of the population is obtained, the average position of the population under the first position update result is determined according to the first position update result of the population.
[0223] Step c4, based on the average position of the population, determine the second position update result of the population in the descending phase.
[0224] Step c5: determining a third position update result of the population in the landing phase based on the second position update result of the population.
[0225] The above step S3071 includes:
[0226] Step d1, based on the third position update result of the population, execute the step of training each radial basis neural network based on the normalized training set and test set.
[0227] The Dandelion algorithm iteratively updates the population, and each iterative update includes three stages, namely the ascending stage, the descending stage, and the landing stage. The position of the population is updated in each stage, and the third position update result of the population obtained in the landing stage is used as the population position result of this iterative update.
[0228] In some optional implementations, the above step c1 includes:
[0229] Step c11, when the random number is less than a preset threshold, it is determined that the weather in which the dandelion seeds are located during the rising stage is sunny.
[0230] On sunny days, the wind speed can be considered to have a log-normal distribution, and the random numbers are more evenly distributed along the vertical axis, which increases the probability of dandelion seeds spreading to distant areas. Therefore, the dandelion algorithm emphasizes global exploration in this case.
[0231] Step c12: when the random number is greater than or equal to the preset threshold, determine that the weather in which the dandelion seeds are located in the rising stage is rainy.
[0232] On rainy days, dandelion seeds cannot rise with the wind. At this time, the dandelion algorithm is mainly developed in the local neighborhood.
[0233] In some optional implementations, the above step c2 includes:
[0234] Step c21, when the weather in which the dandelion seeds are located is sunny during the ascending stage, the third position update result of the population in the tth iteration, the randomly generated position in the search space in the tth iteration, the adaptive parameters for adjusting the search step size, the lift coefficient and wind speed generated by the dandelion due to the separation vortex are input into the preset population first position update result calculation model to obtain the first position update result of the population.
[0235] Among them, the preset population first position update result calculation model includes:
[0236] X1 t+1 =X3 t +α×v x ×v y ×lnY×(X s -X3 t )
[0237] Among them, X1 t+1 is the first position update result of the population at the t+1th iteration, X3 tis the third position update result of the population at the tth iteration, α is the adaptive parameter for adjusting the search step length, and v x 、v y is the lift coefficient of the dandelion due to the separation vortex, lnY is the wind speed, X s represents a randomly generated position in the search space at the tth iteration.
[0238] It should be noted that when performing the first iterative update of the population, the position of the initialized population, the randomly generated position in the initialized search space, the adaptive parameters for adjusting the search step size, the lift coefficient and wind speed generated by the dandelion due to the separation vortex are input into the preset population first position update result calculation model to obtain the first position update result of the population.
[0239] X s represents the randomly generated position in the search space at the tth iteration, and its expression is:
[0240] X s =rand×(UB-LB)+LB
[0241] Here, rand represents a random number between 0 and 1.
[0242] lnY is the wind speed, which means it obeys μ=0 and σ 2 =1, the mathematical expression of the lognormal distribution is:
[0243]
[0244] Here, y represents the standard normal distribution N(0,1).
[0245] α is an adaptive parameter for adjusting the search step size, which can be used to balance the early and late stages of the algorithm. The expression is:
[0246]
[0247] Where T represents the iterative update threshold of the Dandelion algorithm.
[0248] v x 、v y is the lift coefficient of the dandelion due to the separation vortex, and its expression is:
[0249]
[0250] Here, θ represents a random number in the range [-π,π].
[0251] Step c22, when the weather in which the dandelion seeds are located is rainy during the rising stage, the third position update result of the population's t-th iteration and the parameters for adjusting the local search domain are input into a preset population first position update result calculation model to obtain the population's first position update result.
[0252] The calculation model of the first position update result of the preset population includes:
[0253] X1 t+1 =X3 t ×k
[0254] Among them, X1 t+1 is the first position update result of the population at the t+1th iteration, X3 t is the third position update result of the population in the tth iteration, and k is the parameter for adjusting the local search domain.
[0255] k is a parameter for adjusting the local search domain, and its expression is:
[0256]
[0257] Where rand represents a random number between 0 and 1, and T represents the iterative update threshold of the Dandelion algorithm.
[0258] The judgment of sunny and rainy days is determined by the size between the random number Rand and the preset threshold. In the ascending stage, the first position update result of the population is obtained, and the corresponding expression is:
[0259]
[0260] In some optional implementations, the above step c3 includes:
[0261] Step c31, inputting the position of each individual in the first position update result of the population iteration t+1 and the number of individuals in the population into a preset population average position calculation model to obtain the average position of the population;
[0262] Among them, the average position calculation model of the preset population includes:
[0263]
[0264] Among them, X1 mean,t+1 represents the average position of the first position update result of the population in the t+1th iteration, N pop is the number of individuals in the population, X1 i Update the position of the i-th individual in the result for the first position of the population at iteration t+1.
[0265] In some optional implementations, the above step c4 includes:
[0266] Step c41, input the average position of the first position update result of the population's t+1th iteration, the adaptive parameter for adjusting the search step size, the Brownian motion random number that obeys the normal distribution, and the first position update result of the population's t+1th iteration into the preset population's second position update result calculation model to obtain the population's second position update result.
[0267] The calculation model of the second position update result of the preset population includes:
[0268] X2 t+1 =X1 t+1 -α×βr t+1 ×(X1 mean,t+1 -α×βr t+1 ×X1 t+1 )
[0269] Among them, X2 t+1 is the second position update result of the population at the t+1th iteration, X1 t+1 is the first position update result of the population at the t+1th iteration, α is the adaptive parameter for adjusting the search step length, X1 mean,t+1 represents the average position of the first position update result of the population in the t+1th iteration, βr t+1 is the Brownian motion random number that follows the normal distribution in the population's t+1th iteration.
[0270] like Figure 4 As shown in the figure, in the descending stage, the Brownian motion is used in the dandelion algorithm to simulate the movement trajectory of the dandelion. Since the Brownian motion obeys the normal distribution at each change, it is easy for individuals to traverse more search areas during the iterative update process. In order to reflect the stability of the dandelion's descent, the average position information after the ascending stage is used, which is conducive to the development of the entire population towards the global optimal solution area.
[0271] In some optional implementations, the above step c5 includes:
[0272] Step c51, input the second position update result of the population, the global optimal solution of the current radial basis neural network hyperparameters, the Levy flight function, the adaptive parameter for adjusting the search step size and the linear increasing function between [0,2] into the third position update result calculation model of the preset population to obtain the third position update result of the population.
[0273] Among them, the calculation model of the third position update result of the preset population includes:
[0274] X3 t+1 =X elite +Levy()×α×(X elite -X2 t+1 ×δ)
[0275] Among them, X3 t+1 is the third position update result of the population at the t+1th iteration, X2 t+1 is the second position update result of the population at the t+1th iteration, Levy() is the Levy flight function, α is the adaptive parameter for adjusting the search step length, X elite is the global optimal solution of the current radial basis neural network hyperparameters, and δ is a linear increasing function between [0,2].
[0276] Levy() is the Levy flight function, and its expression is:
[0277]
[0278] In the landing phase, the coefficient β will affect the overall convergence speed of the Dandelion algorithm. The coefficient β in the Levy flight function in this embodiment is 1, s is a constant with a value of 0.01, and w and g are both random numbers between [0,1]. The expression of m is
[0279]
[0280] δ is a linear increasing function between [0,2], expressed as
[0281]
[0282] Where T represents the iterative update threshold of the Dandelion algorithm.
[0283] In the landing phase, the focus of the Dandelion algorithm is development. Based on the first two phases, as the iterations proceed step by step, the algorithm is expected to converge to the global optimal solution. In order to accurately converge to the global optimum, the global optimal solution of the current iteration is used in their local neighborhood. This phase uses the Levy flight function to complete the final population position update.
[0284] The process of the temperature compensation method of the TMR sensor according to the embodiment of the present invention is described below with reference to a specific embodiment.
[0285] Step 1: Initialization phase. In this phase, a population needs to be initialized for population evolution. The data dimension of the population is 3-dimensional, which is the number of hidden layer neurons in RBFNN, the overlap coefficient, and the regularization parameter. The vector formed by the upper limit of the data dimension is UB = [10, 2, 1×10 -5 ], the vector formed by the lower limit of the data dimension is LB = [2, 0.1, 1 × 10 -8 ]. The population size is set to 20.
[0286] The network parameters of RBFNN are obtained by k-means clustering algorithm and least squares method. The former obtains the data center and the latter obtains the weight parameters of the output layer. The mean square error (MSE) of the output data of the training set and the test set is calculated respectively, and the weighted sum of the two is taken as the fitness value f(X i ).
[0287] The initialized population is trained by RBFNN to obtain the corresponding fitness value. This process trains the training samples and test samples. First, the training samples and test samples are normalized, and the normalized input data information includes:
[0288] X mean =[5.9709, 31.8], X std =[62.7026, 49.8458]
[0289] Among them, X mean is the mean of the input data of the training set, the first dimension represents the mean of the output voltage value of the TMR sensor, and the second dimension represents the mean of the temperature value; X std is the square root mean of the input data of the training set. The first dimension represents the square root mean of the output voltage value of the TMR sensor, and the second dimension represents the square root mean of the temperature value.
[0290] The normalization operation of the training samples includes: subtracting the mean of the training set input data from the training sample data to obtain the difference, and dividing the difference by the mean square error of the training set input data to obtain the normalized data of the training samples.
[0291] The normalization operation for the test sample includes: subtracting the mean of the training set input data from the test sample data to obtain the difference, and dividing the difference by the mean square error of the training set input data to obtain the normalized data of the test sample.
[0292] The output data information is
[0293] Y mean =0.8,Y std =31.3559
[0294] Among them, Y mean is the mean of the output data of the training set, Y std Output the mean square root of the training set data.
[0295] The normalization operation of the output information of the training sample includes: subtracting the mean of the training set output data from the training sample output data to obtain the difference, and dividing the difference by the mean square error of the training set output data to obtain the normalized data of the training sample output data.
[0296] The normalization operation of the output information of the test sample includes: subtracting the mean of the training set output data from the test sample output data to obtain the difference, dividing the difference by the mean square error of the training set output data to obtain the normalized data of the test sample output data.
[0297] The Dandelion algorithm takes the individual with the smallest fitness value as the initial global optimal solution of the RBFNN hyperparameters X elite .
[0298] Step 2: In the rising stage, under the influence of wind speed, air humidity, etc., dandelion seeds will rise to different heights. There are two situations here, which are determined by the selection of random numbers. On sunny days, the wind speed can be regarded as having a log-normal distribution, and the random numbers are more evenly distributed along the y-axis, which increases the probability of dandelion seeds spreading to distant areas. Therefore, the dandelion algorithm emphasizes global exploration in this case. On rainy days, dandelion seeds cannot rise with the wind. At this time, the dandelion algorithm is mainly developed in local neighborhoods. The parameter that needs to be set here is the iterative update number threshold of the algorithm, which is set to 100 in this embodiment. Other parameters are randomly generated using Matlab.
[0299] Step 3: In the descending phase, the Brownian motion is used in the dandelion algorithm to simulate the movement trajectory of the dandelion. Since the Brownian motion obeys the normal distribution at each change, it is easy for individuals to traverse more search areas during the iterative update process. In order to reflect the stability of the dandelion's descent, the average position information after the ascending phase is used, which is conducive to the development of the entire population towards the global optimal solution area. In the descending phase, the average position information is used to complete the update of the population position again. The parameters in this step are randomly generated using Matlab.
[0300] Step 4: In the landing phase, the focus of the Dandelion algorithm is development. Based on the first two phases, as the iterations proceed step by step, the algorithm is expected to converge to the global optimal solution. In order to accurately converge to the global optimum, the global optimal solution of the current iteration is utilized in their local neighborhood. This stage uses the Levy flight function to complete the final population position update. Levy() is the Levy flight function. The coefficient β will affect the overall convergence speed of the DOA algorithm. The coefficient in the Levy flight function in the present invention is 1. s is a constant with a value of 0.01, and other parameters are randomly generated using Matlab.
[0301] Step 5: Get a new population after a complete iteration through the position update method from step 2 to step 4. Train the data set again to get the corresponding individual fitness value. Update the global optimal solution of RBFNN hyperparameters according to the individual fitness value.
[0302] Step 6: Determine whether the current number of iterations meets the set iteration update threshold T. If the current number of iterations is less than the iteration update threshold, repeat steps 2 to 5; otherwise, the RBFNN hyperparameter optimization process ends, and the global optimal solution obtained is the RBFNN hyperparameter that needs to be trained in step 7.
[0303] The number of hidden layer neurons optimized in this example is 10.00, the overlap coefficient is 0.148, and the regularization coefficient is 1.27×10 -8 The mean square error obtained from training is 5.0531×10 -3 .
[0304] Step 7: After optimizing the hyperparameters in RBFNN using the Dandelion algorithm, the S-fold cross-validation method is used to determine the optimal neural network parameters, namely the data center, expansion width, and output layer weights and bias, and then determine the target radial basis neural network. After 200 Monte Carlo validations, Figure 5 (a) shows the output data waveform of the TMR sensor before compensation. Figure 5 (b) shows the output data waveform of the TMR sensor after compensation.
[0305] like Figure 5 As shown in (a), the horizontal axis is temperature and the vertical axis is the output voltage value of the TMR sensor. The figure shows the magnetic field value of the TMR sensor before compensation. It can be seen that the magnetic field value of the TMR sensor in the figure before compensation is quite different from the corresponding magnetic field standard value marked in the upper right corner.
[0306] like Figure 5 As shown in (b), the horizontal axis is temperature, and the vertical axis is the magnetic field value of the TMR sensor after compensation. It can be seen that the magnetic field value after compensation by the target radial basis function neural network of this embodiment is Figure 5 The difference between the standard magnetic field values marked in the upper right corner of (a) is very small, achieving the compensation effect for the TMR sensor with high accuracy.
[0307] Figure 6 The figure shows the error between the actual output magnetic field value of the TMR sensor after temperature compensation using the target radial basis function neural network and the ideal output magnetic field value according to the embodiment of the present invention. Figure 6 As shown, the error between the magnetic field value after the target radial basis function neural network compensation and the ideal output magnetic field value in this embodiment is small, thereby improving the accuracy of temperature compensation of the TMR temperature sensor.
[0308] The above process is used to implement the Dandelion algorithm. After 15 iterations, it has basically converged to the optimal solution. The sensor output performance before and after compensation is compared. The zero temperature coefficient α of the TMR sensor output before compensation is 0=30.5ppm / ℃, sensitivity temperature coefficient α s =419ppm / ℃, linearity is 0.41%. After compensation, the zero temperature coefficient of the TMR sensor output is α 0 =8.66ppm / ℃, sensitivity temperature coefficient α s =33.6ppm / ℃, linearity is 0.06%. From the sensitivity temperature coefficient before and after compensation, it can be seen that the overall performance has been improved by an order of magnitude, so the target radial basis function neural network has good compensation performance. It also shows from the side that the dandelion algorithm can better search for the global optimal hyperparameters of the radial basis function neural network.
[0309] Figure 7 The following is a schematic diagram showing the change of the optimal solution of the radial basis neural network hyperparameters obtained by different algorithms as the number of iterative updates increases. Figure 7 As shown in the figure, the horizontal axis is the number of iterative updates, and the vertical axis is the optimal solution of the hyperparameters of the radial basis neural network under different algorithms, that is, the fitness value corresponding to the individual with the smallest fitness value in the population. The iterative process of the hyperparameter optimization of the radial basis neural network based on the Dandelion algorithm is compared with the iterative process of the hyperparameter optimization based on the Sine-Cosine-Algorithm (SCA) and the Future Search Algorithm (FSA). It can be seen that the method of hyperparameter optimization of the radial basis neural network based on the Dandelion algorithm has basically converged to the optimal solution after 15 iterations, while the SCA-RBF method converges to the optimal solution after 30 iterations, and the FSA-RBF method converges to the optimal solution after 70 iterations. Therefore, the hyperparameter optimization of the radial basis neural network based on the Dandelion algorithm has a good convergence speed and the highest convergence accuracy.
[0310] In this embodiment, a TMR sensor temperature compensation device based on DOA-RBF is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0311] This embodiment provides a TMR sensor temperature compensation device based on DOA-RBF, such as Figure 8 As shown, including:
[0312] The population initialization module 801 is used to initialize a population, and the data dimension of each individual in the population is determined by the hyperparameters of the radial basis neural network.
[0313] The sample acquisition module 802 is used to acquire an output voltage value set and a corresponding temperature value set of the TMR sensor.
[0314] The output data acquisition module 803 is used to divide the output voltage value set of the TMR sensor and the corresponding temperature value set into a training set and a test set, train each radial basis neural network based on the training set and the test set, and obtain the output data of each radial basis neural network, wherein one individual in the population corresponds to one radial basis neural network.
[0315] The fitness value acquisition module 804 is used to acquire the fitness value of each individual in the population based on the output data.
[0316] The global optimal solution determination module 805 is used to take the individual with the smallest current fitness value in the population as the global optimal solution of the radial basis neural network hyperparameters.
[0317] The iterative update module 806 is used to iteratively update the population when the current iterative update number is less than the iterative update number threshold.
[0318] The loop execution module 807 is used to execute the step of training each radial basis neural network based on the training set and the test set based on the updated population.
[0319] The global optimal solution acquisition module 808 is used to acquire the global optimal solution of the radial basis neural network hyperparameters suitable for the TMR sensor when the current iterative update number is greater than or equal to the iterative update number threshold.
[0320] The target radial basis neural network determination module 809 is used to determine the target radial basis neural network through an S-fold cross validation method based on the global optimal solution of the radial basis neural network hyperparameters.
[0321] The output voltage value and temperature value acquisition unit 810 is used to acquire the output voltage value of the TMR sensor and the temperature value of the TMR sensor.
[0322] The temperature compensation module 811 is used to input the output voltage value and the temperature value into the target radial basis function neural network to obtain the compensated magnetic field value of the TMR sensor.
[0323] In some optional embodiments, the neural network parameters of the radial basis neural network include: data center, expansion width, and weights and biases of the output layer;
[0324] The output data acquisition module 803 includes:
[0325] The normalization processing unit is used to perform normalization processing on the data of the training set and the data of the test set.
[0326] The output data acquisition subunit is used to train each radial basis neural network based on the normalized training set and test set, and obtain the output data of each radial basis neural network, wherein the data center of each radial basis neural network is determined based on the data of the normalized training set and the data of the test set, the expansion width of each radial basis neural network is determined based on the minimum distance between the data centers and the overlap coefficient in the hyperparameter, and the weight and bias of the output layer of each radial basis neural network are obtained using the least squares method.
[0327] The loop execution module 807 includes:
[0328] The loop execution subunit is used to execute the step of training each radial basis neural network based on the normalized training set and the test set based on the updated population.
[0329] In some optional implementations, the output data acquisition subunit includes:
[0330] The first output data acquisition unit is used to train each radial basis neural network based on the normalized training set to obtain the first output data of the radial basis neural network.
[0331] The second output data acquisition unit is used to train each radial basis neural network based on the normalized test set to obtain second output data of the radial basis neural network.
[0332] The fitness value acquisition module 804 includes:
[0333] The mean square error determination unit is used to determine the mean square error of the training set and the mean square error of the test set based on the first output data and the second output data.
[0334] The fitness value acquisition subunit is used to determine the fitness value of each individual in the population based on the mean square error of the training set and the mean square error of the test set.
[0335] In some optional implementations, the mean square error determination unit includes:
[0336] The training set mean square error acquisition unit is used to input the first output data and the first standard data into a preset training set mean square error calculation model to obtain the mean square error of the training set.
[0337] Among them, the mean square error calculation model of the preset training set includes:
[0338]
[0339] Among them, MSE1 is the mean square error of the training set, S1 j is the first standard data of the jth training sample in the training set, S1'j is the first output data of the jth training sample in the training set, and N1 is the number of training samples in the training set.
[0340] The test set mean square error acquisition unit is used to input the second output data and the second standard data into the mean square error calculation model of the preset test set to obtain the mean square error of the test set.
[0341] Among them, the mean square error calculation model of the preset test set includes:
[0342]
[0343] Among them, MSE2 is the mean square error of the test set, S2 j is the second standard data of the jth test sample in the test set, S2' j is the second output data of the jth test sample in the test set, and N2 is the number of test samples in the test set.
[0344] In some optional implementations, the fitness value acquisition subunit includes:
[0345] The individual fitness value acquisition unit is used to input the mean square error of the training set and the mean square error of the test set into the preset individual fitness value calculation model to obtain the individual fitness value.
[0346] Among them, the fitness value calculation model of the preset individual includes:
[0347] f(X i )=0.8×MSE1 i +0.2×MSE2 i
[0348] Among them, f(X i ) is the fitness value of the i-th individual in the population, MSE1 i is the mean square error of the radial basis neural network corresponding to the i-th individual in the training set, MSE2 i is the mean square error of the radial basis neural network corresponding to the i-th individual in the test set.
[0349] In some optional implementations, the iterative update module 806 includes:
[0350] The weather determination unit is used to determine the weather of the dandelion seeds in the rising stage based on the random number and the preset threshold.
[0351] The first position update result determining unit is used to determine the first position update result of the population based on the weather in which the dandelion seeds are located during the rising phase.
[0352] The average position determining unit is used to determine the average position of the population based on the first position update result of the population.
[0353] The second position update result determining unit is used to determine the second position update result of the population in the descending phase based on the average position of the population.
[0354] The third position update result determining unit is used to determine the third position update result of the population in the landing phase based on the second position update result of the population.
[0355] Loop execution subunit, including:
[0356] The cyclic unit is used to execute the step of training each radial basis neural network based on the normalized training set and the test set based on the third position update result of the population.
[0357] In some optional implementations, the weather determination unit includes:
[0358] The sunny day determination unit is used to determine that the weather in which the dandelion seeds are located during the rising stage is sunny when the random number is less than a preset threshold.
[0359] The rainy day determination unit is used to determine that the weather in which the dandelion seeds are located during the rising stage is a rainy day when the random number is greater than or equal to a preset threshold.
[0360] In some optional implementations, the first location update result determining unit includes:
[0361] The unit for determining the first position update result on a sunny day is used to input the third position update result of the population in the tth iteration, the randomly generated position in the search space in the tth iteration, the adaptive parameter for adjusting the search step size, the lift coefficient and wind speed generated by the dandelion due to the separation vortex into a preset population first position update result calculation model when the weather in which the dandelion seeds are located is sunny during the ascending stage, so as to obtain the first position update result of the population.
[0362] Among them, the preset population first position update result calculation model includes:
[0363] X1 t+1 =X3 t +α×v x ×v y ×lnY×(X s -X3 t )
[0364] Among them, X1 t+1 is the first position update result of the population at the t+1th iteration, X3 t is the third position update result of the population at the tth iteration, α is the adaptive parameter for adjusting the search step length, and v x 、v yis the lift coefficient of the dandelion due to the separation vortex, lnY is the wind speed, X s represents a randomly generated position in the search space at the tth iteration.
[0365] The rainy day first position update result determination unit is used to input the third position update result of the population tth iteration and the parameters for adjusting the local search domain into the preset population first position update result calculation model to obtain the first position update result of the population when the weather in which the dandelion seeds are located is rainy during the rising stage.
[0366] The calculation model of the first position update result of the preset population includes:
[0367] X1 t+1 =X3 t ×k
[0368] Among them, X1 t+1 is the first position update result of the population at the t+1th iteration, X3 t is the third position update result of the population in the tth iteration, and k is the parameter for adjusting the local search domain.
[0369] In some optional implementations, the average position determination unit includes:
[0370] The average position determination subunit is used to input the position of each individual in the first position update result of the population at the t+1th iteration and the number of individuals in the population into the average position calculation model of the preset population to obtain the average position of the population;
[0371] Among them, the average position calculation model of the preset population includes:
[0372]
[0373] Among them, X1 mean,t+1 represents the average position of the first position update result of the population in the t+1th iteration, N pop is the number of individuals in the population, X1 i Update the position of the i-th individual in the result for the first position of the population at iteration t+1.
[0374] In some optional implementations, the second location update result determining unit includes:
[0375] A second position update result determination subunit is used to input the average position of the first position update result of the population's t+1th iteration, the adaptive parameter for adjusting the search step length, the Brownian motion random number that obeys the normal distribution, and the first position update result of the population's t+1th iteration into a second position update result calculation model of a preset population to obtain a second position update result of the population;
[0376] The calculation model of the second position update result of the preset population includes:
[0377] X2 t+1 =X1 t+1 -α×βr t+1 ×(X1 mean,t+1 -α×βr t+1 ×X1 t+1 )
[0378] Among them, X2 t+1 is the second position update result of the population at the t+1th iteration, X1 t+1 is the first position update result of the population at the t+1th iteration, α is the adaptive parameter for adjusting the search step length, X1 mean,t+1 represents the average position of the first position update result of the population in the t+1th iteration, βr t+1 is the Brownian motion random number that follows the normal distribution in the population's t+1th iteration.
[0379] In some optional implementations, the third location update result determining unit includes:
[0380] A third position update result determination subunit is used to input the second position update result of the population, the global optimal solution of the current radial basis neural network hyperparameters, the Levy flight function, the adaptive parameter for adjusting the search step size, and the linear increasing function between [0,2] into a third position update result calculation model of the preset population to obtain a third position update result of the population;
[0381] Among them, the calculation model of the third position update result of the preset population includes:
[0382] X3 t+1 =X elite +Levy()×α×(X elite -X2 t+1 ×δ)
[0383] Among them, X3 t+1 is the third position update result of the population at the t+1th iteration, X2 t+1 is the second position update result of the population at the t+1th iteration, Levy() is the Levy flight function, α is the adaptive parameter for adjusting the search step length, X elite is the global optimal solution of the current radial basis neural network hyperparameters, and δ is a linear increasing function between [0,2].
[0384] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0385] The DOA-RBF-based TMR sensor temperature compensation device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0386] The embodiment of the present invention also provides a computer device having the above Figure 8 The TMR sensor temperature compensation device based on DOA-RBF is shown.
[0387] See also Fig. 9 , Fig. 9 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig. 9 As shown, the computer device includes: one or more processors 901, memory 902, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Each component utilizes different buses to communicate with each other, and can be installed on a common mainboard or installed in other ways as required. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig. 9 A processor 901 is taken as an example.
[0388] The processor 901 may be a central processing unit, a network processor or a combination thereof. The processor 901 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable logic gate array, a general purpose array logic or any combination thereof.
[0389] The memory 902 stores instructions executable by at least one processor 901, so that the at least one processor 901 executes the method shown in the above embodiment.
[0390] The memory 902 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 902 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 902 may optionally include a memory remotely arranged relative to the processor 901, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0391] The memory 902 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 902 may also include a combination of the above types of memory.
[0392] The computer device also includes a communication interface 903, which is used for the computer device to communicate with other devices or a communication network.
[0393] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0394] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A temperature compensation method for a TMR sensor based on DOA-RBF, characterized in that: The method comprises: Initializing a population, wherein the data dimension of each individual in the population is determined by a hyperparameter of a radial basis neural network; Obtain the output voltage value set and the corresponding temperature value set of the TMR sensor; Dividing the output voltage value set and the corresponding temperature value set of the TMR sensor into a training set and a test set, training each radial basis neural network based on the training set and the test set, and obtaining output data of each radial basis neural network, wherein one individual in the population corresponds to one radial basis neural network; Obtaining a fitness value of each individual in the population based on the output data; The individual with the smallest current fitness value in the population is used as the global optimal solution of the radial basis neural network hyperparameters; When the current iterative update number is less than the iterative update number threshold, iteratively updating the population; Execute the step of training each radial basis neural network based on the training set and the test set based on the updated population; When the current iterative update number is greater than or equal to an iterative update number threshold, obtaining a global optimal solution of the radial basis neural network hyperparameters applicable to the TMR sensor; Based on the global optimal solution of the radial basis neural network hyperparameters, determining the target radial basis neural network by an S-fold cross validation method; Obtaining an output voltage value of the TMR sensor and a temperature value of the TMR sensor; The output voltage value and the temperature value are input into the target radial basis function neural network to obtain the magnetic field value of the compensated TMR sensor.
2. The method according to claim 1, characterized in that The neural network parameters of the radial basis neural network include: data center, expansion width, and weight and bias of the output layer; The step of training each radial basis neural network based on the training set and the test set to obtain output data of each radial basis neural network includes: Normalize the data of the training set and the test set; Training each radial basis neural network based on the normalized training set and the test set, and obtaining output data of each radial basis neural network, wherein the data center of each radial basis neural network is determined based on the data of the normalized training set and the data of the test set, the expansion width of each radial basis neural network is determined based on the minimum distance between the data centers and the overlap coefficient in the hyperparameter, and the weight and bias of the output layer of each radial basis neural network are obtained by using the least squares method; The step of performing the training of each radial basis neural network based on the training set and the test set based on the updated population includes: The step of training each radial basis neural network based on the normalized training set and test set is performed based on the updated population.
3. The method according to claim 2, characterized in that The step of training each radial basis neural network based on the normalized training set and the test set to obtain output data of each radial basis neural network includes: Training each radial basis neural network based on the normalized training set to obtain first output data of the radial basis neural network; Training each radial basis neural network based on the normalized test set to obtain second output data of the radial basis neural network; The obtaining the fitness value of each individual in the population based on the output data comprises: Determine a mean square error of the training set and a mean square error of the test set based on the first output data and the second output data; Based on the mean square error of the training set and the mean square error of the test set, a fitness value of each individual in the population is determined.
4. The method according to claim 3, characterized in that: The determining, based on the first output data and the second output data, a mean square error of the training set and a mean square error of the test set comprises: Inputting the first output data and the first standard data into a mean square error calculation model of a preset training set to obtain the mean square error of the training set; The mean square error calculation model of the preset training set includes: Among them, MSE1 is the mean square error of the training set, S1 j is the first standard data of the jth training sample in the training set, S1' j is the first output data of the jth training sample in the training set, N1 is the number of training samples in the training set; Inputting the second output data and the second standard data into a mean square error calculation model of a preset test set to obtain the mean square error of the test set; The mean square error calculation model of the preset test set includes: Among them, MSE2 is the mean square error of the test set, S2 j is the second standard data of the jth test sample in the test set, S2' j is the second output data of the jth test sample in the test set, and N2 is the number of test samples in the test set.
5. The method according to claim 4, characterized in that Determining the fitness value of each individual in the population based on the mean square error of the training set and the mean square error of the test set includes: Inputting the mean square error of the training set and the mean square error of the test set into a preset individual fitness value calculation model to obtain the individual fitness value; The fitness value calculation model of the preset individual includes: f(X i )=0.8×MSE1 i +0.2×MSE2 i Among them, f(X i ) is the fitness value of the i-th individual in the population, MSE1 i is the mean square error of the radial basis neural network corresponding to the i-th individual in the training set, MSE2 i is the mean square error of the radial basis neural network corresponding to the i-th individual in the test set.
6. The method according to claim 2, characterized in that The iterative updating of the population includes: Determine the weather conditions of the dandelion seeds during the rising phase based on random numbers and preset thresholds; Determining a first position update result of the population based on the weather in which the dandelion seeds are located during the ascending phase; determining an average position of the population based on a first position update result of the population; Determining a second position update result of the population in a descending phase based on the average position of the population; Determining a third position update result of the population during a landing phase based on the second position update result of the population; The step of performing the training of each radial basis neural network based on the normalized training set and test set based on the updated population includes: The step of training each radial basis neural network based on the normalized training set and test set is performed based on the third position update result of the population.
7. The method according to claim 6, characterized in that The method of determining the weather of the dandelion seeds in the rising stage based on the random number and the preset threshold value includes: When the random number is less than the preset threshold, it is determined that the weather in which the dandelion seeds are located during the rising stage is sunny; When the random number is greater than or equal to the preset threshold, it is determined that the weather in which the dandelion seeds are located in the rising stage is rainy.
8. The method according to claim 6, characterized in that The determining of the first position update result of the population based on the weather in which the dandelion seeds are located during the ascending stage includes: In the case that the weather in which the dandelion seeds are located during the ascending stage is sunny, the third position update result of the population at the t-th iteration, the randomly generated position in the search space in the t-th iteration, the adaptive parameter for adjusting the search step length, the lift coefficient and wind speed generated by the dandelion due to the separation vortex are input into a preset population first position update result calculation model to obtain the first position update result of the population; The preset population first position update result calculation model includes: X1 t+1 =X3 t +α×v x ×v y ×lnY×(X s -X3 t ) Among them, X1 t+1 is the first position update result of the population at the t+1th iteration, X3 t is the third position update result of the population at the tth iteration, α is the adaptive parameter for adjusting the search step length, and v x 、v y is the lift coefficient of the dandelion due to the separation vortex, lnY is the wind speed, X s represents the randomly generated position in the search space at the tth iteration; In the case that the weather in which the dandelion seeds are located during the rising stage is rainy, the third position update result of the population at the t-th iteration and the parameters for adjusting the local search domain are input into a preset population first position update result calculation model to obtain the first position update result of the population; The calculation model of the first position update result of the preset population includes: X1 t+1 =X3 t ×k Among them, X1 t+1 is the first position update result of the population at the t+1th iteration, X3 t is the third position update result of the population at the tth iteration, and k is a parameter for adjusting the local search domain.
9. The method according to claim 6, characterized in that The determining the average position of the population based on the first position update result of the population includes: Input the position of each individual in the first position update result of the population iteration t+1 and the number of individuals in the population into a preset population average position calculation model to obtain the average position of the population; The average position calculation model of the preset population includes: Among them, X1 mean,t+1 represents the average position of the first position update result of the population in the t+1th iteration, N pop is the number of individuals in the population, X1 i Update the position of the i-th individual in the result for the first position of the population at iteration t+1.
10. The method according to claim 6, characterized in that The step of determining a second position update result of the population in the descending phase based on the average position of the population includes: Input the average position of the first position update result of the population's t+1th iteration, the adaptive parameter for adjusting the search step size, the Brownian motion random number that obeys the normal distribution, and the first position update result of the population's t+1th iteration into a preset population's second position update result calculation model to obtain the population's second position update result; The second position update result calculation model of the preset population includes: X2 t+1 =X1 t+1 -α×βr t+1 ×(X1 mean,t+1 -α×βr t+1 ×X1 t+1 ) Among them, X2 t+1 is the second position update result of the population at the t+1th iteration, X1 t+1 is the first position update result of the population at the t+1th iteration, α is the adaptive parameter for adjusting the search step length, X1 mean,t+1 represents the average position of the first position update result of the population in the t+1th iteration, βr t+1 is the Brownian motion random number that obeys the normal distribution in the t+1th iteration of the population.
11. The method according to claim 6, characterized in that The determining, based on the second position update result of the population, a third position update result of the population in the landing phase comprises: Inputting the second position update result of the population, the global optimal solution of the current radial basis neural network hyperparameters, the Levy flight function, the adaptive parameter for adjusting the search step size, and the linear increasing function between [0, 2] into the third position update result calculation model of the preset population to obtain the third position update result of the population; The calculation model of the third position update result of the preset population includes: X3 t+1 =X elite +Levy()×α×(X elite -X2 t+1 ×δ) Among them, X3 t+1 is the third position update result of the population at the t+1th iteration, X2 t+1 is the second position update result of the population at the t+1th iteration, Levy() is the Levy flight function, α is the adaptive parameter for adjusting the search step length, and X elite is the global optimal solution of the current radial basis neural network hyperparameters, and δ is a linear increasing function between [0,2]; The expression of the Levy flight function is: Among them, the coefficient β is 1, s is a constant with a value of 0.01, w and g are both random numbers between [0,1], and the expression of m is:
12. A TMR sensor temperature compensation device based on DOA-RBF, characterized in that: The device comprises: A population initialization module, used for initializing a population, wherein the data dimension of each individual in the population is determined by a hyperparameter of a radial basis neural network; A sample acquisition module, used to acquire an output voltage value set and a corresponding temperature value set of the TMR sensor; an output data acquisition module, used to divide the output voltage value set and the corresponding temperature value set of the TMR sensor into a training set and a test set, train each radial basis neural network based on the training set and the test set, and acquire output data of each radial basis neural network, wherein one individual in the population corresponds to one radial basis neural network; A fitness value acquisition module, used for acquiring the fitness value of each individual in the population based on the output data; A global optimal solution determination module, used for taking the individual with the smallest current fitness value in the population as the global optimal solution of the radial basis neural network hyperparameters; An iterative update module, used for iteratively updating the population when the current iterative update number is less than the iterative update number threshold; A loop execution module, used for executing the step of training each radial basis neural network based on the training set and the test set based on the updated population; A global optimal solution acquisition module, used for acquiring a global optimal solution of a radial basis neural network hyperparameter applicable to the TMR sensor when the current iterative update number is greater than or equal to an iterative update number threshold; A target radial basis neural network determination module is used to determine the target radial basis neural network through an S-fold cross validation method based on the global optimal solution of the radial basis neural network hyperparameters; An output voltage value and temperature value acquisition module, used to acquire the output voltage value of the TMR sensor and the temperature value of the TMR sensor; The temperature compensation module is used to input the output voltage value and the temperature value into the target radial basis function neural network to obtain the magnetic field value of the TMR sensor after compensation.
13. The device according to claim 12, characterized in that The neural network parameters of the radial basis neural network include: data center, expansion width, and weight and bias of the output layer; The output data acquisition module comprises: A normalization processing unit, used for normalizing the data of the training set and the test set; An output data acquisition subunit is used to train each radial basis neural network based on the normalized training set and the test set, and acquire the output data of each radial basis neural network, wherein the data center of each radial basis neural network is determined based on the data of the normalized training set and the data of the test set, the expansion width of each radial basis neural network is determined based on the minimum distance between the data centers and the overlap coefficient in the hyperparameter, and the weight and bias of the output layer of each radial basis neural network are obtained by using the least square method; The loop execution module comprises: The loop execution subunit is used to execute the step of training each radial basis neural network based on the normalized training set and test set based on the updated population.
14. The device according to claim 13, characterized in that The output data acquisition subunit includes: A first output data acquisition unit, used to train each radial basis neural network based on the normalized training set to obtain first output data of the radial basis neural network; A second output data acquisition unit, used for training each radial basis neural network based on the normalized test set to obtain second output data of the radial basis neural network; The fitness value acquisition module includes: a mean square error determining unit, configured to determine a mean square error of the training set and a mean square error of the test set based on the first output data and the second output data; The fitness value acquisition subunit is used to determine the fitness value of each individual in the population based on the mean square error of the training set and the mean square error of the test set.
15. The device according to claim 14, characterized in that The mean square error determination unit comprises: A training set mean square error acquisition unit, used for inputting the first output data and the first standard data into a mean square error calculation model of a preset training set to obtain the mean square error of the training set; The mean square error calculation model of the preset training set includes: Among them, MSE1 is the mean square error of the training set, S1 j is the first standard data of the jth training sample in the training set, S1' j is the first output data of the jth training sample in the training set, N1 is the number of training samples in the training set; A test set mean square error acquisition unit, used for inputting the second output data and the second standard data into a mean square error calculation model of a preset test set to obtain the mean square error of the test set; The mean square error calculation model of the preset test set includes: Among them, MSE2 is the mean square error of the test set, S2 j is the second standard data of the jth test sample in the test set, S2' j is the second output data of the jth test sample in the test set, and N2 is the number of test samples in the test set.
16. The device according to claim 15, characterized in that The fitness value acquisition subunit includes: An individual fitness value acquisition unit, used for inputting the mean square error of the training set and the mean square error of the test set into a preset individual fitness value calculation model to obtain the individual fitness value; The fitness value calculation model of the preset individual includes: f(X i )=0.8×MSE1 i +0.2×MSE2 i Among them, f(X i ) is the fitness value of the i-th individual in the population, MSE1 i is the mean square error of the radial basis neural network corresponding to the i-th individual in the training set, MSE2 i is the mean square error of the radial basis neural network corresponding to the i-th individual in the test set.
17. The device according to claim 13, characterized in that The iterative update module comprises: A weather determination unit, used to determine the weather of the dandelion seeds in the rising stage based on a random number and a preset threshold; A first position update result determining unit, configured to determine a first position update result of the population based on the weather in which the dandelion seeds are located during the rising phase; an average position determining unit, configured to determine an average position of the population based on a first position update result of the population; A second position update result determining unit, configured to determine a second position update result of the population in a descending phase based on an average position of the population; A third position update result determining unit, configured to determine a third position update result of the population in the landing phase based on the second position update result of the population; The loop execution subunit comprises: A cyclic unit is used to execute the step of training each radial basis neural network based on the normalized training set and test set based on the third position update result of the population.
18. The device according to claim 17, characterized in that The weather determination unit comprises: A sunny day determination unit, configured to determine that the weather in which the dandelion seeds are located during the rising stage is sunny when the random number is less than the preset threshold; The rainy day determination unit is used to determine that the weather in which the dandelion seeds are located in the rising stage is a rainy day when the random number is greater than or equal to the preset threshold.
19. The device according to claim 17, characterized in that The first location update result determining unit includes: A clear day first position update result determination unit is used to input the third position update result of the population at the t-th iteration, the randomly generated position in the search space in the t-th iteration, the adaptive parameter for adjusting the search step length, the lift coefficient and wind speed generated by the dandelion due to the separation vortex into a preset population first position update result calculation model to obtain the first position update result of the population when the weather where the dandelion seeds are located in the ascending stage is clear; The preset population first position update result calculation model includes: X1 t+1 =X3 t +α×v x ×v y ×lnY×(X s -X3 t ) Among them, X1 t+1 is the first position update result of the population at the t+1th iteration, X3 t is the third position update result of the population at the tth iteration, α is the adaptive parameter for adjusting the search step length, and v x 、v y is the lift coefficient of the dandelion due to the separation vortex, lnY is the wind speed, X s represents the randomly generated position in the search space at the tth iteration; A rainy day first position update result determination unit is used to input the third position update result of the population at the t-th iteration and the parameters for adjusting the local search domain into a preset population first position update result calculation model to obtain the first position update result of the population when the weather where the dandelion seeds are located in the rising stage is rainy; The calculation model of the first position update result of the preset population includes: X1 t+1 =X3 t ×k Among them, X1 t+1 is the first position update result of the population at the t+1th iteration, X3 t is the third position update result of the population at the tth iteration, and k is a parameter for adjusting the local search domain.
20. The device according to claim 17, characterized in that The average position determination unit comprises: An average position determination subunit, used for inputting the position of each individual in the first position update result of the population at the t+1th iteration and the number of individuals in the population into an average position calculation model of a preset population to obtain the average position of the population; The average position calculation model of the preset population includes: Among them, X1 mean,t+1 represents the average position of the first position update result of the population in the t+1th iteration, N pop is the number of individuals in the population, X1 i Update the position of the i-th individual in the result for the first position of the population at iteration t+1.
21. The device according to claim 17, characterized in that The second location update result determining unit includes: A second position update result determination subunit is used to input the average position of the first position update result of the population's t+1th iteration, the adaptive parameter for adjusting the search step size, the Brownian motion random number that obeys the normal distribution, and the first position update result of the population's t+1th iteration into a second position update result calculation model of a preset population to obtain a second position update result of the population; The second position update result calculation model of the preset population includes: X2 t+1 =X1 t+1 -α×βr t+1 ×(X1 mean,t+1 -α×βr t+1 ×X1 t+1 ) Among them, X2 t+1 is the second position update result of the population at the t+1th iteration, X1 t+1 is the first position update result of the population at the t+1th iteration, α is the adaptive parameter for adjusting the search step length, X1 mean,t+1 represents the average position of the first position update result of the population in the t+1th iteration, βr t+1 is the Brownian motion random number that obeys the normal distribution in the t+1th iteration of the population.
22. The device according to claim 17, characterized in that The third location update result determining unit comprises: A third position update result determination subunit is used to input the second position update result of the population, the global optimal solution of the current radial basis neural network hyperparameters, the Levy flight function, the adaptive parameter for adjusting the search step size, and the linear increasing function between [0, 2] into a third position update result calculation model of a preset population to obtain a third position update result of the population; The calculation model of the third position update result of the preset population includes: X3 t+1 =X elite +Levy()×α×(X elite -X2 t+1 ×δ) Among them, X3 t+1 is the third position update result of the population at the t+1th iteration, X2 t+1 is the second position update result of the population at the t+1th iteration, Levy() is the Levy flight function, α is the adaptive parameter for adjusting the search step length, and X elite is the global optimal solution of the current radial basis neural network hyperparameters, and δ is a linear increasing function between [0,2]; The expression of the Levy flight function is: Among them, the coefficient β is 1, s is a constant with a value of 0.01, w and g are both random numbers between [0,1], and the expression of m is:
23. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the DOA-RBF-based TMR sensor temperature compensation method according to any one of claims 1 to 11 by executing the computer instructions.
24. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the TMR sensor temperature compensation method based on DOA-RBF according to any one of claims 1 to 11.
Citation Information
Patent Citations
Wireless communication technology-based geomagnetic measurement system and temperature compensation method thereof
CN102866430A
Temperature drift and geomagnetic field correction device and method based on TMR current sensor
CN112363099A