A medical text classification test method, device and storage medium

By combining metaheuristic algorithms and Bayesian optimization algorithms, the optimal combination of hyperparameters for the medical text classification model was found, solving the problems of low accuracy and low efficiency in existing medical text classification technologies, and achieving more efficient and accurate medical text classification.

CN120973951BActive Publication Date: 2026-03-10NANJING UNIV OF POSTS & TELECOMM
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-17
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing medical text classification methods have low accuracy in medical applications. Traditional optimization algorithms are inefficient and difficult to deploy. The BERT model lacks medical corpus adaptation, which leads to reduced classification accuracy and makes it prone to getting stuck in local optima.

Method used

By combining the global search of the metaheuristic algorithm with the local optimization of the Bayesian optimization algorithm, and using the goat optimization algorithm's jump strategy and Bayesian local optimization, the optimal hyperparameter combination of the medical text classification model is found. Feature extraction and optimization are then performed using a medical knowledge graph.

Benefits of technology

It significantly improves the accuracy and efficiency of medical text classification, enhances the model's classification accuracy and recall, strengthens the understanding of complex medical concepts, and provides a more efficient and accurate medical text classification solution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120973951B_ABST
    Figure CN120973951B_ABST
Patent Text Reader

Abstract

This invention discloses a medical text classification testing method, device, and storage medium, belonging to the interdisciplinary field of natural language processing and machine learning. The method includes: inputting acquired medical case text data into a pre-constructed medical text classification model for feature vector extraction to obtain medical text feature vectors; based on the medical text feature vectors, using a metaheuristic algorithm to globally optimize the hyperparameters of the medical text classification model to obtain a globally optimized hyperparameter combination; according to the globally optimized hyperparameter combination, using Bayesian optimization to fine-tune the local hyperparameters of the medical text classification model to obtain an optimized medical text classification model; and applying the medical text classification model to obtain text classification test results. This invention solves the problems of high false negative rates and low classification accuracy in traditional medical text classification methods, significantly improving the accuracy and efficiency of medical text classification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a medical text classification test method, device, and storage medium, belonging to the interdisciplinary field of natural language processing and machine learning. Background Technology

[0002] Medical text classification, as a novel form of smart healthcare, directly impacts the reliability of key applications such as disease early warning and assisted diagnosis through its accuracy and disease recall rates. As a primary carrier of medical information, medical text differs from ordinary text. It exhibits terminological heterogeneity (e.g., "T2DM" versus "type 2 diabetes"), privacy sensitivity, and semantic complexity (long texts account for over 60%), making it difficult for traditional feature engineering methods to effectively capture deep semantic relationships. Applying existing pre-trained models like BERT directly to the medical field suffers from significantly reduced accuracy due to a lack of medical corpus adaptation and insufficient hyperparameter tuning. Furthermore, existing BERT model parameter tuning and optimization methods, such as grid search and random search, converge slowly in high-dimensional parameter spaces, affecting experimental efficiency.

[0003] In addition, mainstream optimization algorithms also have significant drawbacks. For example, genetic algorithms have high memory consumption, making them difficult to deploy on medical devices; ant colony optimization algorithms have a high proportion of local optima. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide a medical text classification test method, device and storage medium. It combines the global search of the metaheuristic algorithm with the local optimization of the Bayesian optimization algorithm. By using these two optimization algorithms, the optimal hyperparameter combination of the model is found and applied to medical text classification. This solves the problems of high false negative rate and low classification accuracy of traditional medical text classification methods, and significantly improves the accuracy and efficiency of medical text classification.

[0005] To achieve the above objectives, the present invention is implemented using the following technical solution:

[0006] In a first aspect, the present invention provides a medical text classification testing method, comprising: acquiring current medical text, inputting it into a pre-optimized and trained medical text classification model, and acquiring text classification test results; wherein, the optimization and training method of the medical text classification model comprises: inputting the acquired medical case text data into a pre-constructed medical text classification model for feature vector extraction to obtain medical text feature vectors; based on the medical text feature vectors, using a metaheuristic algorithm to globally optimize the hyperparameters of the medical text classification model to obtain a globally optimized hyperparameter combination; using Bayesian optimization to fine-tune the local hyperparameters of the medical text classification model according to the globally optimized hyperparameter combination to obtain an optimized medical text classification model; and using medical case text data to train the optimized medical text classification model to obtain the optimized and trained medical text classification model.

