Method for constructing instrument adaptation prediction model of different nodes in various treatment scenes
By constructing a prediction model of Transformer architecture, the problems of wasting manpower, waiting time for a long time, unable to reasonably arrange the order of patients' rehabilitation projects, unable to meet patients' personalized needs, and energy waste in the existing technology, and achieved intelligent identification, diagnosis and treatment load prediction, energy-saving strategy recommendation and treatment project optimization, achieving the effects of personalized rehabilitation and smart energy saving.
Patent Information
- Application Number
- CN202510055645.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-14
- Publication Date
- 2025-04-25
AI Technical Summary
In the prior art, there are problems such as wasting manpower, waiting time, being unable to reasonably arrange the order of patient rehabilitation projects, not meeting patients' personalized needs, and energy waste.
By building a prediction model based on Transformer architecture, using historical data and real-time data for learning and training, identify different treatment scenarios, intelligently predict diagnosis and treatment load, recommend energy-saving strategies, and optimize treatment project arrangements.
It achieves the personalized needs of patients for rehabilitation under the condition of ensuring the amount of diagnosis and treatment, achieves the optimal treatment quality, and achieves the effect of smart energy saving.
Smart Images

Figure SMS_1 
Figure SMS_2 
Figure SMS_5
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of medical device configuration, and in particular to a method for constructing a prediction model for device adaptation at different nodes in each treatment scenario. Background Art
[0002] Traditional rehabilitation halls are planned according to space, and rely on set rehabilitation projects and project usage times to be manually transmitted to patients for treatment planning and training. Due to the large individual differences among patients, different training projects, and a limited number of equipment, patients always have to wait too long for treatment during training, and the order of rehabilitation projects for patients cannot be optimally arranged. All rehabilitation projects are set up manually, and cannot be well adapted to patients with different conditions and different projects, and cannot solve the problem of maximizing the rehabilitation efficiency of individual patients within a limited time. At the same time, the opening and closing of rehabilitation equipment also rely on manual operation, which cannot achieve the optimization of energy use, often wastes energy, and cannot save energy. Summary of the invention
[0003] The present invention provides a method for constructing a prediction model for equipment adaptation at different nodes in each treatment scenario, with the purpose of solving the problems existing in the prior art, such as waste of manpower, long waiting time, inability to reasonably arrange the order of rehabilitation projects for patients, inability to meet the personalized needs of patients, and energy waste. The method is adopted to construct a model by learning historical data, and at the same time introduces real-time data to continuously train and correct the model, so that different scenarios can be identified, diagnosis and treatment load can be intelligently predicted, energy-saving strategies can be intelligently recommended, and the optimal treatment project selection can be intelligently recommended in the current environment. Under the condition of ensuring the diagnosis and treatment volume, it can not only meet the personalized needs of patients for rehabilitation and achieve the best treatment quality, but also achieve the effect of intelligent energy saving.
[0004] The technical solution provided by the present invention is as follows:
[0005] A method for constructing a prediction model for device adaptation at different nodes in each treatment scenario comprises the following steps:
[0006] Collect historical data on the utilization rate of equipment in different rehabilitation areas, standardize the historical data using a first formula, and concatenate them to form a first input sequence X;
[0007] For the first input sequence, a Transformer architecture is constructed by combining a multi-head self-attention layer, a feedforward neural network layer, and normalization and residual to obtain a prediction model, which is shown in the first formula:
[0008] X 0 =X
[0009] X l+1 =X 1+FFN(LN(X 1 +MultiHead(LN(X l ))))for l=0,1,…,L-1
[0010] Where L is the number of stacked layers of the Transformer architecture; X is the first input sequence, with a dimension of n×d, where n is the length of the first input sequence and d is the feature dimension of each time step; X 0 is the initial value of the first input sequence; l is the index, starting from 0; X l is the input sequence of the lth layer; FFN is the feedforward neural network layer; LN is the layer normalization; MultiHead is the operation of the multi-head self-attention layer;
[0011] Inputting the first input sequence into the prediction model in batches, defining a loss function, updating the model parameters through an optimization algorithm, repeating the process multiple times until the prediction model converges and training is completed to obtain a trained prediction model;
[0012] Standardizing the historical data of the target time period to form a second input sequence, inputting the second input sequence into the trained prediction model, and outputting a prediction vector of the equipment demand in each rehabilitation area;
[0013] Clustering the prediction vectors into different scene categories and labeling each of the scene categories;
[0014] According to different scene categories, establish a device adaptation strategy library and build a device adaptation recommendation system under scene recognition;
[0015] The device adaptation recommendation system under the scenario recognition is trained and optimized, and a portion of the reserved verification data is used to evaluate the performance of the model and the accuracy of the device adaptation recommendation. According to the evaluation results, the model is adjusted, the data preprocessing method is optimized, or the strategy library is improved.
[0016] Furthermore, the first input sequence X=[x new1 ,x new2 ,…,x newm ], the historical data of equipment utilization is x={x1,x2,…,x n}
[0017] Among them, m is the total feature dimension after processing;
[0018] x new is the standardized value, x new The calculation formula is as follows:
[0019]
[0020] Where n is the length of the first input sequence, μ is the mean, and σ is the standard deviation.
[0021] Furthermore, the first input sequence is constructed by combining a multi-head self-attention layer, a feedforward neural network layer, and normalization and residual to form a Transformer architecture, including the following steps:
[0022] The first input sequence X is transformed by three different linear transformations to obtain the query vector Q, key vector K, and value vector V, Q = XW Q , K = XW K , V = XW V ;
[0023] Among them, W Q , W K , W V They are the corresponding learnable weight matrices, both with dimensions of d×d K ;
[0024] For each head i, calculate the attention score Attention(Q i ,K i ,V i ),
[0025]
[0026] where i = 1, 2, ..., h; Q i ,K i ,V i It is the corresponding part after Q, K, V is split into h heads, and the dimension of each head is n×d k ; Q i and K i Transpose The dot product of
[0027] The attention outputs of each head are concatenated and transformed through a linear transformation W O Get the final output of the multi-head self-attention layer:
[0028] MultiHead(Q,K,V)=
[0029] Concat(Attention(Q 1 ,K 1 ,V 1 ),...,Attention(Q h ,K h ,V h ))W O
[0030] Among them, W OThe dimension is hd k ×d, the output dimension of the multi-head self-attention layer is n×d;
[0031] After the output from the multi-head self-attention layer, it is input to the feedforward neural network layer. The feedforward neural network layer FFN contains two linear transformations and an activation function. The expression of the feedforward neural network layer FFN is as follows:
[0032] FFN(x)=max(0,xW 1 +b 1 )W 2 +b 2
[0033] Among them, W 1 ,W 2 is the weight matrix of the linear transformation, b 1 ,b 2 is the bias term;
[0034] After the multi-head self-attention layer and the feedforward neural network layer, layer normalization and residual connection are performed. The expression for layer normalization is as follows:
[0035]
[0036] Among them, μ is the mean, σ 2 is the variance, ∈ is a value to prevent the denominator from being zero, and γ and β are learnable scaling and translation parameters.
[0037] Furthermore, the feedforward neural network layer uses a ReLU activation function, which is expressed as:
[0038] FFN(x)=ReLU(xW 1 +b 1 )W 2 +b 2
[0039] Among them, W 1 is of dimension d×d ff The weight matrix, b 1 The dimension is d ff The bias vector, W 2 is of dimension d×d ff The weight matrix, b 2 is a bias vector of dimension d, d ff is the dimension of the intermediate layer of the feed-forward network.
[0040] Furthermore, the loss function is defined as follows: the loss function is defined by the mean square error, and the calculation formula of the mean square error loss function L is:
[0041]
[0042] in, is the predicted device demand vector, y is the actual device demand vector, n is the length of the vector, is the ith element of the predicted equipment demand vector, and yi is the ith element of the actual equipment demand vector.
[0043] Furthermore, the model parameters are updated by the optimization algorithm, and the process is repeated multiple times until the prediction model converges and the training is completed to obtain a trained prediction model, specifically:
[0044] The second formula is used for multiple iterations to continuously adjust the model parameters so that the loss function gradually decreases until the model converges. The second formula is:
[0045] θ t =θ t-1 -ηg θ
[0046] Among them, θ is the model parameter, g θ is the gradient with respect to the model parameters, θ t is the model parameter at the current time t, θ t-1 is the model parameter of the previous moment, and η is the learning rate.
[0047] Furthermore, the learning rate is determined by a third formula, and the third formula is expressed as follows:
[0048]
[0049] where η t is the learning rate at the tth iteration, η 0 is the initial learning rate and k is the decay coefficient.
[0050] Furthermore, the construction of the device adaptation recommendation system under scene recognition includes the following steps:
[0051] For each identified scenario category, a corresponding device adaptation strategy library is established;
[0052] After inputting new data into the prediction model and identifying the current scenario category, an equipment adaptation recommendation is generated according to the corresponding policy library. The recommendation content includes equipment on / off operation, equipment parameter settings, and personnel configuration suggestions.
[0053] Furthermore, the model training and optimization of the device adaptation recommendation system under scene recognition is specifically as follows: in the device adaptation recommendation system under scene recognition, a loss function is defined by a combination of classification loss and / or regression loss;
[0054] Select the Adam algorithm and / or Adagrad algorithm to update the model parameters to minimize the loss function, and use batch training or early stopping training strategies to improve training efficiency and prevent overfitting.
[0055] Furthermore, during the training process, the change of the loss function value is monitored. If it is found that the loss function value no longer decreases or starts to increase after several consecutive iterations, the training is stopped in advance;
[0056] When the model parameters are adjusted through multiple iterations of the second formula, the fourth formula is combined to improve efficiency and stability. The expression of the fourth formula is:
[0057] v t =βv t-1 -ηg θ
[0058] θ t =θ t-1 +v t
[0059] Among them, v t is the velocity at the current moment, and β is the momentum coefficient.
[0060] Compared with the prior art, the present invention has the following beneficial effects:
[0061] The present invention provides a method for constructing a prediction model for equipment adaptation at different nodes in each treatment scenario, which solves the problems existing in the prior art, such as waste of manpower, long waiting time, inability to reasonably arrange the order of rehabilitation projects for patients, inability to meet the personalized needs of patients, and energy waste. This method uses historical data learning to build a model, and introduces real-time data to continuously train and correct the model, so that different scenarios can be identified, diagnosis and treatment loads can be intelligently predicted, energy-saving strategies can be intelligently recommended, and the optimal treatment project selection can be intelligently recommended in the current environment. Under the condition of ensuring the diagnosis and treatment volume, it can not only meet the personalized needs of patients for rehabilitation and achieve the best treatment quality, but also achieve the effect of intelligent energy saving. DETAILED DESCRIPTION
[0062] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the embodiments of the present application. Obviously, the embodiments described below are part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown here can be arranged and designed in various different configurations.
[0063] The present invention provides a method for constructing a prediction model for device adaptation at different nodes in each treatment scenario, comprising the following steps:
[0064] Step S1: collect historical data on the utilization rate of equipment in different rehabilitation areas, standardize the historical data using a first formula, and form a first input sequence X after splicing.
[0065] In step S1, for the time series data in the rehabilitation scenario (such as the change of patient flow over time, the time distribution of equipment usage frequency, etc.), these data can be arranged in chronological order as the input sequence of the Transformer model (i.e., the prediction model). The data is preprocessed, such as normalization or standardization, to ensure that the dimensions of different features are consistent and to avoid excessive influence of certain features on the model.
[0066] Step S2: For the first input sequence, a Transformer architecture is constructed by combining a multi-head self-attention layer, a feedforward neural network layer, and normalization and residual to obtain a prediction model. The prediction model is shown in the first formula:
[0067] X 0 =X
[0068] X l+1 =X 1 +FFN(LN(X 1 +MultiHead(LN(X l ))))for l=0,1,…,L-1
[0069] Where L is the number of stacked layers of the Transformer architecture; X is the first input sequence, with a dimension of n×d, where n is the length of the first input sequence and d is the feature dimension of each time step; X 0 is the initial value of the first input sequence; l is the index, starting from 0; X l is the input sequence of the lth layer; FFN is the feedforward neural network layer; LN is the layer normalization; MultiHead is the operation of the multi-head self-attention layer.
[0070] Step S3: input the first input sequence into the prediction model in batches, define the loss function, update the model parameters through the optimization algorithm, repeat multiple times until the prediction model converges and the training is completed to obtain a trained prediction model.
[0071] In step S3, the preprocessed historical data is input into the prediction model in batches according to the set batch size (such as taking 32 time series samples as a batch each time), the loss function value is calculated, and then the model parameters are updated through the optimization algorithm. This process is repeated until the model converges (for example, the loss function value no longer decreases significantly or reaches the preset number of training rounds).
[0072] After the model training is completed, for a new time point, the previous historical time series data (also organized in the preprocessing method) is input into the trained prediction model, and the model will output the predicted value of the equipment demand in each rehabilitation area in the next period. For example, the output prediction vector may be (in Represents the predicted equipment demand for the jth rehabilitation area), and the rehabilitation hall manager can formulate appropriate equipment strategies based on these predicted values, such as deciding which equipment to turn on, adjusting the equipment usage parameters, etc., to meet the patients' rehabilitation needs and achieve goals such as smart load and energy saving.
[0073] Step S4: Standardize the historical data of the target time period to form a second input sequence, input the second input sequence into the trained prediction model, and output the prediction vector of the equipment demand in each rehabilitation area.
[0074] Step S5: cluster the prediction vectors into different scene categories and label each scene category.
[0075] Step S5 includes two parts: (1) Cluster analysis: After the historical data is processed by Transformer, the output is used for cluster analysis. For example, the processed feature vectors are clustered into different scene categories using methods such as K-Means clustering or hierarchical clustering. These scene categories can represent different treatment area working modes, such as "busy scene" (large patient flow, high frequency of use of multiple devices), "idle scene" (small patient flow, low device usage rate) or "special treatment scene" (specific treatment projects are carried out intensively, and there are special needs for certain devices).
[0076] (2) Scenario labeling: Label each clustered scenario category for subsequent identification and application. These labels can be defined based on actual business needs. For example, the scenario can be named based on the comprehensive characteristics of patient flow, device usage, and treatment items, such as "morning rehabilitation training peak scenario", "night emergency scenario", "physical therapy-based scenario", etc.
[0077] Step S6: Establish an equipment adaptation strategy library for different scene categories and construct an equipment adaptation recommendation system under scene recognition.
[0078] Step S7: perform model training and optimization on the device adaptation recommendation system under scene recognition, use a portion of the reserved verification data to evaluate the performance of the model and the accuracy of the device adaptation recommendation, and adjust the model, optimize the data preprocessing method, or improve the strategy library based on the evaluation results.
[0079] In step S7, a portion of the reserved verification data can be used to evaluate the performance of the model. The evaluation indicators can include the accuracy of scene recognition, recall rate, F1 value, etc., as well as the accuracy of device adaptation recommendation (such as the degree of match between the recommended device and the actual demand). According to the evaluation results, the model is adjusted, such as adjusting the model's hyperparameters (such as the number of layers, heads, and hidden units of the Transformer), optimizing the data preprocessing method, or improving the strategy library.
[0080] The method for constructing a prediction model for equipment adaptation at different nodes of each treatment scene provided by the present invention constructs a prediction model based on the Transformer architecture according to the collected historical data. Through the model, an equipment adaptation strategy library can be established for different scene categories. When a new patient is added or the surrounding scene changes, the equipment demand for the situation can be automatically determined according to the prediction model, and the corresponding strategy can be adopted to achieve intelligent load and energy saving. According to the scene recognition model, the rehabilitation hall can adapt to each scene according to the required diagnosis and treatment volume. For example: when the model recognizes that a scene has a large flow during the day, but no flow in the evening and night, the model may recognize the scene as a working day. Thus, the rehabilitation hall can adopt an energy-saving strategy of opening during the day, deep sleep or even closing at night and night for the scene. When the model recognizes that there is no flow in a scene during the day, evening, and night, the model may recognize the scene as a rest day (Saturday and Sunday), and the rehabilitation hall can adopt a closed energy-saving strategy.
[0081] The method provided by the present invention can also be used to perform model recognition in different time periods. For example, if the model recognizes that there is no traffic from 12 noon to 1 pm, the model may recognize the scene as lunch break on a weekday.
[0082] Optionally, in step S1, the first input sequence X=[x new1 ,x new2 ,…,x newm ], the historical data of equipment utilization is x={x1,x2,…,x n}, where m is the total feature dimension after processing;
[0083] x new is the standardized value, x new The calculation formula is as follows:
[0084]
[0085] (1) In the formula, n is the length of the first input sequence, μ is the mean, and σ is the standard deviation.
[0086] For example, if there is equipment utilization data x = [0.6, 0.7, 0.8, 0.9, 1.0], first calculate the mean The standard deviation σ (assuming it is 0.15 calculated by the corresponding formula), then the standardized data is:
[0087]
[0088] Optionally, in step S2, for the first input sequence, a Transformer architecture is constructed by combining a multi-head self-attention layer, a feedforward neural network layer, and normalization and residual, including the following steps:
[0089] Step 201: Perform three different linear transformations on the first input sequence X to obtain a query vector Q, a key vector K, and a value vector V, where Q = XW Q , K = XW K , V = XW V ;
[0090] Among them, W Q , W K , W V They are the corresponding learnable weight matrices, both with dimensions of d×d K , assuming that the number of heads of multi-head attention is set to h, and d K =d / h.
[0091] Step 202: Calculate the attention score Attention(Q i ,K i ,V i ),
[0092]
[0093] (2) where i = 1, 2, ..., h; Q i ,K i ,V i It is the corresponding part after Q, K, V is split into h heads, and the dimension of each head is n×d k ; Q i and K i Transpose The dot product of .
[0094] In this embodiment, the attention weight adjustment based on domain knowledge is introduced: In the rehabilitation scenario, different time series data may have different importance weights. Let b be a learnable bias vector reflecting the importance of different features in the rehabilitation scenario, and D be a diagonal matrix containing time interval information, and the element Dii represents the function of the time interval between the i-th element and the i-th element (such as the inverse or normalized interval), and the formula is as follows:
[0095]
[0096] Step 203: Concatenate the attention outputs of each head and transform them through a linear transformation W O Get the final output of the multi-head self-attention layer:
[0097] MultiHead(Q,K,V)=
[0098] Concat(Attention(Q 1 ,K 1 ,V 1 ),...,Attention(Q h ,K h ,V h ))W O (3)
[0099] (3)W O The dimension is hd k ×d, and the final output dimension of the multi-head self-attention layer is still n×d.
[0100] Step 204: After the output from the multi-head self-attention layer, it is input to the feed-forward neural network layer. The feed-forward neural network layer FFN contains two linear transformations and an activation function. The expression of the feed-forward neural network layer FFN is as follows:
[0101] FFN(x)=max(0,xW 1 +b 1 )W 2 +b 2 (4)
[0102] (4)W 1 ,W 2 is the weight matrix of the linear transformation, b 1 ,b 2 is the bias term.
[0103] Step 205: After the multi-head self-attention layer and the feedforward neural network layer, a layer normalization operation and a residual connection are performed. The expression for the layer normalization operation is as follows:
[0104]
[0105] (5) In the formula, μ is the mean, σ 2 is the variance, ∈ is a value that prevents the denominator from being zero (for example, it can be set to 10 -5 ), γ and β are learnable scaling and translation parameters.
[0106] For example, the output of a multi-head self-attention layer or a feedforward neural network layer is H, and its mean μ and variance σ are calculated 2 :
[0107]
[0108] Then the normalization operation is performed through formula (6):
[0109]
[0110] (6) where γ and β are learnable scaling and translation parameters with dimension d, and ∈ is a very small number (e.g. 10-5).
[0111] For both the multi-head self-attention layer and the feedforward neural network layer, residual connections are used to add the input and output:
[0112] X attn =MultiHead(Q,K,V)+X (7)
[0113] X ffn =FFN(X attn )+X attn (8)
[0114] The above layers are combined together to form the complete Transformer architecture, as shown in the first formula:
[0115] X 0 =X
[0116] X l+1 =X 1 +FFN(LN(X 1 +MultiHead(LN(X l ))))for l=0,1,…,L-1
[0117] Where L is the number of stacked layers of the Transformer architecture; X is the first input sequence, with a dimension of n×d, where n is the length of the first input sequence and d is the feature dimension of each time step; X 0 is the initial value of the first input sequence; l is the index, starting from 0; X l is the input sequence of the lth layer; FFN is the feedforward neural network layer; LN is the layer normalization; MultiHead is the operation of the multi-head self-attention layer.
[0118] After L layers of Transformer layers, the final output can be converted into the desired prediction result through a linear prediction layer. Assuming that the dimension of the equipment requirements for different rehabilitation areas is to be predicted (for example, predicting the number of different equipment required for each area), the last layer is:
[0119] Y=X L W pred +b pred (9)
[0120] Where W pred is a learnable weight matrix of dimension d×m, b pred is a bias vector of dimension m, and Y is the required prediction vector, which represents the prediction results of the equipment requirements in each rehabilitation area.
[0121] Optionally, in step 204, the feedforward neural network layer uses a ReLU activation function, which is expressed as:
[0122] FFN(x)=ReLU(xW 1 +b 1 )W 2 +b 2 (10)
[0123] (10)W 1 is of dimension d×d ff The weight matrix, b 1 The dimension is d ff The bias vector, W 2 is of dimension d×d ff The weight matrix, b 2 is a bias vector of dimension d, d ff is the dimension of the intermediate layer of the feed-forward network.
[0124] Optionally, the loss function defined in step S3 is specifically: the loss function is defined by the mean square error, and the calculation formula of the mean square error loss function L is:
[0125]
[0126] in, is the predicted device demand vector, y is the actual device demand vector, n is the length of the vector, is the ith element of the predicted equipment demand vector, and yi is the ith element of the actual equipment demand vector.
[0127] Specifically, let the predicted equipment demand vector be The actual equipment demand vector is y. Assuming that the length of the vector is n (i.e., the dimension of the predicted or actual equipment demand, such as the number of equipment representing different rehabilitation areas), the calculation formula of the mean square error loss function L is as shown in formula (11):
[0128] In practical applications, this formula is used to measure the error between the predicted value and the true value. By minimizing this loss function, the Transformer-based prediction model can be trained to make the model's prediction results closer to the actual equipment requirements.
[0129] For example, suppose we have a simple case where the predicted equipment demand vector The actual equipment demand vector y = [12, 18, 32], then the mean square error loss is calculated as follows:
[0130]
[0131] Optionally, in step S3, the model parameters are updated by an optimization algorithm, and the process is repeated multiple times until the prediction model converges and the training is completed to obtain a trained prediction model, specifically:
[0132] The second formula is used for multiple iterations, and the model parameters are continuously adjusted to gradually reduce the loss function until the model converges. The second formula is:
[0133] θ t =θ t-1 -ηg θ (12)
[0134] Among them, θ is the model parameter, g θ is the gradient with respect to the model parameters, θ t is the model parameter at the current time t, θ t-1 is the model parameter of the previous moment, and η is the learning rate.
[0135] Specifically, let the gradient of the loss function with respect to the model parameter θ (including all learnable weights and bias parameters in the Transformer architecture) be g θ , then the formula for updating the model parameters each time is shown in (12), and the learning rate η controls the step size of the parameter update.
[0136] For example, suppose that in a certain iteration, the gradient g about a certain weight parameter θw is calculated θ =0.5, the weight parameter value θw at the previous moment t-1 =2.0, learning rate η = 0.1, then the updated weight parameters are:
[0137] θw t =θw t-1 -ηgθ=2.0-0.1×0.5=1.95
[0138] By iterating this process multiple times, the model parameters are continuously adjusted so that the loss function gradually decreases until the model converges (for example, the change in the loss function value is less than a set threshold or a predetermined number of training rounds is reached).
[0139] Optionally, the learning rate is determined by a third formula, which is expressed as follows:
[0140]
[0141] where η t is the learning rate at the tth iteration, η 0 is the initial learning rate and k is the decay coefficient.
[0142] Specifically, the choice of learning rate is very critical. In order to better balance the training speed and convergence effect of the model, a learning rate decay strategy can be adopted.
[0143] The learning rate decay formula is shown in (13). As the number of iterations t increases, the learning rate η t Gradually decrease, so that a larger learning rate can be used in the early stage of training to quickly approach the optimal solution, and a smaller learning rate can be used in the later stage of training to fine-tune the parameters and improve the accuracy of the model.
[0144] During the training process, you can also monitor the change of the loss function value. If you find that the loss function value no longer decreases or starts to increase after several consecutive iterations, it may mean that the model has converged or has problems such as overfitting. At this time, you can stop training in advance. For example, set the training to stop when the change of the loss function value in 10 consecutive iterations is less than 0.0001.
[0145] Optionally, step S6 is to construct a device adaptation recommendation system under scene recognition, including the following steps:
[0146] Step 601: For each identified scene category, establish a corresponding device adaptation strategy library.
[0147] Specifically, for each identified scenario category, a corresponding device adaptation strategy library is established. For example, for a "busy scenario", the strategy is to turn on all commonly used devices and reasonably arrange the priority of high-demand devices based on the patient flow and the distribution of treatment items; for an "idle scenario", the strategy is to turn off some non-critical devices and perform maintenance or energy-saving settings on the remaining devices.
[0148] Step 602: After inputting new data into the prediction model and identifying the current scene category, an equipment adaptation recommendation is generated according to the corresponding policy library. The recommendation content includes equipment on / off operation, equipment parameter settings, and personnel configuration suggestions.
[0149] Specifically, when new data is input into the prediction model and the current scenario category is identified, device adaptation recommendations are generated according to the corresponding policy library. The recommendations may include device on / off operations, device parameter settings (such as power adjustment, working mode switching), and staffing recommendations. For example, in the "morning rehabilitation training peak scenario", it is recommended to turn on all rehabilitation training equipment, adjust the power of physical therapy equipment to a higher level, and arrange more medical staff to assist patients in using the equipment.
[0150] Optionally, in step S7, model training and optimization are performed on the device adaptation recommendation system under scene recognition, specifically:
[0151] Step 701: In the device adaptation recommendation system under scene recognition, a loss function is defined by using a combination of classification loss and / or regression loss.
[0152] Specifically, in order to train the model, a suitable loss function needs to be defined. In the device adaptation recommendation system under scene recognition, a combination of classification loss (such as cross entropy loss, if scene recognition is a classification task) and regression loss (such as mean square error loss, if it involves the prediction of continuous variables such as device usage) can be used. For example, during the training process, it is necessary to minimize the probability of scene recognition errors and minimize the error between the device adaptation recommendation and the actual best adaptation.
[0153] Step 702: Select the Adam algorithm and / or the Adagrad algorithm to update the parameters of the model to minimize the loss function, and adopt batch training or early stopping training strategies to improve training efficiency and prevent overfitting.
[0154] Specifically, select a suitable optimization algorithm (such as Adam, Adagrad, etc.) to update the model parameters to minimize the loss function. At the same time, adopt a suitable training strategy, such as batch training and early-stopping, to improve training efficiency and prevent overfitting.
[0155] Optionally, during the training process, monitor the change of the loss function value. If it is found that the loss function value no longer decreases or starts to increase after several consecutive iterations, stop the training in advance.
[0156] When the model parameters are adjusted through multiple iterations of the second formula, the fourth formula is combined to improve efficiency and stability. The expression of the fourth formula is:
[0157] v t =βv t-1 -ηg θ (14)
[0158] θ t =θ t-1 +v t (15)
[0159] Among them, v t is the velocity at the current moment, and β is the momentum coefficient.
[0160] Specifically, during the training process, you can also monitor the change in the loss function value. If you find that the loss function value no longer decreases or starts to increase after several consecutive iterations, it may mean that the model has converged or has problems such as overfitting. At this time, you can stop training in advance. For example, set the training to stop when the change in the loss function value in 10 consecutive iterations is less than 0.0001.
[0161] In addition, in order to improve the efficiency and stability of the stochastic gradient descent algorithm, the momentum method can also be combined. The momentum method takes into account the direction and size of the previous parameter update when updating the parameters. For example, when β = 0.9, the current parameter update direction will be greatly affected by the previous parameter update direction, which helps to accelerate the convergence of the model in a relatively flat loss function area and can avoid falling into the local minimum to a certain extent.
[0162] It should be noted that, usually, the Transformer architecture uses position encoding to represent the position information of elements in the input sequence, such as sinusoidal position encoding:
[0163]
[0164] Where pos is the position, i is the dimension index, and d model is the dimension of the model.
[0165] In this embodiment, rehabilitation feature encoding is added to the Transformer architecture. In addition to the position encoding, additional encoding information is added according to the characteristics of the rehabilitation scene. According to the different states of patients contained in the time series data (such as the severity of the disease, the stage of treatment, etc.), a state encoding SE is designed and added to the position encoding:
[0166] X input =X+PE+SE (18)
[0167] In other embodiments, a specific rehabilitation information layer is also added: additional layers are added between the layers of the Transformer architecture to specifically process information specific to the rehabilitation scenario. A rehabilitation information processing layer is added between the multi-head self-attention layer and the feedforward neural network layer to preprocess or enhance certain key features of the rehabilitation data, as shown below:
[0168] Original architecture: input X->Multi-head self-attention layer MSA(X)->Feedforward neural network layer
[0169] After adjustment: input X->multi-head self-attention layer MSA(X)->rehabilitation information processing layer R(MSA(X))->feedforward neural network layer FFN(R(MSA(X)))
[0170] The standard Transformer architecture usually uses cross entropy loss or mean square error loss. In this embodiment, in the rehabilitation scenario, a composite loss function is designed as follows:
[0171] L=L prediction +αL energy +βL treatment (19)
[0172] Where L prediction is the loss of prediction error (such as mean square error), L energy is the loss related to energy saving effect (such as the difference between predicted energy saving effect and actual energy saving effect), L treatment is the loss associated with the treatment effect (e.g., error in treatment recommendation), and α and β are trade-off coefficients.
[0173] Dynamically adjust hyperparameters based on rehabilitation data: Dynamically adjust the hyperparameters of the Transformer architecture, such as the number of heads h, the number of layers N, etc., based on the characteristics of the rehabilitation data. Depending on the complexity of the rehabilitation data or the length of the time series, a heuristic rule is used:
[0174] h = round(log 2 (length of timeseries)) (20)
[0175] Adjust to residual connection with gating mechanism: Use gating mechanism to control the information flow of residual connection, as shown in formula (21):
[0176] X+σ(WX)Layer(X)(21)
[0177] Among them, W is a learnable matrix and σ is an activation function that can dynamically adjust the scale of residual connections according to the input X.
[0178] The method provided by the present invention for constructing a prediction model for equipment adaptation at different nodes in each treatment scenario solves the problems of waste of manpower, long waiting time, inability to reasonably arrange the order of rehabilitation projects for patients, inability to meet the personalized needs of patients, and energy waste in the prior art. This method uses historical data learning to build a model, while introducing real-time data to continuously train and correct the model, so that different scenarios can be identified, diagnosis and treatment loads can be intelligently predicted, energy-saving strategies can be intelligently recommended, and the optimal treatment project selection can be intelligently recommended in the current environment. Under the condition of ensuring the diagnosis and treatment volume, it can not only meet the personalized needs of patients for rehabilitation and achieve the best treatment quality, but also achieve the effect of intelligent energy saving.
[0179] The above is only the best specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for constructing a prediction model for device adaptation at different nodes in each treatment scenario, characterized in that: The following steps are involved: Collect historical data on the utilization rate of equipment in different rehabilitation areas, standardize the historical data using a first formula, and concatenate them to form a first input sequence X; For the first input sequence, a Transformer architecture is constructed by combining a multi-head self-attention layer, a feedforward neural network layer, and normalization and residual to obtain a prediction model, which is shown in the first formula: X0=X X l+1 =X1+FFN(LN(X1+MultiHead(LN(X l ))))forl=0,1,…,L-1 Where L is the number of stacked layers of the Transformer architecture; X is the first input sequence, with a dimension of n×d, where n is the length of the first input sequence and d is the feature dimension of each time step; X0 is the initial value of the first input sequence; l is the index, starting from 0; X l is the input sequence of the lth layer; FFN is the feedforward neural network layer; LN is the layer normalization; MultiHead is the operation of the multi-head self-attention layer; Inputting the first input sequence into the prediction model in batches, defining a loss function, updating the model parameters through an optimization algorithm, repeating the process multiple times until the prediction model converges and training is completed to obtain a trained prediction model; Standardizing the historical data of the target time period to form a second input sequence, inputting the second input sequence into the trained prediction model, and outputting a prediction vector of the equipment demand in each rehabilitation area; Clustering the prediction vectors into different scene categories and labeling each of the scene categories; According to different scene categories, establish a device adaptation strategy library and build a device adaptation recommendation system under scene recognition; The device adaptation recommendation system under the scenario recognition is trained and optimized, and a portion of the reserved verification data is used to evaluate the performance of the model and the accuracy of the device adaptation recommendation. According to the evaluation results, the model is adjusted, the data preprocessing method is optimized, or the strategy library is improved.
2. The method for constructing a prediction model for equipment adaptation at different nodes in each treatment scenario according to claim 1, characterized in that: The first input sequence X=[x new1 ,x new2 ,…,x newm ], the historical data of equipment utilization is x={x1,x2,…,x n } Among them, m is the total feature dimension after processing; x new is the standardized value, x new The calculation formula is as follows: Where n is the length of the first input sequence, μ is the mean, and σ is the standard deviation.
3. The method for constructing a prediction model for device adaptation at different nodes in each treatment scenario according to claim 1, characterized in that: The first input sequence is constructed by combining a multi-head self-attention layer, a feedforward neural network layer, and normalization and residual to form a Transformer architecture, including the following steps: The first input sequence X is transformed by three different linear transformations to obtain the query vector Q, key vector K, and value vector V, Q = XW Q , K = XW K , V = XW V ; Among them, W Q , W K , W V They are the corresponding learnable weight matrices, both with dimensions of d×d K ; For each head i, calculate the attention score Attention(Q i ,K i ,V i ), where i = 1, 2, ..., h; Q i ,K i ,V i It is the corresponding part after Q, K, V is split into h heads, and the dimension of each head is n×d k ; Q i and K i Transpose The dot product of The attention outputs of each head are concatenated and transformed through a linear transformation W O Get the final output of the multi-head self-attention layer: MultiHead(Q,K,V)= Concat(Attention(Q1,K1,V1),...,Attention(Q h ,K h ,V h ))W O Among them, W O The dimension is hd k ×d, the output dimension of the multi-head self-attention layer is n×d; After the output from the multi-head self-attention layer, it is input to the feedforward neural network layer. The feedforward neural network layer FFN contains two linear transformations and an activation function. The expression of the feedforward neural network layer FFN is as follows: FFN(x)=max(0,xW1+b1)W2+b2 Among them, W1, W2 are weight matrices of linear transformation, b1, b2 are bias terms; After the multi-head self-attention layer and the feedforward neural network layer, layer normalization and residual connection are performed. The expression for layer normalization is as follows: Among them, μ is the mean, σ 2 is the variance, ∈ is a value to prevent the denominator from being zero, and γ and β are learnable scaling and translation parameters.
4. The method for constructing a prediction model for device adaptation at different nodes in each treatment scenario according to claim 3, characterized in that: The feedforward neural network layer uses the ReLU activation function, which is expressed as: FFN(x)=ReLU(xW1+b1)W2+b2 Among them, W1 is a d×d ff The weight matrix of b1 is of dimension d ff The bias vector W2 is of dimension d×d ff The weight matrix of b2 is the bias vector of dimension d. ff is the dimension of the intermediate layer of the feed-forward network.
5. The method for constructing a prediction model for device adaptation at different nodes in each treatment scenario according to any one of claims 1 to 4, characterized in that: The loss function is defined as follows: the loss function is defined by the mean square error, and the calculation formula of the mean square error loss function L is: in, is the predicted device demand vector, y is the actual device demand vector, n is the length of the vector, is the i-th element of the predicted equipment demand vector, y i is the i-th element of the true equipment demand vector.
6. The method for constructing a prediction model for device adaptation at different nodes in each treatment scenario according to claim 5, characterized in that: The updating of the model parameters by the optimization algorithm is repeated multiple times until the prediction model converges and the training is completed to obtain a trained prediction model, specifically: The second formula is used for multiple iterations to continuously adjust the model parameters so that the loss function gradually decreases until the model converges. The second formula is: i t =θ t-1 -ηg θ Among them, θ is the model parameter, g θ is the gradient with respect to the model parameters, θ t is the model parameter at the current time t, θ t-1 is the model parameter of the previous moment, and η is the learning rate.
7. The method for constructing a prediction model for device adaptation at different nodes in each treatment scenario according to claim 6, characterized in that: The learning rate is determined by the third formula, and the third formula is expressed as follows: where η t is the learning rate of the tth iteration, η0 is the initial learning rate, and k is the decay coefficient.
8. The method for constructing a prediction model for device adaptation at different nodes in each treatment scenario according to any one of claims 1 to 4, characterized in that: The construction of the device adaptation recommendation system under scene recognition includes the following steps: For each identified scenario category, a corresponding device adaptation strategy library is established; After inputting new data into the prediction model and identifying the current scenario category, an equipment adaptation recommendation is generated according to the corresponding policy library. The recommendation content includes equipment on / off operation, equipment parameter settings, and personnel configuration suggestions.
9. The method for constructing a prediction model for device adaptation at different nodes in each treatment scenario according to claim 8, characterized in that: The model training and optimization of the device adaptation recommendation system under scene recognition is specifically as follows: in the device adaptation recommendation system under scene recognition, a loss function is defined by a combination of classification loss and / or regression loss; Select the Adam algorithm and / or Adagrad algorithm to update the model parameters to minimize the loss function, and use batch training or early stopping training strategies to improve training efficiency and prevent overfitting.
10. The method for constructing a prediction model for equipment adaptation at different nodes in each treatment scenario according to claim 6 or 7, characterized in that: During the training process, the change of the loss function value is monitored. If it is found that the loss function value no longer decreases or starts to increase after several consecutive iterations, the training is stopped in advance; When the model parameters are adjusted through multiple iterations of the second formula, the fourth formula is combined to improve efficiency and stability. The expression of the fourth formula is: v t =βv t-1 -ηg θ i t =θ t-1 +v t Among them, v t is the velocity at the current moment, and β is the momentum coefficient.