Medical product data prediction method and system based on spatio-temporal information fusion conversion
By embedded spatiotemporal information conversion equations with multi-head self-attention mechanism, the timing and spatial characteristics of drug sales data are extracted, short-term data prediction problems are solved, multi-step advance prediction is achieved and computing needs are reduced.
Patent Information
- Application Number
- CN202411850432.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-04-11
AI Technical Summary
The prior art is difficult to effectively make multi-step advance predictions through short-term drug sales data, and the model is prone to overfitting or explosive prediction errors.
The space-time information conversion equation with embedded multi-head self-attention mechanism is adopted, and the time series and spatial characteristics are extracted through the time series module and the spatial sequence module, and input them into the spatiotemporal feature fusion module for processing, generating a prediction matrix to achieve multi-step advance prediction of the number of medical sales.
Multi-step advance prediction of the number of pharmaceutical sales is achieved, which avoids the problem of model overfitting and explosion of prediction errors, and has small calculation requirements, so that prediction results can be obtained quickly.
Smart Images

Figure CN119809691A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of computer data processing, neural networks and time series prediction based on short-term data, and in particular to a pharmaceutical product data prediction method and system based on spatiotemporal information fusion conversion with an embedded multi-head self-attention mechanism, as well as related equipment involved. Background Art
[0002] With the continuous development of the medical industry, the normal and orderly operation of the pharmaceutical supply chain faces the challenge of new demands. When solving the problem of how to operate the pharmaceutical supply chain efficiently, the demand forecast for various drugs is of vital significance and value. Especially for pharmaceutical sales and production companies, predicting the supply and demand relationship of drugs will help improve their sales performance and maximize their own profits by rationally using economic levers. In the real environment, the sales of drugs are affected by many factors, such as the spread and diagnosis of epidemics, the verification of clinical trials, changes in the economic situation, the improvement of the public health system, the development of emerging technologies and drugs, etc. Therefore, it is of great practical significance to use short-term drug sales data to predict its future sales.
[0003] However, when predicting drug sales, there is a problem of insufficient information in short-term drug sales data, which also makes the model unable to learn the nonlinear information in the data well. It is a challenging and difficult task to make multi-step advance predictions of target drugs in the system only through the information provided in short-term time series data. Although statistical learning methods (e.g., autoregressive and differential autoregressive moving average (ARIMA)), machine learning (e.g., recurrent neural network (RNN), long-short-term memory network (LSTM), support vector (SVR)) and other models and methods have been applied to solve time series problems in nonlinear dynamic systems. However, the use of the above-mentioned more mature models to predict future time series numerical changes from short-term time series data is still not ideal.
[0004] In the field of pharmaceutical sales data forecasting, there are relatively few studies on the existing technology for forecasting from short-term high-dimensional data. Since high-dimensional variables have rich information related to the target prediction variables, the dynamic information of these variables is intertwined and can be used to predict the time series of the target variables. Therefore, it is feasible to predict the future state based on the short-term high-dimensional sequence. Summary of the invention
[0005] In view of this, the present invention uses short-term drug sales data to establish a spatiotemporal information conversion equation drug sales prediction model with an embedded multi-head self-attention mechanism, which realizes multi-step advance prediction of drug sales volume, and serves as the basis for drug supply. Specifically, the present invention provides the following technical solutions:
[0006] In one aspect, the present invention provides a method for predicting pharmaceutical product data based on spatiotemporal information fusion conversion, the method comprising:
[0007] S1. Preprocess the time series data of pharmaceutical product sales to obtain time series data;
[0008] S2. Obtaining the time series features of the time series data through the time series module; obtaining the spatial features of the time series data through the space series module; the time series module and the space series module are arranged in parallel; the time series module comprises a time feature extraction unit and a feature enhancement feedforward unit connected in sequence; the space series module comprises a space feature dimension reduction unit and a Gaussian diffusion feature extraction unit connected in sequence; the time feature extraction unit comprises a plurality of self-attention blocks;
[0009] S3, input the temporal features and spatial features into the spatiotemporal feature fusion module, and the spatiotemporal feature fusion module obtains the prediction matrix D through the spatiotemporal information conversion equation Z ;
[0010] S4, based on the prediction matrix D Z , and obtain the predicted value of pharmaceutical product sales data.
[0011] Preferably, in S1, the preprocessing includes:
[0012] S11. Align the sales time series data of pharmaceutical products according to the pre-approved time period and classify them according to the drugs;
[0013] S12, performing Gaussian standardization on the classified data to obtain time series data;
[0014] S13. Divide the time series data into a training set and a test set.
[0015] Preferably, in S2, the temporal feature extraction unit comprises a sequentially connected input layer, a plurality of parallel self-attention blocks, a concatenation layer and a linearization layer;
[0016] The input layer is set to three parallel branches, namely the query vector matrix linearization branch, the key vector linearization branch and the value vector linearization branch, which map the time series data to the query vector, key vector and value vector one by one and perform linearization respectively; the outputs of the three parallel branches are input into each self-attention block respectively.
[0017] Preferably, the operation mode of the self-attention block is:
[0018]
[0019] in, represents the query vector weight, key vector weight, and value vector weight respectively, V represents the value vector matrix, K represents the key vector matrix, Q represents the query vector matrix, and d v , d k , d q They are the linearized dimensions of the corresponding matrices, h represents the number of self-attention blocks, and j represents the sequence number of the self-attention block.
[0020] Preferably, the processing method of the self-attention block is:
[0021] The query vector matrix is multiplied by the key vector matrix, normalized, and activated by the Softmax function; the activated matrix is matrix-multiplied with the value vector matrix as the output of the self-attention block.
[0022] Preferably, in S2, the output of the time feature extraction unit is fused with the time series data to serve as input data of the feature enhancement feedforward unit;
[0023] The input data of the feature enhancement feedforward unit is fused with the output data of the feature enhancement feedforward unit to form the time series features output by the time series module;
[0024] The output of the Gaussian diffusion feature extraction unit is used as the spatial feature output by the spatial sequence module.
[0025] Preferably, in S1, the processing method of the feature enhancement feedforward unit is:
[0026] The input data of the feature enhancement feedforward unit is divided into four branches for processing. The first branch and the second branch are processed by the query vector matrix and the key vector matrix respectively and then multiplied. The result is processed by the Softmax activation function, and the result is matrix multiplied with the third branch processed by the value vector matrix, and then processed by the Relu activation function.
[0027] The fourth branch processes the input data through the pooling layer and the fully connected network layer in sequence, and performs matrix multiplication with the result of the Relu activation function to obtain the output data of the feature enhanced feedforward unit.
[0028] Preferably, the structure of the Gaussian diffusion feature extraction unit is:
[0029] The normalization layer, Gaussian convolution layer and Softmax activation layer are connected sequentially.
[0030] Preferably, the processing method of the spatiotemporal feature fusion module is:
[0031] The temporal features output by the time series module and the spatial features output by the spatial series module are standardized respectively, and then input into the space-time conversion equation for feature fusion.
[0032] Preferably, the space-time conversion equation is:
[0033]
[0034] in, is the time series feature, is the spatial feature, || || represents the modulus of the variable, Relu() represents the activation function, and Concat() represents the concat operation of the matrix.
[0035] Preferably, after being processed by the time-space conversion equation, the prediction matrix D Z for:
[0036]
[0037] in, is the forecast time series of the existing pharmaceutical product sales data. It is the predicted value of pharmaceutical product sales data at future time nodes.
[0038] On the other hand, the present invention also provides a pharmaceutical product data prediction system based on spatiotemporal information fusion conversion, the system comprising:
[0039] A data preprocessing module is used to preprocess the pharmaceutical product sales time series data to obtain time series data;
[0040] A time series module, used to extract time series features of time series data; the time series module comprises a time feature extraction unit and a feature enhancement feedforward unit connected in sequence;
[0041] A spatial sequence module, used for extracting spatial features of time series data; the spatial sequence module comprises a spatial feature dimension reduction unit and a Gaussian diffusion feature extraction unit connected in sequence;
[0042] The time series module and the space series module are arranged in parallel;
[0043] The spatiotemporal feature fusion module is used to process the temporal features and spatial features through the spatiotemporal information conversion equation to obtain the prediction matrix D Z ; and based on the prediction matrix D Z , get the predicted value of pharmaceutical product sales data;
[0044] The output module is used to receive the predicted value output by the prediction model module and output it to the user equipment.
[0045] Preferably, the system further comprises a prediction evaluation module for evaluating the prediction capability of the prediction model based on the error between the predicted value obtained from the test set data and the corresponding true value.
[0046] In a third aspect, the present invention also provides a pharmaceutical product data prediction device based on spatiotemporal information fusion transformation, which device includes at least a processor and a memory, and the processor can call computer instructions in the memory to execute the pharmaceutical product data prediction method based on spatiotemporal information fusion transformation as described above.
[0047] Compared with the prior art, the solution of the present invention has at least the following beneficial effects:
[0048] In the existing technology, the use of traditional machine learning methods can easily cause the model to overfit due to the low data level, while the deep learning model may experience an explosion in prediction errors and the calculation time may be too long to obtain good prediction results.
[0049] This solution has good prediction results on pharmaceutical product sales data sets, and can meet the prediction effect and accuracy requirements for pharmaceutical product sales data. Through the horizontal comparison between the spatiotemporal information conversion prediction model used in this solution and the current mainstream neural network prediction model, it can be seen that the spatiotemporal information conversion prediction model of this solution has significantly better prediction results than other neural network prediction models when using short-term time series data as a training set. At the same time, compared with existing neural network models, this solution has smaller computing requirements and can obtain predictions for future pharmaceutical sales in a shorter time. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0051] Figure 1 Constructing a flow chart for the temporal-spatial information conversion timing prediction technology of the present invention;
[0052] Figure 2 Schematic diagram of the structure of the self-attention structure of the present invention;
[0053] Figure 3 Schematic diagram of the structure of the multi-head self-attention unit of the present invention;
[0054] Figure 4 It is a structural schematic diagram of a feature enhancement feed-forward unit of the present invention;
[0055] Figure 5 It is a structural schematic diagram of a Gaussian diffusion feature extraction unit of the present invention;
[0056] Figure 6A schematic diagram of the spatiotemporal information conversion scheme of the present invention;
[0057] Figure 7 A comparison chart of the prediction effects of a short-term drug data set according to an embodiment of the present invention;
[0058] Figure 8 4 is a system architecture block diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0059] The embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. It should be clear that the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0060] Those skilled in the art should know that the following specific embodiments or specific implementations are a series of optimized settings listed by the present invention to further explain the specific content of the invention, and these settings can be combined or used in association with each other, unless the present invention clearly states that some or a specific embodiment or implementation cannot be associated or used together with other embodiments or implementations. At the same time, the following specific embodiments or implementations are only used as the most optimized settings, and are not to be understood as limiting the scope of protection of the present invention.
[0061] The present invention is aimed at how to use multi-dimensional short-time data to achieve accurate prediction of target pharmaceutical product related data in pharmaceutical product sales forecasting. The existing technology cannot solve the small sample prediction problem well. The current mainstream machine learning and deep learning models have the problem of overfitting when using small sample data sets for prediction. The present invention aims at the above problems, and the technology invented by the present invention solves the above problems well, realizes the combination of the advantages of multiple methods, avoids the shortcomings of the above models, and obtains better prediction results.
[0062] Figure 1 : is a flow chart of the time series prediction technology for converting spatiotemporal information into time series according to an embodiment of the present invention. In this embodiment, the implementation method of this solution includes steps S1-S5, which are as follows:
[0063] S1: Data preprocessing: Preprocess the pharmaceutical product sales time series data. First, align the pharmaceutical sales product time series data, and statistically classify the pharmaceutical sales time series data according to daily, weekly, monthly and other time periods. Perform Gaussian normalization processing on the sales volume data corresponding to the drug category:
[0064] Z * =θ(Z)
[0065] Among them, Z * is the time series data of pharmaceutical product sales after standardization, and θ() represents the Gaussian normalization function. This embodiment improves the accuracy of subsequent extraction of time and space features in pharmaceutical product sales data through Gaussian normalization, and also ensures that the magnitude of spatial variable data is in the same dimension during the process of temporal and spatial information conversion, so as to increase the accuracy of sales volume data prediction for specific drug categories; further, the training set and the test set are divided according to a certain ratio to train the model. The data division ratio of the training set and the test set can be set based on the actual data volume and training requirements, which will not be repeated here.
[0066] S2: Establishing a spatiotemporal information conversion model: Using the training set data to establish a spatiotemporal information conversion model and solve the parameters in the model to obtain a spatiotemporal information conversion model for pharmaceutical product sales;
[0067] When certain specific conditions are met, the topological attractor of the high-dimensional state variable system can be reconstructed using only the long-term observation data of a single variable. Vice versa, the spatial information of a certain dimensional variable can be reconstructed through the spatial information topology of the high-dimensional variable. Preferably, in this embodiment, based on the above principle, the spatiotemporalinformation (STI) transformation equation is first constructed, that is, the spatial or state information of high-dimensional data is used to predict the multi-step ahead time information of any target variable. The specific steps of constructing the spatiotemporalinformation (STI) transformation model in S2 are as follows:
[0068] When L>2d, the space-time information conversion equation can be expressed as:
[0069]
[0070] Where L represents the expected prediction length of the target predictor variable, d is the box-counting dimension of the attractor, that is, the time series length of the spatial information used in the process of predicting time information, Zt is the spatial variable containing the time series information of D drugs, and Y t is the time information of the target pharmaceutical product sales data variable, t represents the time series of pharmaceutical product sales data, and satisfies Where I(·) represents the unit function, that is, I(·) = ·.
[0071] For the pharmaceutical product sales time series data, the output prediction data matrix D is processed by the above-mentioned spatiotemporal information conversion model. Z It can be expressed as:
[0072]
[0073] Where m represents the embedding dimension of multivariate pharmaceutical sales data.Z In each row or column, Z i Both represent the target predicted pharmaceutical products z k The sales volume at time i, i takes values in [1, m+S-1]. Where the matrix D Z The lower right corner of It represents unknown kinetic time information or future time information, that is, it can be used to predict the sales data of a certain drug in the future.
[0074] S3: Introduce a time module based on a multi-head self-attention mechanism: Introduce the time feature extraction of the multi-head self-attention mechanism into the above-mentioned spatiotemporal information conversion model, so that the model has the ability to efficiently identify, extract and memorize the characteristics of the pharmaceutical product sales sequence; at the same time, in order to predict the sales of traditional Chinese medicine products in the present invention, a feature enhancement feedforward unit is added after the multi-head attention mechanism to achieve weight enhancement of effective time series data features.
[0075] Preferably, the specific steps of constructing the multi-head self-attention mechanism time module in S3 are as follows:
[0076] In view of the problems of training difficulties and insufficient training feature extraction in traditional recurrent neural networks for predicting pharmaceutical product sales sequences, the multi-head self-attention mechanism can fully extract the dynamic information of high-dimensional variables in the data while ensuring the accuracy of neural network training and reducing the model operation speed, and efficiently predict the sales volume of target pharmaceutical products based on the extracted information.
[0077] In the module that processes time information (i.e. Figure 1 The time series module in the , will contain N layers of multi-head attention mechanism to determine the temporal interactions between variables. First, the input high-dimensional pharmaceutical product sales data With query vector Key Vector Value Vector Perform a one-to-one mapping, where d a is the dimension of the attention mechanism, which in turn constitutes Q = [q 1 ,q 2 , ..., q m ] T , K=[k 1 , k 2 , ..., k m ] T , V=[v 1 , v 2 , ..., v m ] T , Represents a real number matrix. The final multi-head self-attention mechanism consists of the following h heads (i.e., h self-attention blocks):
[0078] MultiHead(Q,K,V)=Concat(head1,...,head h )W o
[0079] in,
[0080]
[0081] are all weight matrices, which represent multi-head fusion weight, query vector weight, key vector weight, and value vector weight respectively. V represents the value vector matrix, K represents the key vector matrix, Q represents the query vector matrix, and d v , d k , d q are the linearized dimensions of the above three matrices respectively, and the feature-enhanced feedforward unit processes the features of each pharmaceutical sales product separately by learning the features extracted by the multi-head self-attention mechanism, namely:
[0082]
[0083] Therefore, after the input pharmaceutical sales sequence variable passes through the time module with embedded multi-head self-attention mechanism and feature enhancement feedforward unit, it is obtained All time-related information of the variable at the m observable time nodes is extracted, among which is the pharmaceutical product sales sequence matrix after being processed by the time module. Represents the dimension of the matrix. Through the processing of the time module, the sales time series features of pharmaceutical products are efficiently extracted and the low-contribution features are pruned, providing strong support and guarantee for the subsequent prediction of pharmaceutical product sales.
[0084] S4: Perform spatial sequence processing for feature dimensionality reduction and extraction of pharmaceutical product sales data: The preprocessed spatiotemporal data of pharmaceutical product sales is brought into the spatial sequence module, and the features extracted by the time module are fused with the features finally extracted by the spatial sequence module to obtain fused features, so that the model has good extraction and learning effects on the spatial information features of pharmaceutical product sales data.
[0085] Preferably, the specific steps of constructing the prediction technology in S4 are as follows:
[0086] The spatial sequence module used in this embodiment first uses the LLE model to perform feature dimension reduction processing on the spatial variable information:
[0087]
[0088] in, is the spatial feature dimensionality reduction information of the pharmaceutical sales product obtained by the LLE algorithm, and J is the LLE feature dimensionality reduction unit. Here, the LLE algorithm itself can be implemented using the existing well-known LLE basic algorithm, which is not the inventive point of the present invention and will not be described in detail.
[0089] In this embodiment, a high-dimensional spatial information feature extraction model is added on this basis. In order to make full use of the spatial state information in the nonlinear system, the information extracted by the LLE feature dimensionality reduction unit is further added to the Gaussian diffusion feature extraction unit ξ() which has the function of extracting high-dimensional state information features, that is:
[0090]
[0091] Among them, ζ is the Gaussian diffusion feature extraction function, and the formula converts the high-dimensional spatial variable information on the same time dimension into Input into the spatial module composed of Gaussian diffusion feature extraction units to obtain the i Spatial feature output at time This matrix extracts and saves the features of the high-dimensional pharmaceutical product sales sequence, and then connects the low-dimensional embedded pharmaceutical product sales time features through the spatiotemporal feature fusion module. and spatial characteristics of high-dimensional sales sequences Perform aggregation and merge each column of the feature matrix including time t=t i The final output is the sales forecast matrix of the target pharmaceutical product:
[0092]
[0093] in, is a known prediction target time series, that is, a prediction time series for existing pharmaceutical product sales time series data, and Predicting sequences for unknown targets, that is, predicting the sales time series data of pharmaceutical products at future time nodes.
[0094] Here, it is further preferred that, based on the description of the space-time conversion model in the above steps, the space-time conversion equation in this embodiment is specifically:
[0095]
[0096] in It is used to measure the similarity between temporal features and spatial features. is the temporal feature information extracted by the model, and is the spatial feature information, || || represents the modulus of the variable to ensure that different features are in the same dimension for easy fusion processing, and Relu() represents the activation function to remove the negative related information and retain the positive related information.
[0097] S5: Evaluation of the prediction technology of the spatiotemporal information transformation of pharmaceutical product sales: The error between the prediction result of the model on the test set and the true value is used as the evaluation of the model's prediction ability. In order to more intuitively compare the prediction effects of each model on different data sets, this paper uses the mean squared error (MSE) and the Pearson Correlation Coefficient (PCC) as evaluation indicators.
[0098] MSE is the sum of squared errors divided by the sample size, and the sum of squared errors is the sum of squares of the errors between the model's predicted value and the true value. The smaller this value is, the closer the predicted value is to the true value, and the better the model's prediction effect is. The calculation formula is:
[0099]
[0100] PCC is a qualitative indicator of the correlation between two vectors, showing the similarity of the changing trends of the two variables. The larger the value, the more synchronization the predicted value and the true value maintain in terms of trend, which also indicates that the model has a good effect in predicting trends. The calculation formula is:
[0101]
[0102] Table 1 Summary of prediction results of each model on the short-term drug sales dataset
[0103]
[0104] Combination Figure 7 As shown in the figure, the actual sales data of a drug is compared with the predicted data. In the figure, different training start times are used as comparisons. Different start times affect the actual amount of training data. The solid line in the figure is the actual sales data, and the dotted line on the right is the predicted sales data. Combined with the horizontal comparison of the data of several major networks in Table 1, it can be seen that when short-term time series data is used as the training set, the error of the data provided by this scheme is significantly better than other conventional models, and from Figure 7 It can also be seen that the predicted data is close to the actual sales data, which shows that this solution is a useful supplement to the short-term pharmaceutical sales data time series forecasting problem, meets the guidance needs of practical applications, and also provides an effective model algorithm for efficiently predicting pharmaceutical sales.
[0105] In another executable embodiment, the solution of the present invention can also be implemented in a system manner, combining Figure 8 As shown, the system can be set up as follows:
[0106] A data preprocessing module is used to preprocess the time series multivariate spatial data of pharmaceutical product sales to obtain time series data;
[0107] The time series module extracts the time series features of pharmaceutical product sales based on the time series data to be predicted output by the data preprocessing module; in this embodiment, the specific structure of the time series module is set as follows: extracting time series features through a time feature extraction unit and a feature enhancement feedforward unit connected in sequence; wherein the preprocessed data is input into a time feature extraction unit based on a multi-head self-attention mechanism, the output of which is fused with the input preprocessed data (e.g., concat operation) and then used as the input of the feature enhancement feedforward unit; the output data of the feature enhancement feedforward unit is fused with the input data of the unit (e.g., concat operation) as the output of the time series module, i.e., the time series feature matrix
[0108] A multi-head self-attention mechanism is added to extract temporal features from time information, that is, a temporal feature extraction unit based on a multi-head self-attention mechanism is set up, which includes multiple self-attention blocks, where the structure of the self-attention block is as follows: Figure 2 As shown in Figure 1, the time series data is input into the self-attention unit and passes through the three matrices Q, K, and V. Then, the matrix Q and the matrix K are multiplied and normalized. After the Softmax activation function is used for feature extraction, it is multiplied with the matrix V. The multi-head self-attention unit is as follows Figure 3 As shown in the figure, the sales time series data of pharmaceutical products are processed in parallel by multiple self-attention blocks after being linearized by the Q, K, and V matrices. The processing results of each self-attention block are spliced and linearized to obtain the time series features output by the time feature extraction unit; after the time series features are fused with the input data of the time feature extraction unit, the effective time features extracted are further enhanced by the feature enhancement feedforward unit. The structure of the feature enhancement feedforward unit is shown in Figure 4 As shown in the figure, the unit passes one branch of the time series features extracted in the previous step through the pooling layer and the fully connected network, and the other branch passes through the K and Q matrices for matrix multiplication and uses the Softmax activation function to further optimize the feature structure, and multiplies it with the third branch after passing through the V matrix, and then passes through the Relu activation function, and multiplies it with the features output by the fully connected network layer to obtain enhanced time series features. After the enhanced time series features are fused with the input data of the feature enhancement feedforward unit, the time series feature matrix is obtained. In order to achieve accurate prediction of subsequent prediction targets, and at the same time obtain the results analyzed by the time series module.
[0109] The spatial sequence module inputs the preprocessed sales data of pharmaceutical products into the spatial sequence module in the form after preprocessing. First, the high-dimensional dynamic information and features contained in the high-dimensional sales data of pharmaceutical products are reduced in dimension using the spatial feature dimensionality reduction unit based on LLE (see step S4 for details). After the dimensionality reduction process, the Gaussian diffusion feature extraction unit is used, such as Figure 5 As shown in the figure, the spatial information features obtained by the LLE dimension reduction unit are standardized, and the features are extracted by the Gaussian convolution kernel. Finally, the extracted features are filtered by the Softmax function to filter out invalid or inefficient spatial information features, obtain effective high-dimensional information features, and obtain the spatial sequence feature matrix
[0110] The spatiotemporal feature fusion module, in this embodiment, has the following structure: Figure 6 As shown, the spatiotemporal feature fusion module is used to fuse the temporal features and spatial features extracted by the time series module and the space series module, and to construct and store the spatiotemporal information conversion model; the final spatiotemporal information prediction sequence output of the pharmaceutical product sales is obtained, which is used to receive the predicted value output by the prediction model module and output it to the user device. The spatiotemporal feature fusion module mainly includes two parallel standardization units, which are used to standardize the temporal features and spatial features respectively, and then directly obtain the fused prediction matrix D through the spatiotemporal conversion equation. Z It should be noted here that the standardization unit may adopt a conventional standardization method, such as normalization processing, etc., which is not limited here and will not be described in detail.
[0111] In the spatiotemporal feature fusion module, the spatiotemporal conversion equation is as follows:
[0112]
[0113] in It is used to measure the similarity between temporal features and spatial features. is the temporal feature extracted by the model, and is the spatial feature, || || represents the modulus of the variable to ensure that different features are in the same dimension for easy fusion processing, Relu() represents the activation function to remove the negative related information and retain the positive related information, and Concat() represents the concat operation of the matrix.
[0114] Furthermore, the system also includes a prediction evaluation module for evaluating the prediction ability of the prediction model based on the error between the predicted value obtained from the test set data and the corresponding true value.
[0115] Furthermore, the system also includes an output module for receiving the predicted value output by the prediction model module and outputting it to the user equipment.
[0116] In addition, the solution of the present invention can also be implemented in the form of a pharmaceutical product data prediction device based on spatiotemporal information fusion conversion, which device includes at least a processor and a memory, and the processor can call computer instructions in the memory to execute the pharmaceutical product data prediction method based on spatiotemporal information fusion conversion as described above.
[0117] It should be noted here that the calculation method or model of each method can be implemented using the specific algorithms and methods listed in the above embodiments.
[0118] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A pharmaceutical product data prediction method based on spatiotemporal information fusion conversion, characterized in that: The method comprises: S1. Preprocess the time series data of pharmaceutical product sales to obtain time series data; S2. Obtaining the time series features of the time series data through the time series module; obtaining the spatial features of the time series data through the space series module; the time series module and the space series module are arranged in parallel; the time series module comprises a time feature extraction unit and a feature enhancement feedforward unit connected in sequence; the space series module comprises a space feature dimension reduction unit and a Gaussian diffusion feature extraction unit connected in sequence; the time feature extraction unit comprises a plurality of self-attention blocks; S3, input the temporal features and spatial features into the spatiotemporal feature fusion module, and the spatiotemporal feature fusion module obtains the prediction matrix D through the spatiotemporal information conversion equation Z ; S4, based on the prediction matrix D Z , and obtain the predicted value of pharmaceutical product sales data.
2. The method according to claim 1, characterized in that In S1, the preprocessing includes: S11. Align the sales time series data of pharmaceutical products according to the pre-approved time period and classify them according to the drugs; S12, performing Gaussian standardization on the classified data to obtain time series data; S13. Divide the time series data into a training set and a test set.
3. The method according to claim 1, characterized in that: In S2, the temporal feature extraction unit comprises an input layer, a plurality of parallel self-attention blocks, a concatenation layer and a linearization layer connected in sequence; The input layer is set to three parallel branches, namely the query vector matrix linearization branch, the key vector linearization branch and the value vector linearization branch, which map the time series data to the query vector, key vector and value vector one by one and perform linearization respectively; the outputs of the three parallel branches are input into each self-attention block respectively.
4. The method according to claim 3, characterized in that The operation mode of the self-attention block is: in, represents the query vector weight, key vector weight, and value vector weight respectively, V represents the value vector matrix, K represents the key vector matrix, Q represents the query vector matrix, and d v , d k , d q They are the linearized dimensions of the corresponding matrices, h represents the number of self-attention blocks, and j represents the sequence number of the self-attention block.
5. The method according to claim 3, characterized in that: The processing method of the self-attention block is: The query vector matrix is multiplied by the key vector matrix, normalized, and activated by the Softmax function; the activated matrix is matrix-multiplied with the value vector matrix as the output of the self-attention block.
6. The method according to claim 1, characterized in that In S2, the output of the time feature extraction unit is fused with the time series data to serve as input data of the feature enhancement feedforward unit; The input data of the feature enhancement feedforward unit is fused with the output data of the feature enhancement feedforward unit to form the time series features output by the time series module; The output of the Gaussian diffusion feature extraction unit is used as the spatial feature output by the spatial sequence module.
7. The method according to claim 1, characterized in that In S1, the processing method of the feature enhancement feedforward unit is: The input data of the feature enhancement feedforward unit is divided into four branches for processing. The first branch and the second branch are processed by the query vector matrix and the key vector matrix respectively and then multiplied. The result is processed by the Softmax activation function, and the result is matrix multiplied with the third branch processed by the value vector matrix, and then processed by the Relu activation function. The fourth branch processes the input data through the pooling layer and the fully connected network layer in sequence, and performs matrix multiplication with the result of the Relu activation function to obtain the output data of the feature enhanced feedforward unit.
8. The method according to claim 1, characterized in that The structure of the Gaussian diffusion feature extraction unit is: The normalization layer, Gaussian convolution layer and Softmax activation layer are connected sequentially.
9. The method according to claim 1, characterized in that: The processing method of the spatiotemporal feature fusion module is as follows: The temporal features output by the time series module and the spatial features output by the spatial series module are standardized respectively, and then input into the space-time conversion equation for feature fusion.
10. The pharmaceutical product data prediction system based on spatiotemporal information fusion conversion is characterized by: The system comprises: A data preprocessing module is used to preprocess the pharmaceutical product sales time series data to obtain time series data; A time series module, used for extracting time series features of time series data; the time series module comprises a time feature extraction unit and a feature enhancement feedforward unit connected in sequence; the time feature extraction unit comprises a plurality of self-attention blocks; A spatial sequence module, used for extracting spatial features of time series data; the spatial sequence module comprises a spatial feature dimension reduction unit and a Gaussian diffusion feature extraction unit connected in sequence; The time series module and the space series module are arranged in parallel; The spatiotemporal feature fusion module is used to process the temporal features and spatial features through the spatiotemporal information conversion equation to obtain the prediction matrix D Z ; and based on the prediction matrix D Z , get the predicted value of pharmaceutical product sales data; The output module is used to receive the predicted value output by the prediction model module and output it to the user equipment.
Citation Information
Cited By
Production plan intelligent prediction method and system
CN120725225A