[0007] Furthermore, the method also includes: preprocessing the medical case text data, specifically as follows: performing text clarification and standardization processing on the medical case text data, including removing invalid characters, duplicate data, and meaningless data from the text, performing preliminary association verification between medical entities involved in the text and entities in the knowledge graph, and standardizing terminology to obtain first text data; generating second text data that is semantically consistent but does not contain privacy information using a generative privacy-preserving method on the first text data; segmenting the second text data using the Jieba word segmentation tool and loading a Chinese medical dictionary, and simultaneously optimizing the word segmentation of the second text data by combining knowledge graph information to obtain third text data; removing general stop words and medical-specific stop words from the third text data to obtain fourth text data; and dividing the fourth text data into training set, validation set, and test set according to a preset ratio to complete the preprocessing.

[0008] Furthermore, the process of inputting the acquired medical case text data into a pre-built medical text classification model for feature vector extraction, and obtaining medical text feature vectors, includes: acquiring medical case text data; segmenting and truncating long text content in the medical case text data; dividing the long text into several continuous sub-texts according to a preset text length threshold; and extracting feature vectors from the segmented continuous sub-texts, using the following formula:

[0009] (1)

[0010] in, It enhances text features. It is the sigmoid activation function. It is the current i-th text feature. It is a characteristic of knowledge. It is the i-th gate signal. It is a fusion weight matrix. It's a bias. This indicates concatenation; the enhanced text features are normalized to obtain the processed medical text feature vector.

[0011] Furthermore, the step of using a metaheuristic algorithm to globally optimize the hyperparameters of the medical text classification model based on medical text feature vectors to obtain globally optimized hyperparameter combinations includes: Step 1: Reading the processed medical text feature vectors and defining the hyperparameter search space of the medical text classification model according to the control parameters set by the metaheuristic algorithm; Step 2: Randomly generating a certain number of hyperparameter combination individuals within the hyperparameter search space to construct an initial population and initializing the fitness of each hyperparameter combination individual. The fitness function formula is as follows:

[0012] (4)

[0013] in, The fitness of each individual hyperparameter combination , , For adjustable weighting coefficients, , For recall rate, For F1 score, To improve the accuracy of the medical knowledge graph association; Step 3: Based on the principle of the goat optimization algorithm, update the position of hyperparameter combination individuals in the population; Step 4: Recalculate the updated fitness value of each hyperparameter combination individual, and retain the hyperparameter combination individuals with better fitness values; Step 5: Compare the current fitness with the historical best solution, and update the best solution of the hyperparameter combination individual and the global best solution; Step 6: Repeat steps 3-5 until the preset termination condition is met; Step 7: Obtain the globally optimized hyperparameter combination.

[0014] Further, the step of fine-tuning the local hyperparameters of the medical text classification model using Bayesian optimization based on the globally optimized hyperparameter combination to obtain the optimized medical text classification model includes: Step 1: Constructing a Gaussian process surrogate model based on the globally optimized hyperparameter combination, and testing the accuracy of the Gaussian process surrogate model using a validation set to obtain the validation set evaluation results; Step 2: Updating the posterior distribution of the Gaussian process surrogate model according to Bayesian rules using the evaluation results on the validation set. The formula for calculating the posterior distribution is:

[0015] (8)

[0016] in, Denotes the posterior distribution. Describe the objective function. Let D represent the prior distribution, and D be the evaluation result of the validation set. Marginal probability, Assumption Under the given conditions, the probability of observing data D; Step 3: Determine the sampling points for the next hyperparameter combination using the expected boost acquisition function. The formula for calculating the expected boost acquisition function is:

[0017] (9)

[0018] in, To improve the acquisition function, It is the currently observed optimal objective function value. It is the mean of the objective function at the new sampling point x predicted by the Gaussian process model. It is the predicted standard deviation at point x. For standardization improvement quantities; It is the cumulative distribution function of the standard normal distribution. Step 4: Obtain a new hyperparameter combination from the sampling points, apply the new hyperparameter combination to the medical text classification model, evaluate and update the posterior distribution of the Severus surrogate model on the validation set; Step 5: Repeat steps 3-4 until the convergence condition is met or the preset number of fine-tuning steps is reached; Step 6: Output the final optimized hyperparameter combination, apply the final optimized hyperparameter combination to obtain the optimized medical text classification model.

