Infectious disease prediction and transmission link speculation method and system based on random forest
By processing the spatiotemporal data of infectious disease patients based on random forests, and constructing a prediction model, the problem of individual differences in infectious disease prediction is solved, and high-precision infection time prediction and transmission path speculation are achieved, providing a scientific basis for public health decision-making.
Patent Information
- Application Number
- CN202411532737.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-03-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art ignores inter-individual differences in infectious disease prediction, low prediction accuracy of infection time and insufficient ability to speculate transmission paths, making it difficult to effectively deal with emergencies and individual abnormal transmission events.
The random forest-based infectious disease prediction and transmission link speculation method is adopted. By obtaining and processing the spatiotemporal data sets of infectious disease patients, a random forest prediction model is constructed, training and testing is performed, the disease transmission relationship is inferred and the dynamic disease timing chart is drawn.
It realizes high-precision prediction and detailed inference of the transmission link of infectious disease transmission, and controls the relative error within 30%, providing solid data-driven and scientific support, providing support for public health decision-making.
Smart Images

Figure CN119626576A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of infectious disease transmission risk prediction, and specifically relates to an infectious disease prediction and transmission link inference method and system based on random forest. Background Art
[0002] As the global climate warms and the melting of ice and snow in the Arctic and Antarctic accelerates, many virus and microbial populations are experiencing unprecedented mutation challenges, which directly leads to a sharp increase in the frequency of infectious disease outbreaks. Not only does it pose a serious threat to human life and safety, it also profoundly affects the steady growth of the global economy and the harmony and stability of society. Therefore, it is particularly important to predict the incidence of infectious diseases and speculate on the transmission links. Efficient and accurate prediction results will strongly support public health departments to quickly and effectively control the spread of the virus, thereby significantly reducing the negative impact of infectious diseases on human society.
[0003] At present, domestic and foreign scholars' research in the field of infectious disease prediction mainly focuses on the macro trend of disease development, and generally adopts two methods: infectious disease dynamics model based on transmission mechanism and time series statistical model based on historical data. Although these methods have achieved certain results in predicting the general trend of infectious diseases, they often ignore the differences between individual patients and are difficult to effectively respond to emergencies and individual abnormal transmission events. Given the characteristics of infectious diseases that spread quickly and affect a wide range, it is of vital importance to accurately predict the time of individual infection and carefully describe the transmission path for medical institutions to identify and isolate high-risk individuals in advance, effectively control the source of infection, and curb the spread of infectious diseases. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a method and system for infectious disease prediction and transmission link inference based on random forests in response to the deficiencies in the above-mentioned prior art, so as to solve the technical problems that the prior methods ignore individual differences, have low infection time prediction accuracy and insufficient transmission path inference ability, achieve high-precision illness time prediction at the level of sick individuals, and reasonable inference of disease transmission links, thereby providing solid data-driven and scientific support for the formulation of infectious disease prevention and control strategies.
[0005] The present invention adopts the following technical solutions: A method for predicting infectious diseases and inferring transmission links based on random forests, comprising the following steps: S1. Obtain and process the spatiotemporal dataset of infectious disease patients, and divide the spatiotemporal dataset into training set and test set; S2, training the constructed random forest prediction model based on the training set obtained in step S1; S3, input the test set of step S1 into the random forest prediction model trained in step S2 to obtain the prediction result; S4. Based on the prediction results obtained in step S3, the disease transmission relationship is inferred and a dynamic disease time series diagram is drawn.
[0006] Preferably, in step S1, the spatiotemporal dataset includes population information, flow trajectory, case contact history, hospitalization timeline and patient symptom information, as follows: Demographic information includes: patient ID, age, gender, occupation, and place of residence; Mobility data include: departure point, transit point, destination, and arrival date; The case contact history includes: the earliest possible date of infection, the latest possible date of infection, the possible place and event of infection, the possible place of infection, who was with, and the ID of the contact; The hospitalization timeline includes: admission location, method of infection discovery, isolation start date, isolation location, symptom onset date, admission date, admission location, diagnosis date, and disclosure date; Patient symptoms include: infection symptoms and attribute information of infection severity.
[0007] Preferably, the spatiotemporal dataset is cleaned and preprocessed as follows: S101, determining the infection time of the patient; S102, screening attribute features; S103, for the characteristic attributes screened out in step S102, adopt differentiated missing value filling strategies to fill in the missing values and perform encoding; S104. By randomly disrupting the order of the data, the data set is divided into a training set and a test set in a ratio of 8:2.
[0008] Preferably, in step S101, the infection time of the patient is determined as follows: Use the non-missing records of the latest possible infection time to fill in the blanks in the earliest infection time and generate a new "infection time" attribute column; The proportion of missing infection time in the patient data of each city was counted in detail, and the data of cities with missing rates exceeding 80% and cities with less than 10 patients were excluded; The remaining missing items in the infection time column are filled with the non-null values of the confirmed time to achieve full coverage of the attributes.
[0009] Preferably, in step S102, the attribute characteristics include the age of the infected person, the gender of the infected person, the occupation of the infected person, the place of residence of the infected person, the place where the infected person departed, the destination where the infected person arrived, the time when the infected person arrived at the destination, the place and event where the infected person may be infected, the place where the infected person may be infected, the person with whom the infected person may be infected, the ID of the person associated with the infected person, the place where the infected person was admitted to the hospital, the way the infected person was found to be infected, the place where the infected person was isolated, the place where the infected person was admitted to the hospital, the symptoms of the infected person, the severity of the symptoms of the infected person and the city where the infected person was found.
[0010] Preferably, in step S103, for location attributes, statistics are performed on a city basis, and reasonable sampling and filling are performed by statistically analyzing the distribution of each city; for non-location attributes, missing values are filled by statistically analyzing the distribution of the entire data set; all non-numeric data are serially encoded and converted into numerical data.
[0011] Preferably, the time-related attribute feature coding takes the date when the first infected person was found in each region as the base date, and calculates the number of new infected cases on each subsequent day; the time-related attribute columns are sorted in chronological order, and converted into integer numbers using serial number coding.
[0012] Preferably, step S2 specifically includes: Based on the data set divided in step S1, use Python's machine learning library to load and configure the random forest prediction model, and set the optimized hyperparameters; use the 18 feature attributes in the training set as input variables, and the infection time as the classification target to train the random forest prediction model.
[0013] Preferably, in step S3, the performance of the random forest prediction model is evaluated using the modified classification prediction accuracy. The details are as follows:
[0014] In a second aspect, an embodiment of the present invention provides an infectious disease prediction and transmission link inference system based on random forest, including: The data module acquires and processes the spatiotemporal dataset of infectious disease patients and divides the spatiotemporal dataset into training and test sets; The training module trains the constructed random forest prediction model based on the training set; The test module inputs the test set into the trained random forest prediction model to obtain the prediction results; The output module infers the disease transmission relationship based on the prediction results and draws a dynamic disease time series diagram.
[0015] In a third aspect, a computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned method for infectious disease prediction and transmission link inference based on random forest when executing the computer program.
[0016] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned random forest-based infectious disease prediction and transmission link inference method.
[0017] In a fifth aspect, a chip comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the above-mentioned method for infectious disease prediction and transmission link inference based on random forest are implemented.
[0018] In a sixth aspect, an embodiment of the present invention provides an electronic device, including a computer program, which, when executed by the electronic device, implements the steps of the above-mentioned random forest-based infectious disease prediction and transmission link inference method.
[0019] Compared with the prior art, the present invention has at least the following beneficial effects: A random forest-based infectious disease prediction and transmission link inference method aims to systematically process and analyze the spatiotemporal data of infectious disease patients to achieve effective prediction of infectious disease transmission and inference of transmission links. This data-driven approach can not only use historical case data for modeling and improve the accuracy of future case predictions, but also intuitively display the transmission process through dynamic disease time series diagrams to provide support for public health decision-making.
[0020] Furthermore, the construction of spatiotemporal datasets combines multi-dimensional information of patients (such as population information, flow trajectory, etc.), which helps to fully understand the transmission characteristics of infectious diseases. By collecting this information, we can better capture the factors that affect the spread of infection, provide multi-dimensional feature support for the prediction model, and improve the accuracy and effectiveness of the model.
[0021] Furthermore, the spatiotemporal dataset is cleaned and preprocessed to ensure the data quality of the input model and reduce noise and uncertainty. By filling missing values and filtering features, the integrity and consistency of the data can be improved to ensure that the data used in the model training process is reliable.
[0022] Furthermore, by filling in the missing values of the patient's infection time, we ensure that each case has a clear infection time, thereby improving the accuracy of the model in the time dimension and providing a basis for subsequent transmission link analysis.
[0023] Furthermore, by selecting features that are closely related to the spread of infection, it helps the model to more accurately learn the factors that affect the risk of infection and improve the model's interpretability and predictive capabilities.
[0024] Furthermore, through a reasonable filling strategy, the integrity of the data set can be improved to ensure the data quality of the model training process. Differentiated filling methods are used for different types of attributes to make the filling structure more consistent with the actual distribution characteristics of the data, thereby improving the accuracy of the model.
[0025] Furthermore, by setting optimized hyperparameters, flexibly configuring and training the random forest model, it is ensured that the model can capture complex patterns in the data during the learning process, thereby improving the accuracy of infectious disease predictions.
[0026] Furthermore, the performance of infectious disease prediction models is evaluated by the modified classification accuracy, which not only considers the prediction accuracy but also helps to identify the adaptability of the model under different conditions and ensures that the prediction results have practical value.
[0027] It can be understood that the beneficial effects of the second aspect mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.
[0028] In summary, the present invention can predict the infection time of infectious disease patients with a relative error of no more than 30%. It fully explores the relationship between patient characteristics and infection time, and provides effective data support and analysis tools by dynamically visualizing the transmission path of infectious diseases in a specific area to assist public health decision-making and the formulation of infectious disease strategies.
[0029] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 A block diagram of a method for predicting infectious diseases and inferring transmission links based on random forests provided in an embodiment of the present invention; Figure 2 This is a time series diagram of illness of relevant personnel in the example city according to the embodiment of the present invention; Figure 3 A schematic diagram of a computer device provided by an embodiment of the present invention; Figure 4 The block diagram of a chip provided according to an embodiment of the present invention. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0032] In the description of the present invention, it should be understood that the terms “include” and “comprises” indicate the presence of described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.
[0033] It should also be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0034] It should be further understood that the term "and / or" used in the present specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present invention generally indicates that the associated objects are in an "or" relationship.
[0035] It should be understood that, although the terms first, second, third, etc. may be used to describe preset ranges, etc. in the embodiments of the present invention, these preset ranges should not be limited to these terms. These terms are only used to distinguish preset ranges from each other. For example, without departing from the scope of the embodiments of the present invention, the first preset range may also be referred to as the second preset range, and similarly, the second preset range may also be referred to as the first preset range.
[0036] The word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0037] Various structural schematic diagrams of the embodiments disclosed in the present invention are shown in the accompanying drawings. These figures are not drawn to scale, and some details are magnified and some details may be omitted for the purpose of clear expression. The shapes of various regions and layers shown in the figures and the relative sizes and positional relationships therebetween are only exemplary, and may deviate in practice due to manufacturing tolerances or technical limitations, and those skilled in the art may additionally design regions / layers with different shapes, sizes, and relative positions according to actual needs.
[0038] The present invention provides a method for predicting infectious diseases and inferring transmission links based on random forests. First, data is obtained and preprocessed, including collecting case information from official websites and social media platforms of multiple provincial and urban health departments across the country, cleaning and preprocessing data sets; prediction of patient illness time, including building and training models using random forest algorithms, accurately predicting the infection time of patients; evaluation of algorithm prediction results, including evaluating model performance through classification prediction accuracy and correction accuracy; inference of disease transmission relationships, including building a dynamic transmission model based on the predicted infection time and generating an infection time series diagram, revealing the transmission path of the disease in the urban population, and providing a scientific basis for infectious disease control and public health decision-making; the present invention aims to develop an accurate prediction model for individual infectious disease patients, the relative error of which predicts the infection time is controlled within 30%, and has the ability to reasonably infer the transmission path. The implementation of the present invention will greatly improve the accuracy and practicality of the prediction, help medical institutions optimize resource allocation, and promote government departments to formulate more scientific and reasonable prevention and control strategies.
[0039] The present invention provides a method for predicting infectious diseases and inferring transmission links based on random forests, comprising the following steps: S1. Acquire and process spatiotemporal data of infectious disease patients; Case information of a certain type of infectious disease was collected from the official websites and social media platforms of multiple provincial and city health departments across the country and manually compiled by relevant personnel to form a spatiotemporal dataset containing 27,204 infected people.
[0040] The spatiotemporal dataset includes population information (5 items), mobility trajectory (4 items), case contact history (6 items), hospitalization timeline (9 items) and patient symptoms (2 items), as follows: Demographic information includes: patient ID, age, gender, occupation, and place of residence; Mobility data include: departure point, transit point, destination, and arrival date; The case contact history includes: the earliest possible date of infection, the latest possible date of infection, the possible place and event of infection, the possible place of infection, who was with, and the ID of the contact; The hospitalization timeline includes: admission location, method of infection discovery, isolation start date, isolation location, symptom onset date, admission date, admission location, diagnosis date, and disclosure date; Patient symptoms include: infection symptoms and attribute information of infection severity.
[0041] Since the original data contains a large number of missing values and noise data, it needs to be cleaned and preprocessed. The specific steps include: S101, determining the infection time of the patient; Given that there are many missing records of patient infection time in the dataset, a series of strategies were adopted to accurately determine the patient infection time to ensure the integrity of the data and the accuracy of the analysis.
[0042] S1011. Use the non-missing records of the latest possible infection time to fill in the blanks in the earliest possible infection time and generate a new "infection time" attribute column. This process aims to provide a reasonable infection time estimate for each patient based on time logic; S1012. The proportion of missing infection time in the patient data of each city was counted in detail, and the data of cities with a missing rate of more than 80% were eliminated to avoid analysis bias caused by incomplete data. At the same time, considering the importance of data volume to the effectiveness of analysis, the data of cities with less than 10 patients were excluded to ensure the adequacy and representativeness of the analysis sample. After the above screening, the data of 4246 patients from different cities were finally retained; S1013. Use the non-null value of the confirmed time to fill in the remaining missing items in the infection time column to achieve full coverage of this attribute.
[0043] S102, screening attribute features; In order to build an efficient and accurate prediction model, we deeply analyzed the various attributes of the patients and combined them with the specific task requirements of disease duration prediction, and finally selected 18 key attribute features. These features cover multiple dimensions such as the patient's age, gender, occupation, place of residence, travel trajectory, contact situation, symptoms, etc., providing a solid foundation for comprehensively characterizing the patient's infection risk and transmission pattern. The specific attributes and their meanings are shown in the following table:
[0044] S103, fill in missing values and encode; Different missing value filling strategies were adopted for the 18 selected feature attributes according to their different properties. This method is to ensure that the filled data is more accurate and meaningful.
[0045] For location attributes, such as residence and departure point, statistics are collected by city, because the location attributes of patients in the same city are often highly correlated, reflecting the actual local situation. However, these location attributes are usually not correlated between different cities. If the distribution of the entire data set is used to fill in missing values, the results may be distorted. Therefore, by counting the distribution of each city and performing reasonable sampling and filling, the integrity of the data can be restored more accurately.
[0046] For non-location attributes, such as symptom descriptions, since these attributes show similarities among patients in different regions and have strong universality, it is more reasonable to count them at the level of the entire dataset. Filling missing values by counting the distribution of the entire dataset can ensure that attributes such as symptoms are filled more consistently, reflecting the common characteristics of infectious diseases in different regions.
[0047] All non-numeric data are serially encoded and converted into numerical data, which not only simplifies the data processing process but also facilitates subsequent model training.
[0048] In particular, the encoding of attribute features related to time, considering that in the prediction of infectious disease infection time, the model training data and the actual prediction data may come from different periods, it is difficult to guarantee the accuracy of direct prediction of absolute time. Therefore, the relative time prediction method is adopted to improve the universality and promotion effect of the model. Specifically, the date when the first infected person was found in each region is used as the base date, and the number of new infected cases is calculated on each subsequent day. This method makes the model no longer dependent on specific dates, but predicts based on relative time, thereby avoiding prediction errors caused by different time spans. Through the standardization of relative time, the model can more accurately capture the spread of infectious diseases and trends, ensuring the reliability and effectiveness of the prediction results in practical applications. The time-related attribute columns are sorted in chronological order, and the serial number encoding method is used to convert them into integer numbers for subsequent data processing and analysis.
[0049] S104: Data set division.
[0050] In order to evaluate the performance of the model and verify its generalization ability, the data set of 4246 patients was divided after processing. By randomly shuffling the order of the data, the data set was divided into a training set and a test set in a ratio of 8:2. The training set is used for model training and optimization, while the test set is used to evaluate the prediction effect of the model. This division method not only ensures the adequacy of model training, but also ensures the objectivity and reliability of the test results, providing solid data support for subsequent model training and testing.
[0051] S2, using random forest algorithm to predict the duration of illness; Random Forest is an ensemble learning algorithm based on the idea of bagging. It effectively improves classification accuracy and robustness by building and integrating multiple decision tree models. Each decision tree, as the basic unit of the random forest, performs the classification task independently, and the final prediction result is determined by integrating the outputs of all decision trees, usually by majority voting. During the model construction process, key parameters such as the number of decision trees and the maximum depth need to be adjusted to achieve a balance between computational efficiency and prediction accuracy. In the training phase, the preprocessed training data set is used to train the model to learn the prediction pattern of infectious disease infection time.
[0052] The core parameters of the random forest algorithm include n_estimators (the number of decision trees) and max_depth (the maximum depth of the decision tree). These two parameters have a crucial impact on the performance of the model. The selection of n_estimators requires a balance between computational efficiency and model accuracy: a value that is too small may cause the model to be underfitted and unable to fully capture the complex relationships in the data; while a value that is too large will significantly increase the computational burden and the improvement in accuracy may become negligible. Through careful parameter tuning and cross-validation, n_estimators is finally set to 100 to achieve a good balance between computational efficiency and prediction accuracy.
[0053] On the other hand, max_depth determines the maximum depth of the decision tree, that is, the maximum number of layers of nodes in the tree. The setting of this parameter also depends on the specific distribution characteristics of the data. Too deep a tree may cause the model to overfit on the training data, that is, overfit to specific noise or anomalies in the training set, while ignoring the general laws of the data; while too shallow a tree may not be able to fully learn the complex structure of the data. After comprehensively considering the data characteristics and model performance, max_depth is set to 18 to ensure that the model can capture the key information in the data while maintaining a certain generalization ability.
[0054] Based on the carefully divided data set in step S1, the random forest prediction model was loaded and configured using Python's machine learning library (such as scikit-learn), and the above-mentioned optimized hyperparameters were set. Subsequently, the 18 feature attributes in the training set were used as input variables, and the infection time was used as the classification target to train the model.
[0055] After sufficient training, a well-trained random forest prediction model was obtained. This model can not only accurately predict the patient's illness time, but also reveal the complex relationship between each characteristic attribute and the illness time, providing strong support for subsequent medical research and clinical practice.
[0056] S3, evaluating the prediction results; The performance of the model was evaluated using an independent test set; the prediction effect of the random forest prediction model was measured by calculating the classification prediction accuracy and the corrected accuracy. The corrected accuracy takes into account the slight deviation between the predicted value and the true value, making the evaluation more reasonable and comprehensive.
[0057] The performance of the trained random forest prediction model is evaluated using the test dataset from step S1.
[0058] The test set contains data from 849 patients. During the test, 18 feature attributes were input into the trained random forest prediction model, which then output the corresponding predicted infection time value.
[0059] At the same time, the actual infection time of these patients was also recorded in the test set as a benchmark for evaluating the prediction accuracy of the model.
[0060] In order to evaluate the performance of the random forest prediction model, the classification prediction accuracy is used as a basic evaluation indicator. This indicator directly compares the consistency between the predicted value and the true value, and quantifies the accuracy of the model by calculating the proportion of the number of samples predicted correctly to the total number of samples. The calculation formula is as follows:
[0061] However, in actual applications, it is observed that many prediction errors are not completely deviated from the true value, but only differ by 1 time unit (that is, 1 day). In addition, this deviation also presents certain regional characteristics, that is, the prediction results of the entire city generally have a consistent deviation from the true value.
[0062] In order to evaluate the model performance more reasonably, a modified accuracy evaluation index is introduced. This index maintains the requirement of complete prediction accuracy while taking into account the slight deviation mentioned above. Specifically, the prediction result that differs from the true value by no more than 1 time unit is also considered to be a correct prediction, thus relaxing the evaluation criteria to a certain extent.
[0063] The corrected accuracy calculation formula is expressed as:
[0064] Through this correction, we can not only comprehensively evaluate the performance of the model in predicting the time of illness, but also better understand the potential biases and limitations of the model in practical applications, providing valuable reference for subsequent optimization and improvement. Using these two indicators to evaluate the infection prediction model, the random forest prediction model obtained a prediction accuracy of less than 30%.
[0065] S4. Infer the disease transmission relationship and draw a dynamic disease time series diagram.
[0066] Based on the results of the predictive model, the spread and diffusion of infectious diseases in a single city are studied, and a dynamic disease transmission model is constructed to simulate and visualize the spread of the disease in the population over time; this helps to reveal the key paths of epidemic spread.
[0067] Focusing on a single city, we study the spread and diffusion of infectious diseases among relevant personnel in a specific city. Using the infection time prediction model trained in step S2, we can accurately predict the expected infection time of each relevant person in the city, laying a solid foundation for the subsequent transmission relationship analysis.
[0068] In another embodiment of the present invention, a random forest-based infectious disease prediction and transmission link inference system is provided. The system can be used to implement the above-mentioned random forest-based infectious disease prediction and transmission link inference method. Specifically, the random forest-based infectious disease prediction and transmission link inference system includes a data module, a training module, a test module and an output module.
[0069] Among them, the data module obtains and processes the spatiotemporal data set of infectious disease patients, and divides the spatiotemporal data set into training set and test set; The training module trains the constructed random forest prediction model based on the training set; The test module inputs the test set into the trained random forest prediction model to obtain the prediction results; The output module infers the disease transmission relationship based on the prediction results and draws a dynamic disease time series diagram.
[0070] In another embodiment of the present invention, a terminal device is provided, which includes a processor and a memory, the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc., which are the computing core and control core of the terminal, which are suitable for implementing one or more instructions, and are specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding functions; the processor described in the embodiment of the present invention can be used for the operation of the infectious disease prediction and transmission link inference method based on random forests, including: Acquire and process the spatiotemporal dataset of infectious disease patients, and divide the spatiotemporal dataset into training set and test set; train the constructed random forest prediction model based on the training set; input the test set into the trained random forest prediction model to obtain the prediction results; infer the disease transmission relationship based on the obtained prediction results and draw a dynamic disease time series diagram.
[0071] See also Figure 3 , the terminal device is a computer device, and the computer device 60 of this embodiment includes: a processor 61, a memory 62, and a computer program 63 stored in the memory 62 and executable on the processor 61. When the computer program 63 is executed by the processor 61, the infectious disease prediction and propagation link inference method based on random forests in the embodiment is implemented. To avoid repetition, it is not described one by one here. Alternatively, when the computer program 63 is executed by the processor 61, the functions of each model / unit in the infectious disease prediction and propagation link inference system based on random forests in the embodiment are implemented. To avoid repetition, it is not described one by one here.
[0072] The computer device 60 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The computer device 60 may include, but is not limited to, a processor 61 and a memory 62. Those skilled in the art will appreciate that Figure 3 This is only an example of the computer device 60 and does not constitute a limitation of the computer device 60. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.
[0073] The processor 61 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0074] The memory 62 may be an internal storage unit of the computer device 60, such as a hard disk or memory of the computer device 60. The memory 62 may also be an external storage device of the computer device 60, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc., equipped on the computer device 60.
[0075] Furthermore, the memory 62 may include both an internal storage unit of the computer device 60 and an external storage device. The memory 62 is used to store computer programs and other programs and data required by the computer device. The memory 62 may also be used to temporarily store data that has been output or is to be output.
[0076] See also Figure 4 , the terminal device is a chip, and the chip 600 of this embodiment includes a processor 622, which may be one or more, and a memory 632 for storing a computer program executable by the processor 622. The computer program stored in the memory 632 may include one or more modules, each corresponding to a set of instructions. In addition, the processor 622 may be configured to execute the computer program to execute the above-mentioned random forest-based infectious disease prediction and transmission link inference method.
[0077] In addition, the chip 600 may further include a power supply component 626 and a communication component 650, wherein the power supply component 626 may be configured to perform power management of the chip 600, and the communication component 650 may be configured to implement communication, for example, wired or wireless communication, of the chip 600. In addition, the chip 600 may further include an input / output interface 658. The chip 600 may operate based on an operating system stored in the memory 632.
[0078] In another embodiment of the present invention, the present invention also provides a storage medium, specifically a computer-readable storage medium, which is a memory device in a terminal device for storing programs and data. It can be understood that the computer-readable storage medium here can include both the built-in storage medium in the terminal device and the extended storage medium supported by the terminal device. The computer-readable storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and these instructions can be one or more computer programs. It should be noted that the computer-readable storage medium here can be a high-speed RAM memory, or a non-volatile memory (Non-VolatileMemory), such as at least one disk memory.
[0079] The processor may load and execute one or more instructions stored in a computer-readable storage medium to implement the corresponding steps of the infectious disease prediction and transmission link inference method based on random forest in the above embodiment; one or more instructions in the computer-readable storage medium are loaded and executed by the processor as follows: Acquire and process the spatiotemporal dataset of infectious disease patients, and divide the spatiotemporal dataset into training set and test set; train the constructed random forest prediction model based on the training set; input the test set into the trained random forest prediction model to obtain the prediction results; infer the disease transmission relationship based on the obtained prediction results and draw a dynamic disease time series diagram.
[0080] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present invention described and shown in the drawings here can usually be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0081] Assuming that in the same city, the later infected are spread by the previously infected population in an equal probability manner, a dynamic disease transmission model is constructed based on this. This model aims to simulate and visualize the spread of the disease in the city's population over time, thereby revealing the key paths of the epidemic spread.
[0082] See also Figure 2, taking city 7 as an example, the disease time series diagram automatically generated by the algorithm is shown. The diagram depicts the changes in the infection status of relevant personnel in city 7 on a daily basis. In the diagram, each node represents a relevant person and is given a unique number for easy tracking and identification. In order to intuitively display the current status of each node, three different colors are used to distinguish: dark gray represents newly infected people on the day, gray represents people who have been infected, and light gray represents people who have not been infected yet. In the disease time series diagram, the edges between nodes represent the transmission relationship of the epidemic. These edges not only reflect the direct connection between the infected and the infected, but also reveal the potential transmission path of the disease in the population. The edge generation process follows the basic law of epidemic transmission, that is, the later infected person cannot become the source of infection for the first infected person, thus ensuring the rationality and accuracy of the transmission relationship.
[0083] In summary, the present invention provides a method and system for predicting infectious diseases and inferring transmission links based on random forests, which achieves accurate prediction of individual infection time, with a relative error of less than 30%, and dynamically displays the transmission path of infectious diseases at the individual level through visualization. It helps medical institutions identify high-risk individuals in advance and promotes the government to formulate reasonable prevention and control measures, thereby reducing the negative impact of infectious diseases on society.
[0084] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0085] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0086] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0087] In the embodiments provided by the present invention, it should be understood that the disclosed devices / terminals and methods can be implemented in other ways. For example, the device / terminal embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0088] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0089] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0090] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0091] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices, and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0092] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0093] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0094] The above contents are only for explaining the technical idea of the present invention and cannot be used to limit the protection scope of the present invention. Any changes made on the basis of the technical solution in accordance with the technical idea proposed by the present invention shall fall within the protection scope of the claims of the present invention.
Claims
1. A method for predicting infectious diseases and inferring transmission links based on random forests, characterized in that: The following steps are involved: S1. Obtain and process the spatiotemporal dataset of infectious disease patients, and divide the spatiotemporal dataset into training set and test set; S2, training the constructed random forest prediction model based on the training set obtained in step S1; S3, input the test set of step S1 into the random forest prediction model trained in step S2 to obtain the prediction result; S4. Based on the prediction results obtained in step S3, the disease transmission relationship is inferred and a dynamic disease time series diagram is drawn.
2. The method for predicting infectious diseases and inferring transmission links based on random forests according to claim 1, characterized in that: In step S1, the spatiotemporal dataset includes population information, flow trajectory, case contact history, hospitalization timeline, and patient symptom information, as follows: Demographic information includes: patient ID, age, gender, occupation, and place of residence; Mobility data include: departure point, transit point, destination, and arrival date; The case contact history includes: the earliest possible date of infection, the latest possible date of infection, the possible place and event of infection, the possible place of infection, who was with, and the ID of the contact; The hospitalization timeline includes: admission location, method of infection discovery, isolation start date, isolation location, symptom onset date, admission date, admission location, diagnosis date, and disclosure date; Patient symptoms include: infection symptoms and attribute information of infection severity.
3. The method for predicting infectious diseases and inferring transmission links based on random forests according to claim 2, characterized in that: Clean and preprocess the spatiotemporal dataset as follows: S101, determining the infection time of the patient; S102, screening attribute features; S103, for the characteristic attributes screened out in step S102, adopt differentiated missing value filling strategies to fill in the missing values and perform encoding; S104. By randomly disrupting the order of the data, the data set is divided into a training set and a test set in a ratio of 8:
2.
4. The method for predicting infectious diseases and inferring transmission links based on random forests according to claim 3, characterized in that: In step S101, the infection time of the patient is determined as follows: Use the non-missing records of the latest possible infection time to fill in the blanks in the earliest infection time and generate a new "infection time" attribute column; The proportion of missing infection time in the patient data of each city was counted in detail, and the data of cities with missing rates exceeding 80% and cities with less than 10 patients were excluded; The remaining missing items in the infection time column are filled with the non-null values of the confirmed time to achieve full coverage of the attributes.
5. The method for predicting infectious diseases and inferring transmission links based on random forests according to claim 3, characterized in that: In step S102, the attribute characteristics include the age of the infected person, the gender of the infected person, the occupation of the infected person, the place of residence of the infected person, the place where the infected person departed, the destination of the infected person, the time when the infected person arrived at the destination, the place and event where the infected person may be infected, the place where the infected person may be infected, the person with whom the infected person may be infected, the ID of the person associated with the infected person, the place where the infected person was admitted to the hospital, the way the infected person was found to be infected, the place where the infected person was isolated, the place where the infected person was admitted to the hospital, the symptoms of the infected person, the severity of the symptoms of the infected person and the city where the infected person was found.
6. The method for predicting infectious diseases and inferring transmission links based on random forests according to claim 3, characterized in that: In step S103, for location attributes, statistics are performed on a city-by-city basis, and reasonable sampling and filling are performed by statistically analyzing the distribution of each city; for non-location attributes, missing values are filled by statistically analyzing the distribution of the entire data set; all non-numeric data are serially encoded and converted into numeric data.
7. The method for predicting infectious diseases and inferring transmission links based on random forests according to claim 6, characterized in that: The time-related attribute feature encoding takes the date when the first infected person was found in each region as the base date, and calculates the number of new infected cases on each subsequent day; the time-related attribute columns are sorted in chronological order, and converted into integer numbers using serial number encoding.
8. The method for predicting infectious diseases and inferring transmission links based on random forests according to claim 1, characterized in that: Step S2 is specifically as follows: Based on the data set divided in step S1, use Python's machine learning library to load and configure the random forest prediction model, and set the optimized hyperparameters; use the 18 feature attributes in the training set as input variables, and the infection time as the classification target to train the random forest prediction model.
9. The method for predicting infectious diseases and inferring transmission links based on random forests according to claim 1, characterized in that: In step S3, the performance of the random forest prediction model is evaluated using the modified classification prediction accuracy. The details are as follows:
10. A random forest-based infectious disease prediction and transmission link inference system, characterized in that: include: The data module acquires and processes the spatiotemporal dataset of infectious disease patients and divides the spatiotemporal dataset into training and test sets; The training module trains the constructed random forest prediction model based on the training set; The test module inputs the test set into the trained random forest prediction model to obtain the prediction results; The output module infers the disease transmission relationship based on the prediction results and draws a dynamic disease time series diagram.
Citation Information
Patent Citations
Respiratory infectious disease intimate contact person identification method based on mobile phone data
CN111540477A
Infectious disease transmission prediction system and device fusing spatio-temporal information
CN113314231A
Urban epidemic situation space-time prediction method and system, terminal and storage medium
CN114464329A
Infectious disease risk prediction method and device, electronic equipment and storage medium
CN115862860A
Infectious disease trend prediction method and device, computer equipment and storage medium
CN117976238A
Cited By
Mycobacterium tuberculosis propagation relation detection system and application thereof
CN120048362A