A method for structuring logs
The method structures unstructured medical consumables management logs by segmenting, preprocessing, and training with a RoBERTa model, improving data processing and decision-making in medical institutions.
Patent Information
- Application Number
- CN202411427955.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-10-14
AI Technical Summary
Medical consumables management logs are predominantly unstructured, hindering effective data refinement and utilization, which is crucial for improving management efficiency and ensuring quality and safety in medical institutions.
A method involving accessing medical consumables management logs, segmenting them into entries, using a knowledge graph to generate regular expressions for word segmentation, preprocessing fields, and training a RoBERTa pre-trained model to convert unstructured data into structured embedded codes.
Enhances data processing efficiency, accuracy, and adaptability, supporting informed decision-making and digital transformation in medical consumables management by converting unstructured logs into structured data forms.
Smart Images

Figure CN118966150B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of artificial intelligence technology, and in particular to a method for structuring logs. Background Art
[0002] In the scenario of medical consumables management, with the rapid development and refinement of medical services, a large amount of medical consumables management log data has been generated. These data record in detail the procurement, inventory, collection, consumption and related maintenance information of medical consumables. This information is extremely valuable for improving the operational efficiency of medical institutions and ensuring medical quality and safety. However, most medical consumables management logs are still stored in the form of unstructured text data, which has not been effectively refined and applied for a long time and cannot meet the actual management needs well.
[0003] In today's era of rapid development of information technology, especially the rapid development of artificial intelligence technology, medical management systems are in urgent need of improving their informatization and intelligence levels. By using advanced information technology and artificial intelligence technology, these massive amounts of unstructured medical consumables management log data can be effectively refined and analyzed to better meet the actual management needs of medical institutions. This can not only improve the management efficiency of medical consumables, but also further ensure medical quality and safety, and improve the overall operation level of medical institutions.
[0004] Using artificial intelligence models to process management logs is the key to improving the efficiency and accuracy of medical consumables management. However, before training and applying artificial intelligence technology models, they usually require a large amount of corresponding structured data as support so that the model can understand and learn the semantic information in the text. For the unstructured data scenario of medical consumables management logs, a solution is urgently needed to convert these unstructured log data into corresponding embedded coding data, and build a training data set based on this, and then train the artificial intelligence model to promote the deep integration of medical consumables management and artificial intelligence algorithms, provide medical institutions with more accurate and efficient consumables management services, and promote the digital transformation and intelligent upgrading of the medical industry. Summary of the invention
[0005] The purpose of this application is to propose a method for structuring logs to solve or overcome the above-mentioned technical problems existing in the prior art.
[0006] According to a first aspect of an embodiment of the present application, a method for structuring a log is provided, comprising:
[0007] Access a medical consumables management log data source to obtain medical consumables management log data to form a training set;
[0008] The training set is divided according to the entries to form a plurality of log entries;
[0009] Generate a regular expression based on the constructed medical consumables knowledge graph to perform word segmentation processing on the log entry to extract the name identification field, model identification field, brand identification field, and specification identification field of the medical consumables;
[0010] Preprocessing the name identification field, model identification field, brand identification field, and specification identification field of the medical consumables to obtain input data for the RoBERTa pre-training model;
[0011] Training the RoBERTa pre-trained model based on the input data until the training of the RoBERTa pre-trained model is completed, and using the trained RoBERTa pre-trained model as a log data structured model;
[0012] Obtain the management log data of pending medical consumables;
[0013] Based on the log data structured model, the embedded form representation of the to-be-processed medical consumables management log data is predicted to obtain the corresponding embedded code.
[0014] The method for structuring the log provided in this application obtains the original, unstructured medical consumables management log data by accessing the medical consumables management log data source. This is the first step in data processing, which ensures the data source for subsequent analysis. Then, the acquired training set is segmented according to the entries to form several log entries. This step helps to refine the data into units that are easier to process and analyze, laying the foundation for subsequent word segmentation and field extraction. Further, based on the constructed medical consumables knowledge graph, the scheme generates a regular expression for word segmentation of log entries. The key to this step is to use the domain knowledge provided by the knowledge graph to help the regular expression more accurately identify and extract key fields such as the name, model, brand and specification of medical consumables. Furthermore, through word segmentation and field extraction, unstructured text data is converted into a structured data form, which facilitates subsequent data preprocessing and model training. Finally, the extracted fields are preprocessed to obtain the input data of the RoBERTa pre-training model, and the input data obtained after preprocessing is used to train the RoBERTa pre-training model. The RoBERTa pre-trained model that has completed training is used as a log data structured model. Based on the log data structured model, the embedded form representation of the log data to be processed can be predicted and the corresponding embedded code can be obtained. These embedded codes are structured data forms and can be directly used in subsequent data analysis, management decision-making and other scenarios. They provide strong support for the informatization and intelligence of medical consumables management and promote the digital transformation and intelligent upgrading of the medical industry. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Hereinafter, some specific embodiments of the present application will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:
[0016] Figure 1 A flowchart of a method for structuring logs provided in an embodiment of the present application. DETAILED DESCRIPTION
[0017] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present application should fall within the scope of protection of the embodiments of the present application.
[0018] Figure 1 A flow chart of a method for structuring logs provided in an embodiment of the present application. Figure 1 , which includes:
[0019] Access a medical consumables management log data source to obtain medical consumables management log data to form a training set;
[0020] The training set is divided according to the entries to form a plurality of log entries;
[0021] Generate a regular expression based on the constructed medical consumables knowledge graph to perform word segmentation processing on the log entry to extract the name identification field, model identification field, brand identification field, and specification identification field of the medical consumables;
[0022] Preprocessing the name identification field, model identification field, brand identification field, and specification identification field of the medical consumables to obtain input data for the RoBERTa pre-training model;
[0023] Training the RoBERTa pre-trained model based on the input data until the training of the RoBERTa pre-trained model is completed, and using the trained RoBERTa pre-trained model as a log data structured model;
[0024] Obtain the management log data of pending medical consumables;
[0025] Based on the log data structured model, the embedded form representation of the to-be-processed medical consumables management log data is predicted to obtain the corresponding embedded code.
[0026] The method for structuring the log provided in this application obtains the original, unstructured medical consumables management log data by accessing the medical consumables management log data source. This is the first step in data processing, which ensures the data source for subsequent analysis. Then, the acquired training set is segmented according to the entries to form several log entries. This step helps to refine the data into units that are easier to process and analyze, laying the foundation for subsequent word segmentation and field extraction. Further, based on the constructed medical consumables knowledge graph, the scheme generates a regular expression for word segmentation of log entries. The key to this step is to use the domain knowledge provided by the knowledge graph to help the regular expression more accurately identify and extract key fields such as the name, model, brand and specification of medical consumables. Furthermore, through word segmentation and field extraction, unstructured text data is converted into a structured data form, which facilitates subsequent data preprocessing and model training. Finally, the extracted fields are preprocessed to obtain the input data of the RoBERTa pre-training model, and the input data obtained after preprocessing is used to train the RoBERTa pre-training model. The RoBERTa pre-trained model that has completed training is used as a log data structured model. Based on the log data structured model, the embedded form representation of the log data to be processed can be predicted and the corresponding embedded code can be obtained. These embedded codes are structured data forms and can be directly used in subsequent data analysis, management decision-making and other scenarios. They provide strong support for the informatization and intelligence of medical consumables management and promote the digital transformation and intelligent upgrading of the medical industry.
[0027] Optionally, the method further includes: adding rare events or oversampled events to the medical consumables management log data to enhance the medical consumables management log data, and forming the training set based on the enhanced medical consumables management log data, wherein all rare events include sudden large-scale consumption of consumables, usage records of rare medical equipment, or a surge in demand for consumables due to specific medical emergencies, and the oversampled events include the usage records of medical consumables being less than a set number of records in the medical consumables management log data, but the degree of explanation of the business scenario is greater than the set explanation degree value.
[0028] To this end, the above enhanced processing solution has the following technical advantages:
[0029] (1) By adding rare events or oversampled events to the medical consumables management log data and enhancing the original data, the data diversity of the training set can be enriched. This helps the model learn more data features in different scenarios during the training process, thereby improving the generalization ability of the model.
[0030] Rare events, such as sudden large-scale consumption of consumables and rare medical equipment usage records, are usually difficult to predict but highly influential events in medical consumables management. Including these events in the training set can enable the model to better respond to such abnormal situations and improve the accuracy and timeliness of management.
[0031] Oversampled events, that is, events with fewer usage records but a higher degree of explanation for business scenarios, can increase the proportion of these events in the training set, allowing the model to pay more attention to these data that have an important impact on the business, thereby improving the effectiveness of the model in practical applications.
[0032] (2) The enhanced training set is closer to the actual medical consumables management scenario because it contains more types of data and more complex business situations. This helps the model better learn and understand these scenarios during the training process, thereby more accurately predicting and interpreting data in practical applications.
[0033] By considering rare events and oversampled events, the model can better capture key information and potential rules in medical consumables management, and provide medical institutions with more accurate and efficient consumables management services.
[0034] (3) The enhanced training set and trained model can more accurately predict the demand and usage of consumables, providing a scientific basis and data support for medical institutions’ procurement planning, inventory management, and distribution decisions.
[0035] Optionally, the training set is divided into items to form a plurality of log items, including:
[0036] Based on the configured log parsing library, the training set is parsed to determine blank lines and / or line separators therein;
[0037] Building a log entry separator based on the blank line and / or line separator;
[0038] Determining log entry boundaries based on a log entry separator;
[0039] The training set is divided into entries based on the log entry boundary to form a plurality of log entries.
[0040] To this end, combined with the specific steps of dividing the training set according to the items in the technical solution, there are the following technical benefits:
[0041] (1) Accurately parse the log structure: By parsing the training set based on the configuration of the log parsing library, blank lines and / or line separators can be accurately identified. These symbols are usually standard markers used to separate different entries in log data, and their accurate identification is crucial for subsequent data segmentation.
[0042] (2) Automatically construct separators: Log entry separators are constructed based on the parsed blank lines and / or line separators, which enables automated processing of log entry segmentation. This process reduces the need for manual intervention, reduces the risk of human error, and improves the accuracy and efficiency of data processing.
[0043] (3) Diversified input data: After the training set is divided into entries, each log entry contains a relatively complete information unit. These unitized data can be used as independent samples in subsequent model training, which helps the model learn richer data features and patterns. This diversified input data can enhance the generalization ability of the model, enabling it to better cope with various situations in practical applications.
[0044] (4) Flexible response to log data in different formats: Different medical institutions or systems may generate medical consumables management log data in different formats. By parsing based on the configuration-based log parsing library, the parsing rules can be flexibly adjusted to adapt to different data formats. This makes the technical solution more versatile and adaptable, and can support data processing tasks in complex scenarios.
[0045] (5) Standardized log entry format: After the training set is divided into a standardized log entry format, it is helpful to achieve the standardization and normalization of medical consumables management log data. This standardized processing not only facilitates subsequent data analysis and model training, but also helps to improve the efficiency of data sharing and collaboration between medical institutions.
[0046] (6) Support for subsequent data processing and model training: Accurately segmented log entries provide high-quality input data for subsequent word segmentation, field extraction, data preprocessing and other steps. The successful execution of these steps depends on the quality of the input data, and high-quality input data comes from accurate log entry segmentation. Therefore, this technical solution lays a solid foundation for subsequent data processing and model training.
[0047] Optionally, the method further comprises:
[0048] Analyzing semantic dependencies between the plurality of log entries to construct heterogeneous nodes and heterogeneous edges;
[0049] Defining a meta-path based on the heterogeneous nodes and the heterogeneous edges, and walking the meta-path to generate heterogeneous neighbors;
[0050] The heterogeneous neighbors are converted into entity relationship annotations and added to log entries with dependencies.
[0051] To this end, in the technical solution for processing medical consumables management log data, semantic dependency analysis between log entries is introduced, heterogeneous nodes and edges are constructed, meta-paths are defined and heterogeneous neighbors are generated. Finally, heterogeneous neighbors are converted into entity relationship annotations and added to log entries with dependency relationships, which has the following technical benefits:
[0052] (1) Semantic dependency analysis: By analyzing the semantic dependency relationships between log entries, we can gain a deeper understanding of the internal logic and associations in log data. Semantic dependency analysis can reveal the dependencies and mutual influences between different log entries, providing richer and more accurate information for subsequent data processing and analysis.
[0053] (2) Constructing heterogeneous nodes and edges: Based on the results of semantic dependency analysis, constructing heterogeneous nodes (representing different entities or concepts) and heterogeneous edges (representing the relationship or interaction between entities) can more realistically reflect the complexity and diversity of medical consumables management log data. This heterogeneous information network model provides richer and more complex input features for machine learning models, which helps to improve the accuracy and robustness of the model.
[0054] (4) Define meta-paths and generate heterogeneous neighbors: Meta-paths are sequences connecting heterogeneous nodes. By defining meta-paths and walking along these paths, a set of heterogeneous neighbors associated with a specific node can be generated. These heterogeneous neighbors represent other entries or entities that are semantically associated with a specific log entry, providing more comprehensive and in-depth information for data reasoning and decision support.
[0055] (5) Entity relationship annotation: Converting heterogeneous neighbors into entity relationship annotations and adding them to log entries with dependencies is essentially building a knowledge graph in the field of medical consumables management. A knowledge graph is a structured semantic network that can clearly represent the relationships and attributes between entities. By building and applying a knowledge graph, medical institutions can more conveniently query, analyze, and utilize the knowledge resources in medical consumables management log data, thereby improving management level and decision-making efficiency.
[0056] (6) The comprehensive application of the above steps not only enhances the depth and breadth of data processing, but also improves the value of data utilization. By deeply mining and analyzing the semantic dependencies between log entries, medical institutions can more accurately grasp key information such as the use of medical consumables, inventory changes, and demand trends, providing strong data support for business decisions. At the same time, this data processing method based on semantic dependencies and heterogeneous information networks also provides new ideas and methods for knowledge discovery and business insights in the field of medical consumables management.
[0057] Optionally, generating a regular expression based on the constructed medical consumables knowledge graph includes:
[0058] Traversing the medical consumables knowledge graph to parse out medical consumables entities, and predicting the parsed medical consumables entities to obtain variants of the medical consumables entities, wherein the variants of the medical consumables entities include abbreviations and spelling errors;
[0059] Determine the mode information of the medical consumables entity according to the medical consumables entity and the corresponding variant, wherein the mode information includes a prefix, a suffix, and a separator;
[0060] Analyzing a sequence log key of the medical consumable based on the mode information of the medical consumable entity;
[0061] Based on the created online regular expression generator, the structure of the log entry is predicted and identified according to the serial log key of the medical consumables, and a regular expression is generated accordingly.
[0062] To this end, the process of generating regular expressions based on the constructed medical consumables knowledge graph has the following technical benefits:
[0063] (1) Accurately identify medical consumables entities and their variants: By traversing the medical consumables knowledge graph, various medical consumables entities can be systematically parsed. Furthermore, predicting the variants of these entities (such as abbreviations and spelling errors) ensures the comprehensiveness and accuracy of data processing. This method is more efficient and has a lower error rate than traditional manual recognition.
[0064] (2) Generate regular expressions based on pattern information: Based on the pattern information (such as prefixes, suffixes, and separators) determined by the medical consumables entity and its variants, more precise and flexible regular expressions can be generated. These regular expressions can more accurately match the medical consumables-related information in the log entries and reduce the occurrence of false matches and missed matches.
[0065] (3) Automatically generate regular expressions: Using an online regular expression generator, the structure of log entries is automatically predicted and identified based on the serial log keys of medical consumables, and regular expressions are generated accordingly. This process realizes the automation and intelligence of data processing, reduces the need for manual intervention, and improves the efficiency and consistency of data processing.
[0066] (4) Optimizing log entry parsing capabilities: By generating regular expressions, key information in medical consumables management log entries can be parsed and extracted more efficiently, such as consumable type, quantity, usage date, etc. This information is crucial for the refined management of medical consumables and helps medical institutions achieve accurate procurement, reasonable inventory, and efficient use of consumables.
[0067] (5) Unified data format and naming rules: Through the application of regular expressions, the data format and naming rules in the medical consumables management log entries can be unified to reduce data inconsistency and redundancy. This standardization and normalization process provides a cleaner and more orderly data source for subsequent data analysis and mining.
[0068] (6) Easy to update and expand: The method of generating regular expressions based on knowledge graphs has good scalability and maintainability. As the types of medical consumables increase and the usage scenarios change, new needs can be adapted by updating the knowledge graph and regenerating regular expressions. This method is more flexible and efficient than the traditional hard coding method.
[0069] Optionally, the preprocessing of the name identification field, the model identification field, the brand identification field, and the specification identification field of the medical consumables to obtain input data for the RoBERTa pre-training model includes:
[0070] Formatting the name identification field, model identification field, brand identification field, and specification identification field of the medical consumables to generate a feature description of the medical consumables;
[0071] The medical consumables feature description is encoded to obtain token IDs (numeric identifiers) to serve as input data for the RoBERTa pre-training model.
[0072] To this end, in the medical consumables management system, the name identification field, model identification field, brand identification field, and specification identification field of medical consumables are preprocessed, and the processed data is used as the input of the RoBERTa pre-training model. This technical solution has the following technical benefits:
[0073] (1) Formatting: Formatting the name, model, brand, specification and other fields of medical consumables can eliminate inconsistencies and redundancies in the data and ensure that the data format of each field is unified. This processing helps reduce errors in subsequent data analysis and model training and improves the overall efficiency and accuracy of data processing.
[0074] (2) Generate feature descriptions of medical consumables: Generate feature descriptions of medical consumables through formatting. These descriptions contain key information about the consumables, which helps the RoBERTa pre-trained model better understand and identify different types of medical consumables. The model can learn richer feature representations during training, thereby enhancing its generalization ability in new scenarios and new data.
[0075] (3) Encoding to obtain token IDs: Encoding the feature description of medical consumables into token IDs (numeric identifiers) is a key step in converting text data into a format that can be processed by the model. The RoBERTa pre-trained model is based on the Transformer structure and can efficiently process numerical text inputs. The encoded data not only reduces the computational burden of the model, but also improves the speed and accuracy of the model in processing text.
[0076] (4) Automated data processing process: Through the automated pre-processing process, medical institutions can quickly collect and organize medical consumables information. This provides strong data support for subsequent consumables management, procurement decisions, inventory optimization, etc. At the same time, combined with the intelligent analysis capabilities of the RoBERTa pre-trained model, the automation and intelligence level of medical consumables management can be further improved.
[0077] Optionally, the training the RoBERTa pre-trained model based on the input data until the training of the RoBERTa pre-trained model is completed includes:
[0078] Obtaining a training strategy for the RoBERTa pre-trained model, and customizing a training parameter combination based on the training strategy;
[0079] Based on the training parameter combination, determining the training direction of the RoBERTa pre-training model;
[0080] The RoBERTa pre-trained model is trained based on the input data along the training direction.
[0081] To this end, in the medical consumables management system, in the process of training the RoBERTa pre-trained model based on the input data, by obtaining the training strategy of the RoBERTa pre-trained model, customizing the training parameter combination, and training along the determined training direction, this technical solution has the following technical benefits:
[0082] (1) Customized training parameter combination: By obtaining the training strategy of the RoBERTa pre-trained model and customizing the training parameter combination (such as learning rate, batch size, training rounds, etc.) according to the actual task requirements, the model training process can be made more refined and personalized. This customized training parameter method helps the model converge better and improves the training effect, thereby showing higher accuracy and robustness in medical consumables management tasks.
[0083] (2) Determine the training direction: Determine the training direction of the RoBERTa pre-trained model based on the combination of training parameters, which means that there are clear goals and paths in the training process. This helps to reduce the number of ineffective training, speed up training, and improve training efficiency. In the medical consumables management system, fast and efficient model training can be put into practical application more quickly, providing medical institutions with timely data support and decision-making basis.
[0084] (3) Adapting to different scenarios: By customizing the combination of training parameters and determining the training direction, the RoBERTa pre-trained model can better adapt to the medical consumables management tasks in different scenarios. This flexibility enables the model to maintain high performance when facing different medical institutions, different types of consumables and different management needs, and enhances the generalization ability of the model.
[0085] (4) Processing complex data: The data involved in medical consumables management tasks are often diverse and complex, such as different naming rules and format differences. Through the powerful text processing capabilities of the RoBERTa pre-trained model, combined with customized training parameter combinations and clear training directions, these complex data can be processed more effectively, improving the accuracy and efficiency of data utilization.
[0086] Optionally, it is characterized in that the training parameter combination includes embedding dimension, model architecture, sequence length range, batch size, weight decay degree, pruning strategy, and discard rate.
[0087] Optionally, there are multiple RoBERTa pre-trained models, one training parameter mapping has one training direction, and the training of the RoBERTa pre-trained model based on the input data along the training direction includes:
[0088] Along a training direction, training a RoBERTa pre-trained model based on the input data until a plurality of RoBERTa pre-trained models having completed training and equal in number to the training direction are obtained;
[0089] The multiple RoBERTa pre-trained models that have completed training are fused to obtain a fused RoBERTa model, and the fused RoBERTa model is used as the log data structured model.
[0090] To this end, in the medical consumables management system, a RoBERTa pre-training model training scheme containing multiple training parameter combinations is adopted, and the final fused RoBERTa model is obtained through model fusion, which has the following technical benefits:
[0091] (1) Multi-dimensional parameter optimization: By adjusting multiple training parameters such as embedding dimension, model architecture, sequence length range, batch size, weight decay, pruning strategy, and dropout rate, the RoBERTa pre-trained model can be optimized in multiple dimensions. This meticulous parameter adjustment helps the model achieve better performance in medical consumables management tasks, such as higher recognition accuracy and faster response speed.
[0092] (2) Multi-directional training: By specifying a training direction for each training parameter combination and training multiple RoBERTa pre-trained models along these directions, multiple models with different strengths can be obtained. These models perform well in their respective areas of expertise. By fusing these models, their advantages can be combined to enhance the generalization ability of the final model, so that it can maintain good performance in different scenarios and conditions.
[0093] (3) Parallel training: Multiple RoBERTa pre-trained models can be trained simultaneously to make full use of computing resources. This parallel training method can significantly shorten the training time and improve the training efficiency. At the same time, since each model focuses on one training direction, it can focus more on the optimization in that direction and avoid unnecessary computational waste.
[0094] (4) Flexible configuration: Flexibly configure the training parameter combination and the number of models based on factors such as computing resources, data volume, and training time. When resources are limited, you can save resources by reducing the number of models or lowering the values of certain training parameters; when resources are sufficient, you can increase the number of models and improve the training parameters to further improve model performance.
[0095] (5) By fusing multiple pre-trained RoBERTa models that have completed training, a fused RoBERTa model with better performance can be obtained. This fused model not only inherits the advantages of each sub-model, but also may further improve the overall performance through the complementary effect between sub-models. For example, in the task of medical consumables management, the fused model may perform well in terms of recognition accuracy, processing speed, and robustness.
[0096] (6) Powerful text processing capabilities: The RoBERTa pre-trained model itself has powerful text processing capabilities. Through customized training parameter combinations and model fusion, its processing capabilities for complex tasks can be further improved. In the medical consumables management system, this helps to better process various complex data (such as medical consumables information with different naming rules and formats) and improve the accuracy and efficiency of data utilization.
[0097] Optionally, fusing the multiple RoBERTa pre-trained models that have completed training to obtain a fused RoBERTa model, and using it as the log data structured model, includes:
[0098] Based on the set attention calculation function, the attention values between the multiple RoBERTa pre-trained models are calculated according to the training parameters used when training different RoBERTa pre-trained models;
[0099] According to the attention value, calculating the attention weight parameters of each of the RoBERTa pre-trained models;
[0100] According to the attention weight parameters of the multiple RoBERTa pre-trained models, the multiple RoBERTa pre-trained models that have completed training are fused to obtain a fused RoBERTa model, and the fused RoBERTa model is used as the log data structured model.
[0101] Optionally, according to the formula Based on the set attention calculation function, the attention values between the multiple RoBERTa pre-training models are calculated according to the training parameters used when training different RoBERTa pre-training models, wherein: Indicates i and j The attention value between the RoBERTa pre-trained models, Indicates i and j The embedded data output by the RoBERTa pre-trained model, Indicates i RoBERTa pre-trained models About k The values of the training parameters, Indicates j RoBERTa pre-training Training Model About l The values of the training parameters, represents the training parameter combination, Function is used to map training parameters to and The space where Used to calculate the training parameters after mapping , and and The distance between α and β is a weight coefficient used to balance the importance of distance.
[0102] Optionally, based on the formula According to the attention value, the attention weight parameters of each of the RoBERTa pre-trained models are calculated, represents the attention weight parameter of the i-th RoBERTa pre-trained model, M represents the total number of RoBERTa pre-trained models, is a global scaling factor used to adjust the effect of the attention value on the attention weight parameter, and Represents an additional parameter used to adjust the effect of the attention value on the sum of the attention weight parameters.
[0103] Optionally, based on the formula According to the attention weight parameters of the multiple RoBERTa pre-trained models, the multiple RoBERTa pre-trained models that have completed training are fused to obtain a fused RoBERTa model, and the fused RoBERTa model is used as the log data structured model. δ represents a fusion smoothing factor, which is used to adjust the influence of the attention weight value on the fusion result. Represents the fused RoBERTa model.
[0104] To this end, the above-mentioned specific algorithm has the following technical advantages:
[0105] 1. Refined Attention Value Calculation
[0106] By combining cosine similarity and a complex function of model-specific training parameters to calculate the attention values between multiple RoBERTa pre-trained models, we are able to capture the correlation and differences between models more finely. Cosine similarity measures the angular distance between model output feature vectors, while the consideration of model-specific training parameters further reflects the different configurations and preferences of the models during training. This refined calculation method helps us understand the relationship between models more accurately and provides a reliable basis for the subsequent calculation of attention weight parameters.
[0107] 2. Flexible attention weight parameter adjustment
[0108] Using the extended softmax form to calculate the attention weight parameters of each RoBERTa pre-trained model, we introduced a global scaling factor β and a specific importance factor γ. The introduction of these two factors allows us to flexibly adjust the relative importance between models. The global scaling factor β can control the degree of influence of the attention value on the weight, while the specific importance factor γ allows us to make additional weight adjustments to a model based on actual needs. This flexibility makes the model fusion process more controllable and customizable, which helps to meet the needs of different application scenarios.
[0109] 3. Robust model fusion processing
[0110] In the model fusion processing stage, we used the calculated attention weight parameters to perform weighted fusion on the outputs of multiple RoBERTa models and introduced a fusion smoothing factor δ. The introduction of the fusion smoothing factor δ helps to adjust the influence of the weight on the fusion result, making the fusion process more robust and reliable. By setting the value of δ reasonably, we can balance the contribution of different models to the fusion result and avoid the deviation of the fusion result caused by extreme weights. This robust model fusion processing helps to improve the accuracy and robustness of the final fusion result.
[0111] 4. Improve overall performance and generalization ability
[0112] In summary, through refined attention value calculation, flexible attention weight parameter adjustment and robust model fusion processing, we can fully utilize the advantages of multiple RoBERTa pre-trained models to improve overall performance and generalization ability. This multi-model fusion method helps to combine the characteristics and advantages of different models and make up for the shortcomings and limitations of a single model. At the same time, through reasonable parameter adjustment and optimization, we can further explore the potential of the model and improve the performance of the model in practical applications.
[0113] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above invention concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other to form a technical solution.
Claims
1. A method for structuring a log, characterized in that: include: Access a medical consumables management log data source to obtain medical consumables management log data to form a training set; The training set is divided according to the entries to form a plurality of log entries; Generate a regular expression based on the constructed medical consumables knowledge graph to perform word segmentation processing on the log entry to extract the name identification field, model identification field, brand identification field, and specification identification field of the medical consumables; Preprocessing the name identification field, model identification field, brand identification field, and specification identification field of the medical consumables to obtain input data for the RoBERTa pre-training model; Training the RoBERTa pre-trained model based on the input data until the training of the RoBERTa pre-trained model is completed, and using the trained RoBERTa pre-trained model as a log data structured model; Obtain the management log data of pending medical consumables; Based on the log data structured model, predicting the embedded form representation of the to-be-processed medical consumables management log data to obtain corresponding embedded codes; The training set is divided into items to form a number of log items, including: Based on the configured log parsing library, the training set is parsed to determine blank lines and / or line separators therein; Building a log entry separator based on the blank line and / or line separator; Determining log entry boundaries based on a log entry separator; Based on the log entry boundary, the training set is divided into entries to form a plurality of log entries; The method further comprises: Analyzing semantic dependencies between the plurality of log entries to construct heterogeneous nodes and heterogeneous edges; Defining a meta-path based on the heterogeneous nodes and the heterogeneous edges, and walking the meta-path to generate heterogeneous neighbors; Converting the heterogeneous neighbors into entity relationship annotations and adding them to log entries with dependencies; Wherein, generating a regular expression based on the constructed medical consumables knowledge graph includes: Traversing the medical consumables knowledge graph to parse out medical consumables entities, and predicting the parsed medical consumables entities to obtain variants of the medical consumables entities, wherein the variants of the medical consumables entities include abbreviations and spelling errors; Determine the mode information of the medical consumables entity according to the medical consumables entity and the corresponding variant, wherein the mode information includes a prefix, a suffix, and a separator; Analyzing a sequence log key of the medical consumable based on the mode information of the medical consumable entity; Based on the created online regular expression generator, the structure of the log entry is predicted and identified according to the serial log key of the medical consumables, and a regular expression is generated accordingly.
2. A method for structuring a log according to claim 1, characterized in that: The preprocessing of the name identification field, the model identification field, the brand identification field, and the specification identification field of the medical consumables to obtain input data of the RoBERTa pre-training model includes: Formatting the name identification field, model identification field, brand identification field, and specification identification field of the medical consumables to generate a feature description of the medical consumables; The medical consumables feature description is encoded to obtain token IDs to serve as input data for the RoBERTa pre-training model.
3. A method for structuring a log according to claim 2, characterized in that: The step of training the RoBERTa pre-trained model based on the input data until the training of the RoBERTa pre-trained model is completed includes: Obtaining a training strategy for the RoBERTa pre-trained model, and customizing a training parameter combination based on the training strategy; Based on the training parameter combination, determining the training direction of the RoBERTa pre-training model; The RoBERTa pre-trained model is trained based on the input data along the training direction.
4. A method for structuring a log according to claim 3, characterized in that: The number of the RoBERTa pre-trained models is multiple, one training parameter mapping has one training direction, and the training of the RoBERTa pre-trained model based on the input data along the training direction includes: Along a training direction, training a RoBERTa pre-trained model based on the input data until a plurality of RoBERTa pre-trained models having completed training and equal in number to the training direction are obtained; The multiple RoBERTa pre-trained models that have completed training are fused to obtain a fused RoBERTa model, and the fused RoBERTa model is used as the log data structured model.
5. A method for structuring logs according to claim 4, characterized in that: The step of fusing the multiple RoBERTa pre-trained models that have completed training to obtain a fused RoBERTa model and using the fused RoBERTa model as the log data structured model includes: Based on the set attention calculation function, the attention values between the multiple RoBERTa pre-trained models are calculated according to the training parameters used when training different RoBERTa pre-trained models; According to the attention value, calculating the attention weight parameters of each of the RoBERTa pre-trained models; According to the attention weight parameters of the multiple RoBERTa pre-trained models, the multiple RoBERTa pre-trained models that have completed training are fused to obtain a fused RoBERTa model, and the fused RoBERTa model is used as the log data structured model.
6. A method for structuring logs according to claim 5, characterized in that: According to the formula Based on the set attention calculation function, the attention values between the multiple RoBERTa pre-training models are calculated according to the training parameters used when training different RoBERTa pre-training models, wherein: Indicates i and j The attention value between the RoBERTa pre-trained models, Indicates i and j The embedded data output by the RoBERTa pre-trained model, Indicates i RoBERTa pre-trained models About k The values of the training parameters, Indicates j RoBERTa pre-training Training Model About l The values of the training parameters, Function is used to map training parameters to and The space where Used to calculate the training parameters after mapping , and and The distance between α and β is a weight coefficient used to balance the importance of distance.
7. A method for structuring logs according to claim 6, characterized in that: Based on the formula According to the attention value, the attention weight parameters of each of the RoBERTa pre-trained models are calculated, represents the attention weight parameter of the i-th RoBERTa pre-trained model, M represents the total number of the RoBERTa pre-trained models, is a global scaling factor used to adjust the effect of the attention value on the attention weight parameter, and Represents an additional parameter used to adjust the effect of the attention value on the sum of the attention weight parameters.
