Pathogen data analysis method and device based on piecewise linear fitting, equipment and storage medium
By determining the optimal number of breakpoints in segmented linear fitting, the problem of limitations in the selection of breakpoints in the prior art is solved, and the applicability and generalization ability of the pathogen data analysis model are improved.
Patent Information
- Application Number
- CN202411494368.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2044-10-24
AI Technical Summary
When determining the number of breakpoints, the existing segmented linear fitting method is usually based on artificially determined or fixed number of breakpoints, which is difficult to apply to complex and diverse pathogen data, resulting in overfitting or underfitting the model, affecting the analysis results. reliability.
By obtaining pathogen data for preprocessing, several candidate breakpoint numbers are determined, and the data is modeled based on these candidate breakpoint numbers. The preset combination information criterion or determination coefficient is used to evaluate each fit model, and the optimal number of breakpoints is determined based on the minimization of ABIC value or the maximum R2 value, thereby determining the target fit model.
Effectively responding to complex and diverse pathogen data avoids the limitations of breakpoint selection in traditional ways, improves the applicability and generalization ability of the model to different types of data, and enhances the accuracy and rationality of breakpoint selection.
Smart Images

Figure CN119495440A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data analysis technology, and in particular to a pathogen data analysis method, device, equipment and storage medium based on piecewise linear fitting. Background Art
[0002] In epidemiological studies, piecewise linear fitting can be used to analyze the changing trends of respiratory pathogen infection rates in different age groups. By identifying key age breakpoints, it helps to better analyze and understand the transmission patterns of pathogens and high-risk age groups. Therefore, the key to piecewise linear fitting lies in the selection of breakpoints.
[0003] At present, when determining the number of breakpoints, most piecewise linear fitting methods usually use artificially determined breakpoints or a fixed number of breakpoints to construct a piecewise fitting model, and then finally determine the target fitting model based on the Akaike Information Criterion (AIC) or the Bayesian Information Criterion (BIC). This subjective and fixed method lacks flexibility when facing complex and diverse pathogen data, and there are problems of model overfitting or underfitting, resulting in poor applicability of the model, which in turn affects the reliability of the pathogen data analysis results obtained based on the model. Summary of the invention
[0004] The main purpose of this application is to provide a pathogen data analysis method, device, equipment and storage medium based on piecewise linear fitting, aiming to solve the technical problem that the existing piecewise fitting method is usually based on manually determined breakpoints or uses a fixed number of breakpoints, which is difficult to apply to the analysis of complex and diverse pathogen data.
[0005] To achieve the above objectives, the present application proposes a pathogen data analysis method based on piecewise linear fitting, the pathogen data analysis method based on piecewise linear fitting comprising:
[0006] Acquiring pathogen data, and preprocessing the pathogen data to obtain processed pathogen data;
[0007] Determining a number of candidate breakpoints, and performing model fitting on the processed pathogen data based on the number of candidate breakpoints;
[0008] The preset combined information criterion or determination coefficient is used to evaluate the fitting model corresponding to each number of candidate breakpoints, and the model is evaluated based on minimizing the ABIC value or maximizing the R 2 The value determines the optimal number of breakpoints;
[0009] The fitting model corresponding to the optimal number of breakpoints is determined as a target fitting model, and a data analysis result is obtained based on the target fitting model.
[0010] In one embodiment, the step of determining a number of candidate breakpoints and performing model fitting on the processed pathogen data based on the number of candidate breakpoints comprises:
[0011] Obtaining a preset candidate breakpoint number range, and determining a number of candidate breakpoint numbers based on the preset candidate breakpoint number range, wherein the preset candidate breakpoint number range is pre-configured by a user based on task requirements;
[0012] The segmented package of R language is used to perform model fitting on the treated pathogen data according to the number of each candidate breakpoint, so as to obtain a fitting model corresponding to the number of each candidate breakpoint.
[0013] In one embodiment, the preset combined information criterion or determination coefficient is used to perform model evaluation on the fitting model corresponding to each of the candidate breakpoint numbers, and the model is evaluated based on minimizing the ABIC value or maximizing the R 2 The steps of determining the optimal number of breakpoints include:
[0014] Calculating the ABIC value of the fitting model corresponding to each number of the candidate breakpoints based on a preset combined information criterion, wherein the preset combined information criterion is a weighted combination of AIC and BIC;
[0015] The R of the fitting model corresponding to each candidate breakpoint number is calculated based on the determination coefficient. 2 value;
[0016] The number of candidate breakpoints of the fitting model with the smallest ABIC value is determined as the optimal number of breakpoints;
[0017] Or, R 2 The number of candidate breakpoints of the fitting model with the largest value is determined as the optimal number of breakpoints.
[0018] In one embodiment, the R 2 The step of determining the number of candidate breakpoints of the fitting model with the largest value as the optimal number of breakpoints includes:
[0019] In the fitting models corresponding to the number of candidate breakpoints, select R 2 The fitting model with the largest value is selected, and the corresponding number of candidate breakpoints is determined as the optimal number of breakpoints, wherein the preset growth threshold condition is expressed as (1+r), and r is the growth coefficient;
[0020] The R 2 The value is calculated as:
[0021]
[0022] In the formula, y i is the observed value, is the predicted value, y i is the mean of the observed values.
[0023] In one embodiment, the calculation formula of the ABIC value is:
[0024] ABIC = α × AIC + (1-α) × BIC
[0025] In the formula, α is a weight parameter, AIC is the AIC value of the fitting model corresponding to each number of candidate breakpoints calculated based on AIC, and BIC is the BIC value of the fitting model corresponding to each number of candidate breakpoints calculated based on BIC.
[0026] In one embodiment, the step of determining the fitting model corresponding to the optimal number of breakpoints as a target fitting model and obtaining a data analysis result based on the target fitting model includes:
[0027] Determine the fitting model corresponding to the optimal number of breakpoints as a target fitting model, wherein the target fitting model is represented by a plurality of linear equations;
[0028] The drawing function of the R language is used to generate a visual representation of the target fitting model according to the pathogen data and each of the linear equations.
[0029] In one embodiment, the step of obtaining pathogen data and preprocessing the pathogen data to obtain processed pathogen data includes:
[0030] Collecting original pathogen data, and constructing data sets corresponding to different age stages based on the original pathogen data;
[0031] The pathogen data in each of the data sets are sorted and cleaned to obtain processed pathogen data.
[0032] In addition, to achieve the above purpose, the present application also proposes a pathogen data analysis device based on piecewise linear fitting, the device comprising:
[0033] A data preprocessing module, used to obtain pathogen data and preprocess the pathogen data to obtain processed pathogen data;
[0034] The breakpoint selection module is used to determine the number of candidate breakpoints, and perform model fitting on the treated pathogen data based on the number of candidate breakpoints; use a preset combined information criterion or determination coefficient to evaluate the fitting model corresponding to each candidate breakpoint, and select the model based on minimizing the ABIC value or maximizing the R 2 The value determines the optimal number of breakpoints;
[0035] The result output module is used to determine the fitting model corresponding to the optimal number of breakpoints as a target fitting model, and obtain a data analysis result based on the target fitting model.
[0036] In addition, to achieve the above-mentioned objectives, the present invention also proposes a pathogen data analysis device based on piecewise linear fitting, the device comprising: a memory, a processor, and a pathogen data analysis program based on piecewise linear fitting stored in the memory and executable on the processor, the pathogen data analysis program based on piecewise linear fitting being configured to implement the steps of the pathogen data analysis method based on piecewise linear fitting as described above.
[0037] In addition, to achieve the above-mentioned purpose, the present invention also proposes a storage medium, on which a pathogen data analysis program based on piecewise linear fitting is stored. When the pathogen data analysis program based on piecewise linear fitting is executed by a processor, the steps of the pathogen data analysis method based on piecewise linear fitting as described above are implemented.
[0038] The present application discloses a pathogen data analysis method based on piecewise linear fitting, which comprises the following steps: obtaining pathogen data and preprocessing the pathogen data to obtain processed pathogen data; determining a number of candidate breakpoints, and performing model fitting on the processed pathogen data based on the number of candidate breakpoints; using a preset combined information criterion or determination coefficient to evaluate the fitting model corresponding to each candidate breakpoint number, and evaluating the model by minimizing the ABIC value or maximizing the R 2 The optimal number of breakpoints is determined by the value; the fitting model corresponding to the optimal number of breakpoints is determined as the target fitting model, and the data analysis results are obtained based on the target fitting model. Since the present application can effectively deal with complex and diverse pathogen data by determining the optimal number of breakpoints from a number of candidate breakpoints, it avoids the limitations of traditional breakpoint selection, thereby improving the applicability and generalization ability of the model to different types of data. Specifically, the ABIC value or R 2 The value is used as the basis for selecting the optimal number of breakpoints. Compared with the traditional single-standard optimization method, it improves the accuracy and rationality of breakpoint selection and can better balance the complexity and fit of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0041] Figure 1 This is a flow chart of the first embodiment of the pathogen data analysis method based on piecewise linear fitting of the present application;
[0042] Figure 2 This is a flow chart of the second embodiment of the pathogen data analysis method based on piecewise linear fitting of the present application;
[0043] Figure 3 This is a flow chart of a third embodiment of a pathogen data analysis method based on piecewise linear fitting of the present application;
[0044] Figure 4 This is a schematic diagram of the entire process of the pathogen data analysis method based on piecewise linear fitting in this application;
[0045] Figure 5 It is a piecewise linear fitting relationship diagram based on the relationship between the infection rate of Streptococcus pneumoniae BA0008 and the patient's age;
[0046] Figure 6 This is a structural block diagram of the first embodiment of the pathogen data analysis device based on piecewise linear fitting of the present application;
[0047] Figure 7 This is a schematic diagram of the structure of the pathogen data analysis device based on piecewise linear fitting in this application.
[0048] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0049] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0050] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0051] The present application embodiment provides a pathogen data analysis method based on piecewise linear fitting, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the pathogen data analysis method based on piecewise linear fitting of the present application. In this embodiment, the method includes: Steps S10 to S40:
[0052] Step S10: Acquire pathogen data, and pre-process the pathogen data to obtain processed pathogen data.
[0053] It should be noted that this embodiment can be applied to scenarios where data analysis of pathogen data is performed, and can also be applied to other scenarios where data analysis of data in a large data set is required using a piecewise linear fitting method. The executor of the method of this embodiment can be a computing electronic device with functions such as data processing, network communication, and program running, such as a mobile phone, tablet, computer, or data analysis server, or other data analysis devices that can achieve the same or similar functions. Here, a pathogen data analysis device based on piecewise linear fitting (hereinafter referred to as "analysis device") can be used as an example to explain the various embodiments of this application.
[0054] It is understandable that the pathogen data can be multi-pathogen infection rate data. For example, when the current task requirement is to analyze the changing trends of respiratory pathogen infection rates in different age groups, the pathogen data can be data including patient age, pathogen number and corresponding infection rate, which can reflect the infection rates of multiple pathogens changing with age.
[0055] In order to facilitate analysis, the collected original pathogen data may be preprocessed to facilitate subsequent model fitting. Therefore, step S10 specifically includes: steps S101 to S102:
[0056] Step S101: Collect original pathogen data, and construct data sets corresponding to different age stages based on the original pathogen data.
[0057] It should be understood that different age stages can be set first, for example, they can be set to: 0-2, 2-4, 4-6, ..., 98-100 age stages, and then the original pathogen data can be grouped according to their corresponding patient ages and based on the age stages set above, so as to obtain data sets corresponding to different age stages.
[0058] It should also be noted that, since each original pathogen data can correspond to a pathogen number, the data can be further classified and organized according to the pathogen number in each data set.
[0059] Step S102: sorting and cleaning the pathogen data in each of the data sets to obtain processed pathogen data.
[0060] It is understandable that after the data is sorted, the pathogen data in each data set can be sorted and cleaned. Data sorting can ensure that the subsequent fitting model can accurately capture the specific changes in each age stage, and data cleaning can ensure the integrity and quality of the data, providing a solid data foundation for subsequent model fitting.
[0061] Specifically, first, the pathogen data in each data set can be sorted by age according to the patient's age, ensuring that the pathogen data is sorted in order from young to old. Then the data can be cleaned, including processing missing values and outliers. Regarding processing missing values: you can delete missing values or fill them with reasonable alternative values such as mean and median; regarding processing outliers, you can determine whether to raise them based on the specific situation to avoid the outliers from having an adverse effect on the subsequent fitting results.
[0062] Step S20: determining a number of candidate breakpoints, and performing model fitting on the processed pathogen data based on the number of candidate breakpoints.
[0063] It should be understood that the number of candidate breakpoints may be a number of breakpoints predefined by the user based on historical experience. Specifically, a preset range of candidate breakpoints may be obtained first, and then a number of candidate breakpoints may be determined based on the preset range of candidate breakpoints. The preset range of candidate breakpoints may be preconfigured by the user based on task requirements and historical experience, for example, may be configured to be 1 to 4, that is, the number of breakpoints may be determined to be 1, 2, 3, or 4.
[0064] It is understandable that based on the number of each candidate breakpoint, a piecewise linear model can be used to fit the model of the corresponding number of candidate breakpoints. In order to construct the piecewise linear fitting model, the R language tool can be used. The R language is a widely used language and environment for statistical analysis and graphic representation, and is particularly suitable for data analysis, statistical learning and graphic representation.
[0065] Packages in R language are a mechanism for extending R functions, which include a series of functions, data sets and documents, allowing users to perform more complex data processing and analysis. In this embodiment, the segmented package in R language can be used to perform model fitting, which allows users to specify independent variables and dependent variables, and automatically adjusts the position of breakpoints to optimize the model.
[0066] In a specific implementation, the processed pathogen data can be used as the original data set required by the segmented package in the R language, and the data can be iteratively fitted through the functions in the package. Then, the segmented package can be used to determine the optimal breakpoint positions under different numbers of breakpoints, that is, to obtain the fitting models corresponding to the number of candidate breakpoints.
[0067] Step S30: Using a preset combined information criterion or determination coefficient to evaluate the fitting model corresponding to each of the candidate breakpoint numbers, and according to minimizing the ABIC value or maximizing the R 2 The value determines the optimal number of breakpoints.
[0068] It should be understood that AIC can select the optimal model by maximizing the likelihood function of the model while penalizing the number of parameters in the model. A smaller AIC value usually indicates that the model has achieved a better balance between fitting the data and maintaining simplicity. The BIC value is similar to the AIC value. It is more sensitive to the number of parameters when the sample size increases. BIC is based on Bayesian theory, and it also tends to select a simpler model when the sample size is larger. The ABIC value can be calculated as a weighted combination of the AIC value and the BIC value.
[0069] It is understandable that the coefficient of determination (R 2 ) is a statistical indicator used to measure the degree to which the model explains the variability of the data, usually between 0 and 1. 2 The larger the value, the stronger the model's ability to explain the data.
[0070] In the specific implementation, the ABIC value can be minimized or R 2 The number of candidate breakpoints corresponding to the fitting model with the largest value is the optimal number of breakpoints.
[0071] Step S40: determining the fitting model corresponding to the optimal number of breakpoints as a target fitting model, and obtaining a data analysis result based on the target fitting model.
[0072] It should be understood that the target fitting model can be the one with the minimum ABIC value or R 2 The fitting model with the largest value can be regarded as an accurate infection rate change model, which makes it easier for users to better interpret the original pathogen data based on the infection rate change model, thereby meeting different epidemiological research and analysis needs.
[0073] In this embodiment, by determining the optimal number of breakpoints from a number of candidate breakpoints, it is possible to effectively cope with complex and diverse pathogen data, avoiding the limitations of traditional breakpoint selection, thereby improving the applicability and generalization of the model to different types of data. And by introducing the parallel computing technology of the R language, the computational efficiency is significantly improved, so that the method can quickly converge to the optimal solution in large-scale data processing or multi-pathogen analysis, reducing the model's dependence on initial conditions, enhancing the model's stability and repeatability, and more conducive to meeting the real-time analysis needs in epidemiological research.
[0074] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 2 , Figure 2 This is a flow chart of the second embodiment of the pathogen data analysis method based on piecewise linear fitting of the present application.
[0075] In this embodiment, considering that when evaluating a model, when using criteria such as AIC and BIC alone, it is often difficult to achieve the best balance between model complexity and goodness of fit when processing high-noise or unbalanced sample data, resulting in overfitting or underfitting problems, step S30 specifically includes: steps S301 to S304:
[0076] Step S301: calculating the ABIC value of the fitting model corresponding to each number of the candidate breakpoints based on a preset combined information criterion, wherein the preset combined information criterion is a weighted combination of AIC and BIC.
[0077] It should be understood that the preset combined information criterion in this embodiment can be called ABIC, which is a weighted combination of AIC and BIC, and is used to consider both the complexity and the goodness of fit of the model. The calculation formula of the ABIC value is:
[0078] ABIC = α × AIC + (1-α) × BIC
[0079] Wherein, α is a weight parameter, which is usually taken as 0.5, AIC is the AIC value of the fitting model corresponding to each number of candidate breakpoints calculated based on AIC, and BIC is the BIC value of the fitting model corresponding to each number of candidate breakpoints calculated based on BIC;
[0080] The calculation formulas for AIC and BIC are:
[0081] AIC=2k-2ln(L)
[0082] BIC = kln(n)-2ln(L)
[0083] Where k is the number of parameters of the fitting model, L is the maximum likelihood function value of the fitting model, and n is the sample size.
[0084] Step S302: Calculate the R of the fitting model corresponding to each number of candidate breakpoints based on the determination coefficient. 2 value;
[0085] It should be understood that ABIC takes into account the goodness of fit and complexity of the model, and can effectively prevent overfitting. Furthermore, when evaluating the model, the model's ability to explain the data can be taken into account. When determining the optimal number of breakpoints, the coefficient of determination (R2 ). 2 The value is calculated as:
[0086]
[0087] In the formula, y i is the observed value, is the predicted value, y i is the mean of the observed values. 2 The closer the value is to 1, the stronger the model's ability to explain the data.
[0088] Step S303: Determine the number of candidate breakpoints of the fitting model with the smallest ABIC value as the optimal number of breakpoints.
[0089] Step S304: R 2 The number of candidate breakpoints of the fitting model with the largest value is determined as the optimal number of breakpoints.
[0090] It should be understood that, in the fitting model corresponding to each of the candidate breakpoint numbers, R can be selected under the condition of satisfying the preset growth threshold. 2 The fitting model with the largest value is selected, and the corresponding number of candidate breakpoints is determined as the optimal number of breakpoints, wherein the preset growth threshold condition is expressed as (1+r), and r is the growth coefficient.
[0091] In practice, the coefficient of determination strategy is to compare the R values of the fitted models with different numbers of breakpoints. 2 value, and select R under the condition of satisfying the growth threshold (1+r) 2 The model with the largest value is used to determine the optimal number of breakpoints.
[0092] Therefore, by calculating the ABIC value and R of the fitted model under each number of candidate breakpoints, 2 By comparing the values, the number of candidate breakpoints and the corresponding breakpoint positions that minimize the ABIC value or maximize the R value can be determined, and they can be determined as the optimal number of breakpoints and the optimal breakpoint positions.
[0093] In this embodiment, the ABIC value of the fitting model corresponding to each number of candidate breakpoints is calculated based on a preset combined information criterion, wherein the preset combined information criterion is a weighted combination of AIC and BIC; the R value of the fitting model corresponding to each number of candidate breakpoints is calculated based on the determination coefficient. 2 value; thus the ABIC value is minimized or R 2 The number of candidate breakpoints of the fitting model with the largest value is determined as the optimal number of breakpoints. 2The value is used as the evaluation index for breakpoint selection, and combined with the iterative search mechanism, the number and position of breakpoints are automatically optimized to ensure that the ideal fitting effect can be obtained under different data environments. Compared with the traditional single standard optimization method, the multi-index joint optimization strategy in this embodiment significantly improves the accuracy and rationality of breakpoint selection, and can better balance the complexity and fit of the model.
[0094] Based on the first and second embodiments of the present application, in the third embodiment of the present application, the same or similar contents as those of the first and second embodiments can be referred to the above description, and will not be described in detail later. Figure 3 , Figure 3 This is a flow chart of the third embodiment of the pathogen data analysis method based on piecewise linear fitting of the present application.
[0095] In this embodiment, considering that the visualization means in the existing method are relatively simple and lack in-depth analysis and intuitive display of the fitting results, step S40 specifically includes: steps S401 to S402:
[0096] Step S401: determining the fitting model corresponding to the optimal number of breakpoints as a target fitting model, wherein the target fitting model is represented by a plurality of linear equations.
[0097] It should be noted that the target fitting model can be expressed as follows:
[0098]
[0099] Where Y i represents the infection rate of the i-th sample, X i represents the patient age of the i-th sample, α k and β k are the intercept and slope of the kth segment, ∈ i is the error term. τ1, τ2, τ m-1 is the estimated value of the segmentation point (breakpoint), and m is the optimal number of breakpoints.
[0100] It should be understood that the above model describes the linear regression relationship in different age groups (separated by the breakpoint τ), and each segment corresponds to a linear equation. This segmented form can more accurately fit the changes in respiratory pathogen infection rates in different age groups. This model can capture the global trend of the data and can also describe the changing characteristics between different age groups in detail.
[0101] Step S402: using the drawing function of the R language, generating a visual representation of the target fitting model according to the pathogen data and each of the linear equations.
[0102] It should be understood that after the fitting is completed, the fitting results can be visualized to help users understand and interpret the model results more deeply. Since the target fitting model is obtained by fitting the function in the segmented package in the R language, the drawing function in the R language, such as the ggplot2 package, can also be used to generate a visual representation of the target fitting model.
[0103] Specifically, the ggplot2 package in R language can be used to draw a line graph of infection rate versus patient age, and the position of each breakpoint can be marked in the line graph to clearly show the linear trend of each segment. The visual representation can help users better understand the fitting effect of the model and provide an intuitive basis for analyzing the transmission pattern of the disease involved in the pathogen data.
[0104] This example significantly improves computational efficiency when processing large-scale, multi-pathogen data, and clearly displays the results of piecewise linear fitting through rich visualization tools. Compared with traditional methods, this example provides more intuitive charts for interpreting the results of the target fitting model, helping users quickly identify the infection rate trends of key age groups and supporting more accurate epidemiological learning analysis and decision-making.
[0105] In addition, please refer to Figure 4 The effect of the pathogen data analysis method based on piecewise linear fitting in this application is illustrated with specific experimental data. Figure 4 This is a schematic diagram of the entire process of the pathogen data analysis method based on piecewise linear fitting in this application.
[0106] exist Figure 4 The pathogen data analysis method based on piecewise linear fitting in this application can be divided into three stages: S1 data preparation and preprocessing, S2 preliminary model establishment and optimization, and S3 final model fitting and visualization.
[0107] S1 data preparation and preprocessing:
[0108] (a) Input dataset
[0109] In this experiment, we obtained the infection data of patients recorded in a regional hospital within 15 months and constructed a data set, where the age range is 0-104 years old, for example, there are 112 patients aged 1 year old, and there are 48 types of pathogens. The data set includes pathogen data such as patient age, pathogen number, number of infected patients, and the infection rate (percentage) of the corresponding pathogen. These data cover a variety of respiratory pathogens, such as influenza virus, respiratory syncytial virus, and coronavirus, forming a broad, multi-dimensional data set for subsequent piecewise linear fitting.
[0110] (b) Data cleaning and classification
[0111] After the data is imported, it is cleaned to ensure its quality. The cleaning step includes processing missing values and outliers to ensure the completeness and accuracy of the data. Next, the data is classified according to the pathogen number and sorted by the age of the patient. Through such preprocessing steps, the foundation can be laid for the subsequent piecewise linear regression analysis to ensure that the analysis can accurately reflect the changes in infection rates in different age groups.
[0112] Initial establishment and optimization of S2 model:
[0113] (a) Candidate breakpoint range setting
[0114] After data preprocessing is completed, the preset range of candidate breakpoints can be obtained. For example, the pathogen number is "BA0008", the corresponding pathogen is Streptococcus pneumoniae, the number of breakpoints (nψ) is set to an integer between 1 and 4, and the segmented package in R language is used to fit the model for each candidate breakpoint number. The segmented package can optimize the piecewise linear model by automatically adjusting the position of the breakpoints to find the optimal breakpoint configuration (number of breakpoints and breakpoint positions).
[0115] (b) Optimal breakpoint selection
[0116] In order to determine the optimal number and position of breakpoints, the model evaluation indicators can be calculated for each number of candidate breakpoints, including ABIC (combined information criterion of AIC and BIC) and R 2 (coefficient of determination). By comparing the ABIC values and R 2 The breakpoint configuration that minimizes the ABIC value or maximizes the R2 value is selected. In this experiment, the ABIC value is used to balance the complexity of the model and the ability of the model to explain the data.
[0117] The calculation results show that selecting four breakpoints can minimize the ABIC value (R 2 The indicator is not used), which shows that the model under this configuration has achieved the best balance between complexity and fit. Therefore, 4 breakpoints can be determined as the optimal number of breakpoints.
[0118] S3 final model fitting and visualization:
[0119] (a) Final model fitting
[0120] After determining the optimal number of breakpoints, use these breakpoints for the final piecewise linear regression fit. The final target fitting model is a model that can accurately reflect the changes in pathogen infection rates in different age groups. This target fitting model can more accurately identify key age groups and help users deeply understand the changes in pathogen infection rates in these age groups.
[0121] (b) Result visualization
[0122] In order to make the analysis results more intuitive, you can generate detailed visualization charts based on the fitting results of the target fitting model. Figure 5 Let's introduce the visualization chart in detail. Figure 5 This is a piecewise linear fitting relationship diagram based on the relationship between the infection rate of Streptococcus pneumoniae BA0008 and the patient's age.
[0123] exist Figure 5 In the figure, the horizontal axis is the patient age (Age), and the vertical axis is the pneumococcal BA0008 infection rate (BA0008_infection_Rates). The straight line represents the linear fitting line of each age group, the points represent the actual infection rate data points, and the dotted line is the optimal breakpoint position. There are 4 breakpoints (Breakpoints) in the figure, which are: 5.15, 15.22, 69.87 and 97.85.
[0124] The graph shows that the model fits well in each segment and accurately describes the infection rate trend of each age group. Through this visualization chart, users can clearly identify high-risk age groups, thereby better guiding the formulation and implementation of public health strategies.
[0125] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the pathogen data analysis method based on piecewise linear fitting of the present application. More forms of simple transformations based on this technical concept are all within the scope of protection of the present application.
[0126] The present application also provides a pathogen data analysis device based on piecewise linear fitting, please refer to Figure 6 , Figure 6 This is a schematic diagram of the module structure of the first embodiment of the pathogen data analysis device based on piecewise linear fitting of the present application, the device includes:
[0127] The data preprocessing module 601 is used to obtain pathogen data and preprocess the pathogen data to obtain processed pathogen data;
[0128] The breakpoint selection module 602 is used to determine the number of candidate breakpoints, and perform model fitting on the processed pathogen data based on the number of candidate breakpoints; use a preset combined information criterion or determination coefficient to evaluate the fitting model corresponding to each candidate breakpoint number, and select the model based on minimizing the ABIC value or maximizing the R 2 The value determines the optimal number of breakpoints;
[0129] The result output module 603 is used to determine the fitting model corresponding to the optimal number of breakpoints as a target fitting model, and obtain a data analysis result based on the target fitting model.
[0130] Furthermore, the breakpoint selection module 602 is also used to obtain a preset range of candidate breakpoint numbers, determine a number of candidate breakpoint numbers based on the preset range of candidate breakpoint numbers, and the preset range of candidate breakpoint numbers is pre-configured by the user based on task requirements; use the R language segmented package to fit the model of the processed pathogen data according to each of the candidate breakpoint numbers, and obtain the fitting model corresponding to each of the candidate breakpoint numbers.
[0131] Furthermore, the breakpoint selection module 602 is further configured to calculate the ABIC value of the fitting model corresponding to each of the candidate breakpoint numbers based on a preset combined information criterion, wherein the preset combined information criterion is a weighted combination of AIC and BIC; and calculate the R value of the fitting model corresponding to each of the candidate breakpoint numbers based on the determination coefficient. 2 value; minimize the ABIC value or R 2 The number of candidate breakpoints of the fitting model with the largest value is determined as the optimal number of breakpoints;
[0132] The calculation formula of the ABIC value is:
[0133] ABIC = α × AIC + (1-α) × BIC
[0134] In the formula, α is a weight parameter, AIC is the AIC value of the fitting model corresponding to each number of candidate breakpoints calculated based on AIC, and BIC is the BIC value of the fitting model corresponding to each number of candidate breakpoints calculated based on BIC.
[0135] Furthermore, the breakpoint selection module 602 is further configured to select, from the fitting models corresponding to the number of candidate breakpoints, the R 2 The fitting model with the largest value is selected, and the corresponding number of candidate breakpoints is determined as the optimal number of breakpoints, wherein the preset growth threshold condition is expressed as (1+r), and r is the growth coefficient.
[0136] The R 2 The value is calculated as:
[0137]
[0138] In the formula, y i is the observed value, is the predicted value, y i is the mean of the observed values.
[0139] Furthermore, the result output module 603 is also used to determine the fitting model corresponding to the optimal number of breakpoints as the target fitting model, and the target fitting model is represented by a number of linear equations; using the drawing function of the R language, a visual representation of the target fitting model is generated according to the pathogen data and each linear equation.
[0140] Furthermore, the data preprocessing module 601 is also used to collect original pathogen data, and construct data sets corresponding to different age stages based on the original pathogen data; sort and clean the pathogen data in each of the data sets to obtain processed pathogen data.
[0141] This embodiment can effectively deal with complex and diverse pathogen data by determining the optimal number of breakpoints from a number of candidate breakpoints, avoiding the limitations of traditional breakpoint selection, thereby improving the applicability and generalization ability of the model to different types of data. Specifically, the preset combined information criterion ABIC value and determination coefficient R 2 The value is used as the basis for selecting the optimal number of breakpoints. Compared with the traditional single-standard optimization method, it improves the accuracy and rationality of breakpoint selection and can better balance the complexity and fit of the model.
[0142] Other embodiments or specific implementations of the pathogen data analysis device based on piecewise linear fitting described in the present application can refer to the above-mentioned method embodiments and will not be repeated here.
[0143] The present application also provides a pathogen data analysis device based on piecewise linear fitting, and the pathogen data analysis device based on piecewise linear fitting includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the pathogen data analysis method based on piecewise linear fitting in the above-mentioned embodiment one.
[0144] Reference below Figure 7 , Figure 7 The schematic diagram of the structure of the pathogen data analysis device based on piecewise linear fitting in the present application. The pathogen data analysis device based on piecewise linear fitting in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The pathogen data analysis device based on piecewise linear fitting shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0145] like Figure 7 As shown, the pathogen data analysis device based on piecewise linear fitting may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the pathogen data analysis device based on piecewise linear fitting are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the pathogen data analysis device based on piecewise linear fitting to communicate wirelessly or wired with other devices to exchange data. Although the figure shows a pathogen data analysis device based on piecewise linear fitting with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.
[0146] The present application also provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the pathogen data analysis method based on piecewise linear fitting in the above-mentioned embodiment.
[0147] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0148] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A pathogen data analysis method based on piecewise linear fitting, characterized in that: The method comprises: Acquiring pathogen data, and preprocessing the pathogen data to obtain processed pathogen data; Determining a number of candidate breakpoints, and performing model fitting on the processed pathogen data based on the number of candidate breakpoints; The preset combined information criterion or determination coefficient is used to evaluate the fitting model corresponding to each number of candidate breakpoints, and the model is evaluated based on minimizing the ABIC value or maximizing the R 2 The value determines the optimal number of breakpoints; The fitting model corresponding to the optimal number of breakpoints is determined as a target fitting model, and a data analysis result is obtained based on the target fitting model.
2. The method according to claim 1, characterized in that The step of determining a number of candidate breakpoints and performing model fitting on the processed pathogen data based on the number of candidate breakpoints comprises: Obtaining a preset candidate breakpoint number range, and determining a number of candidate breakpoint numbers based on the preset candidate breakpoint number range, wherein the preset candidate breakpoint number range is pre-configured by a user based on task requirements; The segmented package of R language is used to perform model fitting on the treated pathogen data according to the number of each candidate breakpoint, so as to obtain a fitting model corresponding to the number of each candidate breakpoint.
3. The method according to claim 1, characterized in that The preset combined information criterion or determination coefficient is used to evaluate the fitting model corresponding to each of the candidate breakpoint numbers, and the model is evaluated based on minimizing the ABIC value or maximizing the R 2 The steps of determining the optimal number of breakpoints include: Calculating the ABIC value of the fitting model corresponding to each of the candidate breakpoint numbers based on a preset combined information criterion, wherein the preset combined information criterion is a weighted combination of AIC and BIC; The R of the fitting model corresponding to each candidate breakpoint number is calculated based on the determination coefficient. 2 value; The number of candidate breakpoints of the fitting model with the smallest ABIC value is determined as the optimal number of breakpoints; Or, R 2 The number of candidate breakpoints of the fitting model with the largest value is determined as the optimal number of breakpoints.
4. The method according to claim 3, characterized in that The R 2 The step of determining the number of candidate breakpoints of the fitting model with the largest value as the optimal number of breakpoints includes: In the fitting models corresponding to the number of candidate breakpoints, select R 2 The fitting model with the largest value is selected, and the corresponding number of candidate breakpoints is determined as the optimal number of breakpoints, wherein the preset growth threshold condition is expressed as (1+r), and r is the growth coefficient; The R 2 The value is calculated as: In the formula, y i is the observed value, is the predicted value, y i is the mean of the observed values.
5. The method according to claim 3, characterized in that The calculation formula of the ABIC value is: ABIC = α × AIC + (1-α) × BIC In the formula, α is a weight parameter, AIC is the AIC value of the fitting model corresponding to each number of candidate breakpoints calculated based on AIC, and BIC is the BIC value of the fitting model corresponding to each number of candidate breakpoints calculated based on BIC.
6. The method according to claim 1, characterized in that The step of determining the fitting model corresponding to the optimal number of breakpoints as a target fitting model, and obtaining a data analysis result based on the target fitting model includes: Determine the fitting model corresponding to the optimal number of breakpoints as a target fitting model, wherein the target fitting model is represented by a plurality of linear equations; The drawing function of the R language is used to generate a visual representation of the target fitting model according to the pathogen data and each of the linear equations.
7. The method according to claim 1, characterized in that The step of obtaining pathogen data and preprocessing the pathogen data to obtain processed pathogen data includes: Collecting original pathogen data, and constructing data sets corresponding to different age stages based on the original pathogen data; The pathogen data in each of the data sets are sorted and cleaned to obtain processed pathogen data.
8. A pathogen data analysis device based on piecewise linear fitting, characterized in that: The device comprises: A data preprocessing module, used to obtain pathogen data and preprocess the pathogen data to obtain processed pathogen data; The breakpoint selection module is used to determine the number of candidate breakpoints, and perform model fitting on the treated pathogen data based on the number of candidate breakpoints; use a preset combined information criterion or determination coefficient to evaluate the fitting model corresponding to each candidate breakpoint, and select the model based on minimizing the ABIC value or maximizing the R 2 The value determines the optimal number of breakpoints; The result output module is used to determine the fitting model corresponding to the optimal number of breakpoints as a target fitting model, and obtain a data analysis result based on the target fitting model.
9. A pathogen data analysis device based on piecewise linear fitting, characterized in that: The device includes: a memory, a processor, and a pathogen data analysis program based on piecewise linear fitting stored in the memory and executable on the processor, wherein the pathogen data analysis program based on piecewise linear fitting is configured to implement the steps of the pathogen data analysis method based on piecewise linear fitting as described in any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores a pathogen data analysis program based on piecewise linear fitting, and when the pathogen data analysis program based on piecewise linear fitting is executed by the processor, the steps of the pathogen data analysis method based on piecewise linear fitting as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method and device for predicting epidemic situation data in a segmented mode, medium and electronic equipment
CN111489830A
Piecewise linearization of multivariable data
US11645359B1