[0019] Furthermore, the hyperparameter search space includes learning rate, batch size, weight decay, dropout rate, knowledge graph fusion weights, and training epochs.

[0020] Furthermore, updating the positions of individuals with hyperparameter combinations in the population based on the goat optimization algorithm principle includes: generating an initial population, using the formula:

[0021] (3)

[0022] in, For the initial population, This represents the minimum value that each optimization variable can take. Let rand(d) represent the maximum value that each optimization variable can take, and rand(d) is a randomly generated d-dimensional random vector; each hyperparameter combination explores the search space by moving randomly, and its new position is updated by the following formula:

[0023] (5)

[0024] in, It represents the position of the i-th hyperparameter combination at iteration t+1. It represents the position of the i-th hyperparameter combination in iteration t. These are the exploration coefficients, and R is a random variable drawn from a Gaussian distribution; the hyperparameter combination individuals gradually move towards the current optimal solution, and their position update formula is:

[0025] (6)

[0026] in, This is the current optimal solution. It is the development coefficient; the jump strategy assists individuals with hyperparameter combinations to escape local optima, and its position update formula is:

[0027] (7)

[0028] in, It is the jump coefficient. The hyperparameter combination individuals are randomly selected; for hyperparameter combination individuals whose fitness value is lower than the population set ratio, the parasite avoidance strategy is adopted, that is, their position is reset to a randomly generated new position, and the reset formula is the same as formula (5).

[0029] Furthermore, the method also includes: calculating the F1 score of the medical text classification model and the knowledge graph association accuracy based on the text classification test results, wherein the knowledge graph association accuracy... The calculation formula is as follows:

[0030] (13)

[0031] Where N is the total number of medical entities identified by the statistical model on the test set. The number of entities that are correctly linked to the standard nodes of the knowledge graph.

[0032] In a second aspect, a medical text classification testing device is provided, comprising: a memory for storing computer programs / instructions; and a processor for executing the computer programs / instructions to implement the steps of the method described in the first aspect.

[0033] Thirdly, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the method described in the first aspect. Compared with the prior art, the beneficial effects achieved by the present invention are:

[0034] 1. This invention provides a medical text classification testing method, device, and storage medium, which combines the global search of the metaheuristic algorithm with the local optimization of the Bayesian optimization algorithm. By using these two optimization algorithms, the optimal hyperparameter combination of the model is found and applied to medical text classification, which solves the problems of high false negative rate and low classification accuracy of traditional medical text classification methods, and significantly improves the accuracy and efficiency of medical text classification.

[0035] 2. This invention utilizes the advantages of the goat optimization algorithm's skip strategy, which makes it less prone to getting trapped in local optima, and the fast speed of Bayesian local optimization. This overcomes the problems of traditional BERT models, which rely on human experience for hyperparameter tuning and are prone to getting trapped in local optima, thereby improving the model's classification accuracy and recall.

[0036] 3. The medical text classification model of this invention deeply integrates medical knowledge graphs. Compared with the traditional BERT model, it can better understand complex medical concepts and relationships when processing medical texts, improving the accuracy and depth of semantic understanding. Furthermore, the fitness function constructed in this invention comprehensively considers classification accuracy, F1 score, and knowledge graph association accuracy, providing a more comprehensive and accurate evaluation standard for hyperparameter optimization.

[0037] 4. This invention combines metaheuristic algorithms with medical text classification models to develop a medical text classification method. For medical text data that is highly specialized, semantically complex, and contains a large amount of professional knowledge, this invention can fully leverage the advantages of optimized algorithms and models. This not only significantly improves the accuracy and efficiency of medical text classification but also enhances the model's ability to utilize and generalize medical knowledge, providing a more efficient, accurate, and clinically practical solution for medical text classification. Attached Figure Description

[0038] Figure 1 This is a flowchart of a medical text classification test method provided in an embodiment of the present invention;

[0039] Figure 2 This is a flowchart of the metaheuristic algorithm provided in the embodiments of the present invention;

[0040] Figure 3 This is a flowchart of Bayesian local optimization provided in an embodiment of the present invention. Detailed Implementation

[0041] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.

[0042] Example 1: This example introduces a medical text classification test method, including:

[0043] Obtain the current medical text, input it into a pre-optimized and trained medical text classification model, and obtain the text classification test results;

[0044] The optimization and training methods for the medical text classification model include:

