A chemical formula recognition method based on group learning
By constructing a chemical formula identification model based on group learning, and using multi-layer convolutional neural networks and bidirectional long short-term memory networks for feature fusion, the problems of insufficient data and security in chemical formula research are solved, and accurate identification and safety protection of chemical formulas are achieved.
Patent Information
- Application Number
- CN202311005652.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-10
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2043-08-10
AI Technical Summary
Chemical formulation research is limited by insufficient local data and restricted data exchange, making it difficult to utilize data resources from other places. Furthermore, data transmission and security issues are prominent, resulting in insufficient accuracy and safety in chemical formulation identification.
An improved text classification model is built on Swarm nodes using a group learning-based approach and chemical formula data from distributed chemical enterprises. Feature fusion is performed using multi-layer convolutional neural networks, bidirectional long short-term memory networks, and self-attention mechanisms. Model parameters are exchanged through the Swarm application programming interface to achieve accurate identification and safety protection of chemical formulas.
It achieves accurate identification of chemical formulas and a high level of data security, avoids the exchange of raw data, protects the security of machine learning models, and improves classification accuracy.
Smart Images

Figure CN117113220B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of text classification, and in particular to a chemical formula recognition method based on group learning. BACKGROUND
[0002] Formula research is extremely important in the chemical industry, especially for the development of fine chemical products. Western industrialized countries attach great importance to this. In a chemical company, the number of staff engaged in formula research is sometimes greater than that of staff engaged in synthesis process research. This is a result of the emphasis on application development. The reason is that there is rarely a single chemical that can fully meet a specific end use. For example, aspirin must be compounded into compound aspirin tablets; detergents are compounded from a variety of different structured surfactants and chemical products; the use of dyes must add various additives. A formula in the chemical industry is composed of two parts: base (main material) and auxiliary material (fine material). The base part mainly refers to the amount used; the fine material part mainly refers to the amount used, and the composition and ratio of the material collection directly affect the product quality and performance. Moreover, as the technical core of chemical enterprises, formula is usually required to be kept secret, especially the fine material part of the formula has a higher level of secrecy.
[0003] With increasing concerns about data privacy and security, AI-based chemical formula recognition methods essentially rely on large training data sets. Since chemical enterprises are decentralized, the amount of local data is often insufficient to train a reliable classification system. Moreover, the exchange of chemical formula research data between different centers or even countries is often subject to data protection, privacy protection and data sovereignty regulations. Technical problems also affect data usage, such as when large amounts of data need to be transmitted digitally, the data transmission line quickly reaches its performance limit. In view of these circumstances, many formula research is limited to the local area, and it is difficult to use data available elsewhere. SUMMARY
[0004] The present application provides a chemical formula recognition method based on group learning, which can accurately identify the chemical formula, effectively solve the problem of formula data saved in the local data owner, without exchanging original data, and can also provide high-level data security, allow parameter merging, and all members have equal rights; can protect the machine learning model from attacks.
[0005] Technical solution: The present application provides a chemical formula recognition method based on group learning, comprising the following steps:
[0006] Step 1: Collect and save N different chemical formula data of chemical enterprises, and make data sets for the chemical formula data;
[0007] Step 2: Preprocess the chemical formula data sets of N different chemical companies to obtain N training data sets, and obtain the chemical formula data of another chemical company, and obtain a global test data set after preprocessing;
[0008] Step 3: Distribute the training data sets of N different chemical companies on the Swarm nodes of N different group learning frameworks, and respectively construct the improved text classification model on the chemical formula data sets of the N nodes; the improved text classification model is divided into two branches, the first branch includes a multi-layer convolutional neural network, and the second branch includes a bidirectional long short-term memory network and a self-attention mechanism;
[0009] Step 4: Update the chemical formula recognition model parameters between the N nodes, exchange through the Swarm application programming interface API, and before starting a new round of training, merge to create an updated model of parameter update, until the defined synchronization condition is met, stop training to obtain an updated model;
[0010] Step 5: Input the global test data set to be identified, and classify and identify the chemical formula through the updated model obtained by group learning training.
[0011] Further, the data preprocessing in step 2 includes deduplication and empty processing.
[0012] Further, in step 3, the improved text classification model fuses the local data features extracted from the first branch with the global data features extracted from the second branch through the ADD() function of the Keras framework of the fusion layer; the obtained data features are respectively input into the maximum pooling layer and the average pooling layer;
[0013] The maximum pooling layer and the average pooling layer are fused through the ADD() function of the Keras framework of the fusion layer to obtain data features;
[0014] The data features are input into the full connection layer, and the Softmax classifier is trained; the data features are input into the Softmax for training, and the construction of the improved text classification model is completed.
[0015] Further, in step 4, the chemical formula recognition model parameters between the N nodes are updated, exchanged through the Swarm application programming interface API, and before starting a new round of training, merge to create an updated model of parameter update, and the specific steps are as follows:
[0016] N nodes share their learned parameters and merge their parameters; the merging period is defined by the synchronization interval, which specifies the number of training batches after which the SL nodes merge their learned parameters, at the end of each interval, one of the swarm learning SL nodes is elected as a leader, the leader collects model parameters from other swarm learning SL nodes and merges them into the leader model by averaging the learned parameters; after that, the leader SL node receives the updated model and starts the next interval; until the training is stopped at the end of epochs, the final updated model is obtained.
[0017] Further, the number of chemical enterprises is 2, the swarm learning framework of the Swarm node is provided with 2, two swarm network SN nodes are used, the names of the docker containers representing the two nodes are SN1 and SN2; SN1 is a sentinel node, SN1 runs on the host 192.168.121.129, and SN2 runs on the host 192.168.121.130; the swarm learning SL node and the machine learning ML node are automatically generated by the swarm operator SWOP node during training and are deleted after training; two SWOP nodes are used to connect to each SN node; the names of the docker containers representing the two SWOP nodes are SWOP1 and SWOP2; SWOP1 runs on the host 192.168.121.129, and SWOP2 runs on the host 192.168.121.130; the training is started by the SWCI node running on the host 192.168.121.129, after initialization, the SL1 node shares its learned parameters with the SL2 node regularly and merges their parameters. Advantages
[0018] 1、The platform of the present application adopts swarm learning, which can save the chemical formula data in the local data owner, without the need to exchange the original data, and can provide high level of data security, allow parameter merging, equal rights of all members, and can protect the machine learning model from attack.
[0019] 2、The present application is based on the existing TextCNN algorithm, combines BiLSTM algorithm, Self-Attention mechanism and TextCNN algorithm to extract chemical formula text features. The features extracted by the two algorithms are fused through the Add() function of the Keras framework, so that the fused features have both local features and global features. The features output in the last step are subjected to maximum pooling and average pooling through the Add() function of the Keras framework, further improving the training speed. The classification output is carried out through the Softmax classifier, improving the classification accuracy of the chemical formula, fully considering the characteristics of the chemical formula, making the feature processing more optimized and the classification more accurate. BRIEF DESCRIPTION OF DRAWINGS
[0020] Figure 1 A flowchart of a chemical formula recognition method based on swarm learning;
[0021] Figure 2 A network model of swarm learning;
[0022] Figure 3 An improved text classification model;
[0023] Figure 4 A model for updating model parameters. Embodiments
[0024] The present application will be further described below with reference to the accompanying drawings. The following examples are only used to more clearly illustrate the technical solutions of the present application, and cannot be used to limit the protection scope of the present application.
[0025] The present application proposes a chemical formula recognition method based on swarm learning, as shown in Figure 1 The present embodiment takes the chemical data of two enterprises as an example for illustration, and specifically includes the following steps:
[0026] Step 1: Collect and save the chemical formula data of two different chemical enterprises, and make data sets for their chemical formula data. The chemical formula is divided into five categories: adhesive, cosmetic, medicine, rubber and pesticide.
[0027] Step 2: Divide the two sets of chemical formula data sets into a plurality of non-repeating training data, and obtain the chemical formula data of another chemical enterprise as a global test data set, and perform de-duplication and empty processing on the data to obtain a pre-processed data set.
[0028] Step 3: Construct a swarm learning network model, as shown in Figure 2 The training data set in step 2 is distributed on two different Swarm nodes, and a model is constructed on the private data of the two nodes (Node). Swarm learning provides security measures to support data sovereignty, security and confidentiality (which is realized by private permissioned blockchain technology). Each participant has a clear definition, and only pre-authorized participants can perform transactions.
[0029] An improved text classification model, as shown in Figure 3 is divided into two branches. The first branch includes a multi-layer convolutional neural network, and the second branch includes a bidirectional long short-term memory network and a self-attention mechanism. The local data features extracted from the first branch and the global data features extracted from the second branch are fused through the ADD() function of the Keras framework of the fusion layer; the obtained data features are respectively sent to the maximum pooling layer and the average pooling layer to improve the training speed.
[0030] The maximum pooling layer and the average pooling layer are fused by the ADD() function of the fusion layer Keras framework to obtain data features.
[0031] The data features are input into the full connection layer, and the Softmax classifier is trained. The data features are input into the Softmax for training, and the construction of the improved text classification model is completed.
[0032] In step 3, the Adam optimizer is used, the loss function is the cross-entropy loss function, the training batch is 30 times, the initial learning rate is set to 0.00001, and the batch size is set to 32.
[0033] The formula of the cross-entropy loss function is:
[0034]
[0035] Wherein, the greater the prediction result p(x) of x, the smaller the cross-entropy f(x).
[0036] Step 4: model parameter update, as shown in Figure 4 The two nodes update the chemical formula recognition model parameters between them through the Swarm application programming interface (API). Two swarm network (SN) nodes are used, and the names of the docker containers representing the two nodes are SN1 and SN2. SN1 is a sentinel node. SN1 runs on the host 192.168.121.129. SN2 runs on the host 192.168.121.130. Swarm learning (SL) and machine learning (ML) nodes are automatically generated by swarm operator (SWOP) nodes during training and are deleted after training. Two SWOP nodes are used to connect to each SN node. The names of the docker containers representing the two SWOP nodes are SWOP1 and SWOP2. SWOP1 runs on the host 192.168.121.129. SWOP2 runs on the host 192.168.121.130. Training is started by the SWCI node (swci1) running on the host 192.168.121.129. After initialization, the SL1 node shares its learned parameters with the SL2 node periodically and merges their parameters. This merging period is defined by the synchronization interval (SI), which specifies the number of training batches after which an SL node merges its learned parameters. At the end of each interval, one of the SL nodes is selected as the leader. The leader collects model parameters from the other SL node and merges them into the leader model by averaging their learned parameters. After that, the leader SL node receives the updated model and starts the next interval. Until the training ends at epochs, the training is stopped to obtain the final updated model.
[0037] Step 5: for the global test data set to be identified, the updated model trained by group learning is used to classify and identify the chemical formula.
[0038] The performance index evaluation of the present application adopts an accuracy (Accuracy) evaluation index formula as follows:
[0039]
[0040] This index is mainly used to indicate the number of correctly predicted samples in the total number of samples.
[0041] The above embodiments are only for illustrating the technical concept and characteristics of the present application, and the purpose is to enable those skilled in the art to understand the content of the present application and implement it, and cannot limit the protection scope of the present application. Any equivalent transformation or modification made in accordance with the spirit and essence of the present application shall be covered within the protection scope of the present application.
Claims
1. A chemical formula recognition method based on group learning, characterized in that, The method comprises the following steps: Step 1: collect and save N different chemical formula data of chemical enterprises, and make data sets for the chemical formula data; Step 2: pre-process the N different chemical formula data sets of the chemical enterprises to obtain N training data sets, and obtain the chemical formula data of another chemical enterprise, and obtain a global test data set after pre-processing; Step 3: distribute the training data sets of the N different chemical enterprises on the Swarm nodes of the N different swarm learning frameworks, and respectively construct an improved text classification model on the chemical formula data sets of the N nodes; the improved text classification model is divided into two branches, the first branch includes a multi-layer convolutional neural network, and the second branch includes a bidirectional long short-term memory network and a self-attention mechanism; The improved text classification model fuses the local data features extracted by the first branch and the global data features extracted by the second branch through the ADD() function of the Keras framework of the fusion layer; the obtained data features are respectively sent to the maximum pooling layer and the average pooling layer; the maximum pooling layer and the average pooling layer are fused through the ADD() function of the Keras framework of the fusion layer to obtain data features; the data features are input into the full connection layer, and the Softmax classifier is trained; the data features are input into the Softmax for training, and the construction of the improved text classification model is completed; Step 4: update the chemical formula recognition model parameters between the N nodes, exchange through the Swarm application programming interface API, and before starting a new round of training, merge to create an updated model of parameter update, until the defined synchronization condition is met, stop training to obtain an updated model; The N nodes share the learned parameters and merge their parameters; the merging period is defined by the synchronization interval, which specifies the number of training batches after the SL node merges its learning parameters, at the end of each interval, one of the swarm learning SL nodes is selected as the leader, the leader collects model parameters from other swarm learning SL nodes, and merges them into the leader model by averaging the learned parameters; then, the leader SL node receives the updated model and starts the next interval; until the training ends at epochs, stop training to obtain the final updated model; Step 5: input the global test data set to be identified, and classify and identify the chemical formula through the updated model trained by the swarm learning.
2. The group learning-based chemical formula identification method according to claim 1, wherein, The data preprocessing in step 2 includes deduplication and empty processing.
3. The group learning based chemical formula identification method of claim 1, wherein, The number of chemical enterprises is 2, the Swarm nodes of the swarm learning framework are provided with 2, two swarm network SN nodes are used, the names of the docker containers representing the two nodes are SN1 and SN2; SN1 is a sentinel node, SN1 runs on the host 192.168.121.129, and SN2 runs on the host 192.168.121.130; the swarm learning SL node and the machine learning ML node are automatically generated by the swarm operator SWOP node during training, and are deleted after training; Two SWOP nodes are connected to each SN node; the names of the docker containers representing these two SWOP nodes are SWOP1 and SWOP2; SWOP1 runs on host 192.168.121.129 and SWOP2 runs on host 192.168.121.130; the training is initiated by the SWCI node running on host 192.168.121.129, after initialization, the SL1 node shares its learned parameters with the SL2 node periodically and merges their parameters.