[0045] The acquired medical case text data is input into a pre-built medical text classification model to extract feature vectors and obtain medical text feature vectors.

[0046] Based on medical text feature vectors, a metaheuristic algorithm is used to globally optimize the hyperparameters of the medical text classification model, and obtain the globally optimized hyperparameter combination.

[0047] Based on the globally optimized hyperparameter combination, Bayesian optimization is used to fine-tune the local hyperparameters of the medical text classification model to obtain the optimized medical text classification model.

[0048] The optimized medical text classification model was trained using medical case text data to obtain the optimized and trained medical text classification model.

[0049] like Figure 1 As shown, the medical text classification testing method provided in this embodiment involves the following steps in its application process:

[0050] Step 1: Collect medical case text data and initialize the dataset. Detailed data preprocessing and initialization steps are as follows:

[0051] Step 1-1: Perform text cleaning and standardization on the collected medical case text data, including removing invalid characters, duplicate data and meaningless data from the text, as well as standardizing terms (e.g., replacing "T2DM" with "type 2 diabetes").

[0052] Steps 1-2: Using a generative privacy-preserving method, generate semantically consistent medical text that does not contain privacy information. For example, "Zhang Moumou, male, 47 years old" is transformed into "Patient X, male, middle-aged".

[0053] Steps 1-3: Use Jieba word segmentation and load a Chinese medical dictionary to segment the cleaned medical text, and at the same time combine knowledge graph information to optimize the word segmentation of the cleaned medical text;

[0054] Steps 1-4: Remove general stop words and medical-specific stop words from medical texts;

[0055] Steps 1-5: Divide the training set, validation set, and test set according to the preset ratio.

[0056] Step 2: Use a medical text classification model to extract feature vectors from the medical texts processed in Step 1, obtaining the feature representation for each text sample. The detailed feature vector extraction steps are as follows:

[0057] Step 2-1: Divide and truncate the long text content into blocks, and divide the long text into several continuous sub-blocks according to the preset text length threshold (512 tokens);

[0058] Step 2-2: Use the following formula to extract feature vectors, leveraging its fusion with medical knowledge graphs to enhance feature representation;

[0059] (1)

[0060] in, It enhances text features. It is the sigmoid activation function. It is the current i-th text feature. It is a characteristic of knowledge. It is the i-th gate signal, used to reduce noise introduced by knowledge. It is a fusion weight matrix. It's a bias. Indicates splicing.

[0061] Steps 2-3: Normalize the obtained feature vectors. The specific calculation formula is as follows:

[0062] (2)

[0063] Where X is the feature vector. The feature vectors after normalization. Let L be the L2 norm of the eigenvector X;

[0064] Step 3: Optimize global hyperparameters using the aforementioned metaheuristic algorithm. For example... Figure 2 The flowchart of the metaheuristic algorithm is as follows, and its specific steps are as follows:

[0065] Step 3-1: Read the processed medical text dataset, set the control parameters of the metaheuristic algorithm, and define the search space of the hyperparameters of the medical text classification model.

[0066] The control parameters of the metaheuristic algorithm include: population size, position update coefficient, maximum number of iterations, and convergence threshold.

[0067] The hyperparameter search space includes, but is not limited to:

[0068] Learning rate (lr): logarithmically uniformly distributed in the interval [1e-6, 1e-4];

[0069] Batch size (batch_size): set of discrete values ​​{16, 32, 64, 128};

[0070] Weight decay (weight_decay): a set of discrete values ​​{0.00, 0.01};

[0071] Dropout rate: uniformly distributed in the range [0.1, 0.5];

[0072] Knowledge graph fusion weight (kg_weight): uniformly distributed in the interval [0.1, 0.9];

[0073] Training epochs: evenly distributed in the interval [3, 20].

[0074] Step 3-2: Within the hyperparameter search space, randomly generate a certain number of goat individuals (i.e., hyperparameter combinations), construct the initial population, and initialize the fitness of each individual.

[0075] The initial population generation formula is:

[0076] (3)

[0077] in, For the initial population, This represents the minimum value that each optimization variable can take, i.e., the lower bound of the variable. This represents the maximum value that each optimization variable can take, i.e., the upper bound of the variable. rand(d) is a randomly generated d-dimensional random vector with values ​​ranging from [0,1].

[0078] The fitness function is constructed as follows:

[0079] (4)

[0080] in, The fitness of each individual hyperparameter combination , , For adjustable weighting coefficients, , The value range is [0.3, 0.5]. The value range is [0.2, 0.4]. The value range is [0.2, 0.4]. For recall rate, For F1 score, The accuracy of the medical knowledge graph association is defined, with a value range of [0,1].

[0081] Step 3-3: Based on the principle of metaheuristic algorithm, simulate the adaptive foraging strategy, jumping mechanism and parasite avoidance behavior of goats, update the position of individual goats in the population, and adjust the hyperparameter combination.

[0082] Each individual goat explores the search space by moving randomly, and its new position is updated using the following formula:

[0083] (5)

[0084] in, It represents the position of the i-th goat individual in iteration t+1. It represents the position of the i-th goat individual in iteration t. R is the exploration coefficient, and R is a random variable drawn from a Gaussian distribution.

[0085] The individual goats gradually move towards the current optimal solution to refine the solution's quality. Their position update formula is:

[0086] (6)

[0087] in, This is the current optimal solution. It is the development coefficient.

[0088] Individual goats use a jumping strategy to escape local optima, and their position update formula is as follows:

[0089] (7)

[0090] in, It is the jump coefficient. It is a randomly selected goat individual.

[0091] For goat individuals with fitness values ​​in the bottom 20% of the population, a parasite avoidance strategy is employed, which involves resetting their location to a randomly generated new location to maintain population diversity and robustness. The reset formula is the same as the initial population generation formula.

[0092] Steps 3-4: Recalculate the updated fitness value for each individual goat and retain the individuals with the best fitness values;

[0093] Steps 3-5: Compare the current fitness with the historical best solution, and update the individual best solution and the global best solution;

[0094] Step 3-6: Repeat steps 3-3 to 3-5 until a preset termination condition is met, wherein the termination condition includes at least one of the following:

[0095] Reaching the maximum number of iterations T;

[0096] The global optimal solution shows no improvement after K consecutive iterations, where K≥5;

[0097] The change in fitness is less than the threshold ;

[0098] The algorithm's memory usage exceeds the threshold M.

[0099] Steps 3-7: Output the globally optimized hyperparameter combination as the initial values ​​for Bayesian optimization.

[0100] Step 4: Fine-tune local hyperparameters using Bayesian optimization. For example... Figure 3 As shown, the specific process of Bayesian optimization for local fine-tuning is as follows:

[0101] Step 4-1: Using the optimal set of hyperparameter combinations obtained by the metaheuristic algorithm as the initial value, select the Gaussian process as the surrogate model, model the relationship between the performance of the medical text classification model and the hyperparameters, and establish prior knowledge;

[0102] Step 4-2: Using the evaluation results on the validation set, update the posterior distribution of the surrogate model according to Bayesian rules. The formula for calculating the posterior distribution is:

[0103] (8)

[0104] in, Denotes the posterior distribution. Describe the objective function. Let D represent the prior distribution, and D be the evaluation result of the validation set. Marginal probability, Assumption Given the condition that the data D is true, the probability of observing the data D.

[0105] Step 4-3: Determine the next hyperparameter sampling point using the expected boost acquisition function. The formula for calculating the expected boost acquisition function is:

[0106] (9)

[0107] in, To improve the acquisition function, It is the currently observed optimal objective function value. It is the mean of the objective function at the new sampling point x predicted by the Gaussian process model. It is the predicted standard deviation at point x. For standardization improvement quantities; It is the cumulative distribution function (CDF) of the standard normal distribution; It is the probability density function (PDF) of the standard normal distribution.

[0108] Step 4-4: Apply the newly sampled hyperparameter combination to the medical text classification model, evaluate and update the posterior distribution of the surrogate model on the validation set;

[0109] Step 4-5: Repeat steps 4-3 to 4-4 until the convergence condition is met or the preset number of fine-tuning iterations is reached;

[0110] Steps 4-6: Output the final optimized hyperparameter combination, which is used to train the final medical text classification model.

[0111] Step 5: Apply the optimized medical text classification model to a medical text classification task, evaluate the model performance on the test set, and compare the differences in F1 score, recall rate, DCA curve and other indicators before and after parameter tuning to verify the effect of parameter optimization.

[0112] Recall rate The calculation formula is:

[0113] (10)

[0114] Accuracy The calculation formula is:

[0115] (11)

[0116] The formula for calculating the F1 score is:

[0117] (12)

[0118] In this context, TP represents a true positive instance, which is predicted to be positive and is actually positive; FP represents a false positive instance, which is predicted to be positive but is actually negative; FN represents a false negative instance, which is predicted to be negative but is actually positive; and TN represents a true negative instance, which is predicted to be negative and is actually negative.

[0119] The accuracy of associations in knowledge graphs The correct ratio of medical entities identified by the computational model to their corresponding entities in the knowledge graph is derived from the following formula:

[0120] (13)

[0121] Net return of the DCA curve The calculation formula is:

[0122] (14)

[0123] Where N is the total number of samples, that is, the total number of medical entities identified by the statistical model on the test set. This represents the decision threshold probability (0-1). The false positive penalty coefficient is represented. A DCA curve is plotted with all patients treated (horizontal line), all patients not treated (x-axis), and the model-guided decision curve (net benefit curve). Based on the DCA curve, the model predictions can be converted into quantifiable clinical value, thereby evaluating the model's clinical applicability.

[0124] Example 2: This example provides a medical text classification testing device, including:

[0125] Memory, used to store computer programs / instructions;

[0126] A processor for executing the computer program / instructions to implement the steps of any of the methods described in Embodiment 1.

[0127] Example 3: This example provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the methods described in Example 1.

[0128] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

[0129] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0130] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0131] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0132] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this disclosure and not to limit its protection scope. Although this disclosure has been described in detail with reference to the above embodiments, those skilled in the art should understand that after reading this disclosure, they can still make various changes, modifications or equivalent substitutions to the specific implementation of the invention, but these changes, modifications or equivalent substitutions are all within the protection scope of the pending claims.

Claims

1. A medical text classification test method characterized by, The method comprises the following steps: acquiring current medical text and inputting the medical text into a pre-optimized and trained medical text classification model to obtain a text classification test result; wherein the optimization and training method of the medical text classification model comprises: inputting the acquired medical case text data into a pre-constructed medical text classification model to extract a feature vector and obtain a medical text feature vector; based on the medical text feature vector, using a meta-heuristic algorithm to globally optimize the hyperparameters of the medical text classification model and obtain a globally optimized hyperparameter combination, comprising: step 1: reading the processed medical text feature vector and defining the hyperparameter search space of the medical text classification model according to the control parameters set by the meta-heuristic algorithm; step 2: randomly generating a certain number of hyperparameter combination individuals in the hyperparameter search space, constructing an initial population, and initializing the fitness of each hyperparameter combination individual, the fitness function formula being as follows: (4); wherein, fitness of each hyperparameter combination individual, , , adjustable weight coefficient, , recall rate, F1 score, medical knowledge graph correlation accuracy; step 3: updating the position of the hyperparameter combination individual in the population according to the principle of the goat optimization algorithm; step 4: recalculating the fitness of each hyperparameter combination individual after updating, and retaining the hyperparameter combination individual with better fitness; step 5: comparing the current fitness with the historical optimal solution, and updating the hyperparameter combination individual optimal solution and the global optimal solution; step 6: repeating steps 3-5 until the preset termination condition is met; step 7: obtaining the globally optimized hyperparameter combination; using Bayesian optimization to fine-tune the local hyperparameters of the medical text classification model according to the globally optimized hyperparameter combination, and obtaining an optimized medical text classification model; training the optimized medical text classification model using medical case text data to obtain an optimized and trained medical text classification model.

2. The medical text classification test method of claim 1, wherein, The method further comprises pre-processing the medical case text data, and the specific process is as follows: performing text cleaning and standardization processing on the medical case text data, including removing invalid characters, duplicate data and meaningless data in the text, simultaneously performing preliminary association verification on medical entities involved in the text and entities in the knowledge graph, and standardizing the terms to obtain first text data; using a generative privacy protection method to generate second text data that is semantically consistent but does not contain privacy information from the first text data; using the Jieba segmentation tool and loading a Chinese medical dictionary to segment the second text data, and simultaneously combining knowledge graph information to optimize the segmentation of the second text data to obtain third text data; removing general stop words and medical field-specific stop words from the third text data to obtain fourth text data; dividing the fourth text data into a training set, a validation set and a test set according to a preset proportion to complete the preprocessing.

3. The medical text classification test method of claim 1, wherein, The method of inputting the acquired medical case text data into a pre-constructed medical text classification model to extract a feature vector and obtain a medical text feature vector comprises: acquiring medical case text data, segmenting and truncating long text content in the medical case text data, and dividing the long text into a plurality of continuous subtexts according to a preset text length threshold; extracting a feature vector from the divided plurality of continuous subtexts, and the formula being as follows: (1) wherein, is an enhanced text feature, is a sigmod activation function, is a current i-th text feature, is a knowledge feature, is an i-th gating signal, is a fusion weight matrix, is a bias, denotes concatenation; The enhanced text features are normalized to obtain processed medical text feature vectors.

4. The medical text classification test method of claim 1, wherein, The optimized medical text classification model is obtained by performing local hyperparameter fine-tuning on the medical text classification model according to the hyperparameter combination after global optimization, including: Step 1: Construct a Gaussian process surrogate model according to the hyperparameter combination after global optimization, test the accuracy of the Gaussian process surrogate model by using a validation set, and obtain a validation set evaluation result; Step 2: Update the posterior distribution of the Gaussian process surrogate model according to the Bayesian rule by using the evaluation result on the validation set, and the calculation formula of the posterior distribution is: (8) wherein, represents a posterior distribution, represents an objective function, represents a prior distribution, D is a validation set evaluation result, is a marginal probability, is a hypothesis holds, the probability of observing the data D. Step 3: Determine the sampling point of the next hyperparameter combination by using the expected improvement acquisition function, and the calculation formula of the expected improvement acquisition function is: (9) wherein is the expected improvement acquisition function, is the current observed optimal objective function value, is the Gaussian process model predicted mean of the objective function at a new sample point x, is the predicted standard deviation at point x, is the normalized improvement; is the cumulative distribution function of the standard normal distribution, is the probability density function of the standard normal distribution; Step 4: Sample a new hyperparameter combination from the sampling point, apply the new hyperparameter combination to the medical text classification model, evaluate and update the posterior distribution of the Gaussian process surrogate model on the validation set; Step 5: Repeat steps 3-4 until the convergence condition is met or the preset fine-tuning number is reached; Step 6: Output the final optimized hyperparameter combination, and apply the final optimized hyperparameter combination to obtain the optimized medical text classification model.

5. The medical text classification test method of claim 1, wherein, The hyperparameter search space includes learning rate, batch size, weight decay, dropout rate, knowledge graph fusion weight, and training round.

6. The medical text classification test method of claim 1, wherein, The position of the hyperparameter combination individual in the population is updated according to the principle of the goat optimization algorithm, including: Generate an initial population, and the formula is: (3) wherein, is the initial population, represents the minimum value that each optimization variable can take, represents the maximum value that each optimization variable can take, and rand(d) is a randomly generated d-dimensional random vector; Each hyperparameter combination individual explores the search space by random movement, and the update formula of the new position is: (5) wherein, is the position of the i-th hyperparameter combination individual at iteration t+1, is the position of the i-th hyperparameter combination individual at iteration t, is an exploration coefficient, R is a random variable drawn from a Gaussian distribution; The hyperparameter combination individual gradually moves to the current optimal solution, and the position update formula is: (6) wherein, is the current optimal solution, is the development coefficient; The position update formula of the hyperparameter combination individual is: (7) wherein, is a hop coefficient, is a randomly selected hyperparameter combination individual; For hyperparameter combination individuals with fitness values lower than the set proportion of the population, the avoidance of parasitic strategy is adopted, that is, the position is reset to a randomly generated new position, and the reset formula is the same as formula (5).

7. The medical text classification test method of claim 1, wherein, The method further comprises: calculating an F1 score of the medical text classification model and knowledge graph association accuracy according to the text classification test result, wherein the knowledge graph association accuracy The calculation formula is as follows: (13) where N is the total number of medical entities identified by the statistical model on the test set, the number of entities that are correctly linked to the standard nodes of the knowledge graph.

8. A medical text classification test apparatus characterized by comprising: It includes: A memory for storing computer programs / instructions; A processor for executing the computer programs / instructions to implement the steps of the method of any one of claims 1-7.

9. A computer readable storage medium having stored thereon a computer program, characterized in that: The program is executed by the processor to implement the steps of the method of any one of claims 1-7.

Citation Information

Patent Citations

  • Semi-supervised self-learning driven medical text disease identification method

    CN112735597A

  • Method and system for detecting fluff state on surface of napped fabric based on machine vision

    CN118840740A