SQL classification method, model training method and system based on normalized Born network

Through the SQL classification method based on the normalized Bohn network, the feature vector of SQL statements is constructed and the regularized Bohn network model is trained, which solves the problem of insufficient SQL injection detection accuracy and efficiency in the existing technology, and achieves more efficient automated detection.

CN119652576AInactive Publication Date: 2025-03-18SHAANXI NORMAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411728276.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-03-18
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When detecting SQL injection, the accuracy and efficiency still have room for improvement, and rely on manual analysis, which is limited by the skills and knowledge of security engineers.

Method used

Using the SQL classification method based on the normalized Bohn network, by obtaining the feature vectors of the SQL statements and mapping them to the non-negative region, the wave functions of superposition and quantum states are constructed, the optimal hyperparameters are determined based on the conversion probability, and the regularized Bohn network model is trained to realize the classification of SQL statements.

Benefits of technology

It significantly improves the accuracy and efficiency of SQL injection detection, reduces dependence on manual analysis, and improves the level of detection automation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119652576A_ABST
    Figure CN119652576A_ABST
Patent Text Reader

Abstract

The invention discloses an SQL classification method and system based on a standardized Born network and a model training method and system, and belongs to the technical field of network security. The method comprises the steps that feature vectors of SQL statements and corresponding real tags are obtained, and the feature vectors are mapped to a non-negative region and normalized; the feature vectors of the SQL statements serve as input of a regularization Born network model, labels of the SQL statements serve as classification results of the regularization Born network model, the regularization Born network model is trained, the trained regularization Born network model calculates the collapse probability of conversion from a wave function of a superposition state of the feature vectors to a quantum state, and the collapse probability of conversion from the wave function to the quantum state is calculated. Classifying the SQL statements according to the collapse probability; according to the method, the Born theory is used for researching SQL injection, and the detection accuracy and the detection efficiency of the SQL are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network security, and in particular to a SQL classification method, a model training method and a system based on a normalized Born network. Background Art

[0002] As more and more people pay attention to the security of personal information data, network security has also received more and more social attention. In recent years, SQL injection, as a means of network attack, has become one of the most important security risks on the Web. Every year, user data leakage caused by SQL injection has caused serious losses and impacts to enterprises and individuals. According to the latest official statistics from OWASP, SQL injection ranks third among the top ten web application security risks.

[0003] Traditional SQL injection detection methods include static analysis and dynamic analysis. Static analysis does not require program code execution. It analyzes the security vulnerabilities of the source code, extracts the construction path of the execution parameters, and forms detection rules. Dynamic analysis tests the security issues in the code through debugging, fuzzing, etc. when the Web program is running normally, and forms detection rules. However, traditional methods require manual analysis and rely heavily on the skills and vulnerability knowledge of security engineers.

[0004] With the continuous development of machine learning theoretical knowledge, more and more machine learning artificial intelligence algorithms have been applied to the study of SQL injection and have achieved certain results, but the accuracy and efficiency of detection still need to be improved. Summary of the invention

[0005] In view of the problems existing in the prior art, the present invention provides a SQL classification method, a model training method and a system based on a normalized Born network, which significantly improve the detection accuracy and efficiency of SQL injection.

[0006] The present invention is achieved through the following technical solutions: In the first aspect, the present application proposes a SQL classification model training method based on a normalized Born network, comprising: Get the feature vector of the SQL statement and the corresponding true label, map the feature vector to the non-negative area and normalize it; The feature vector of the SQL statement is used as the input of the regularized Born network model, and the label of the SQL statement is used as the classification result of the regularized Born network model. The regularized Born network model is trained. During training: Construct the wave function of the superposition state of the SQL statement feature vector and the wave function of the quantum state of the real label of the SQL statement; According to the transition probability between the wave function of the superposition state and the wave function of the quantum state, the optimal hyperparameters of the regularized Born network model are determined. The optimal hyperparameters include the joint probability and conditional probability , get the trained regularized Born network model; The trained regularized Born network model calculates the collapse probability of the wave function of the superposition state of the feature vector to the quantum state, and classifies the SQL statements according to the collapse probability.

[0007] Preferably, the method for obtaining the feature vector of the SQL statement is as follows: Preprocess the SQL statement to obtain the structural features of the SQL statement, and extract the feature vector of the SQL statement based on the structural features of the SQL statement.

[0008] Preferably, the preprocessing of the SQL statement includes: The SQL statements are cleaned, deduplicated, case-converted, and special characters processed to obtain the structural features of the SQL statements.

[0009] Preferably, the wave function of the superposition state of the SQL statement feature vector is as follows:

[0010] The wave function of the quantum state of the real label of the SQL statement is as follows:

[0011] in, Represents the superposition state of the eigenvectors Transformed into a classifier wave function The conversion probability.

[0012] Preferably, the determination of the conversion probability between the wave function of the superposition state and the wave function of the quantum state includes: According to Born's rule, the probability that the wave function of the superposition state of the SQL statement feature vector collapses to the quantum state of the true label is as follows:

[0013] Preferably, the joint probability and conditional probability The expression is as follows:

[0014] In the second aspect, the present application proposes a SQL classification model training system based on a normalized Born network, comprising: The acquisition module is used to obtain the feature vector of the SQL statement and the corresponding true label, map the feature vector to the non-negative area and normalize it; The training module is used to train the regularized Born network model using the feature vector of the SQL statement as the input of the regularized Born network model and the label of the SQL statement as the classification result of the regularized Born network model. During training: Construct the wave function of the superposition state of the SQL statement feature vector and the wave function of the quantum state of the real label of the SQL statement; According to the transition probability between the wave function of the superposition state and the wave function of the quantum state, the optimal hyperparameters of the regularized Born network model are determined. The optimal hyperparameters include the joint probability and conditional probability , get the trained regularized Born network model; The trained regularized Born network model calculates the collapse probability of the wave function of the superposition state of the feature vector to the quantum state, and classifies the SQL statements according to the collapse probability.

[0015] In a third aspect, the present application proposes a SQL classification method based on a normalized Born network, comprising: Get the feature vector of the SQL statement; The feature vector of the obtained SQL statement is input into the trained SQL classification model based on the normalized Born network to obtain the collapse probability of the SQL statement, and the collapse probability is normalized to obtain the classification result of the SQL statement.

[0016] In a fourth aspect, the present application proposes a SQL classification system based on a normalized Born network, comprising: A feature extraction module is used to obtain feature vectors of SQL statements to be classified; The classification module is used to input the structural features of the SQL statement into the trained regularized Born network model to obtain the collapse probability of the SQL statement, normalize the collapse probability, and obtain the classification result of the SQL statement.

[0017] In a fifth aspect, the present application proposes an electronic device, comprising: Memory for storing computer programs; A processor is used to implement the steps of the SQL classification method based on the normalized Born network when executing the computer program.

[0018] Compared with the prior art, the present invention has the following beneficial technical effects: The application provides a method for training a SQL classification model based on a normalized Born network. First, the feature vector of the SQL statement is mapped to a non-negative area and normalized. In the training process of the classification model, the SQL statement is regarded as a superposition state, and its feature value corresponds to a wave function. The label of the statement is regarded as another superposition state, and its feature value corresponds to another wave function. When the previous wave function collapses to the latter wave function, it follows the Born rule, which describes the transition relationship between the two superposition states. Therefore, according to the collapse probability of the wave function of the superposition state and the wave function of the quantum state, the hyperparameters of the regularized Born network model are updated according to the collapse probability, and the training of the regularized Born network model is completed. The application improves the Born network to realize the study of SQL injection classification algorithm. Compared with the detection methods of machine learning such as SVM, KNN, and MLP, this model improves the detection accuracy and efficiency.

[0019] Furthermore, by preprocessing the SQL statements, the enlargement of the word vector caused by differences in user input and database field names is ignored, and only the structural features and key features of the SQL statements are retained, which reduces the scale of the word vector and further improves the detection efficiency.

[0020] The present application also proposes a SQL classification model training system based on a normalized Born network, a SQL classification method based on a normalized Born network, an electronic device and a computer storage medium, which have all the advantages of the above-mentioned SQL classification model training method based on a normalized Born network. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0022] Figure 1 It is a flow chart of the SQL injection detection method based on the normalized Born network of the present invention; Figure 2 This is the normalized Born network structure diagram of the present invention. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution 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 part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0024] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0025] The Born Classifier (BC) is a supervised classifier based on the key assumptions of quantum mechanics. It regards the text as a quantum system, and each word can be regarded as a quantum state.

[0026] Wave function is a function that describes the state of a microscopic system in quantum mechanics. In quantum mechanics, wave function is introduced to quantitatively describe the state of microscopic particles. Generally speaking, wave function is a function of space and time, and the square of its modulus represents the probability density of the particle appearing at that location, which has normalization, that is, the integral over the entire space.

[0027] The SQL statement is regarded as a superposition state, whose eigenvalue corresponds to a wave function, and the label of the statement is regarded as another superposition state, whose eigenvalue corresponds to another wave function. When the previous wave function collapses into the latter wave function, it follows the Born rule, which describes the transition relationship between the two superposition states. Based on the Born network, this method improves it and proposes a standardized Born network to realize SQL statement classification.

[0028] See also Figure 1 , a training method for a SQL classification model based on a normalized Born network, comprising the following steps: Step 1: Preprocess the SQL statement to obtain the structural features of the SQL statement, and extract the feature vector of the SQL statement based on the structural features of the SQL statement.

[0029] All SQL statements are cleaned, deduplicated, case-converted, and special character processed to reduce the expansion of word vectors caused by differences in user input and database field names, reduce the computational complexity of word vectors, and further improve detection efficiency.

[0030] In this embodiment, the word_tokenize method of Python's nltk module is used to segment all SQL statements, and the List data formed after the SQL statement segmentation is matched with the reserved words and special symbols in the SQL keywords. The numbers and strings that are not reserved words and do not contain special symbols are replaced, and only the structural features of the SQL statements are retained, so as to better obtain the structural features of the SQL injection statements and further improve the detection accuracy.

[0031] Step 2: Map the feature vector to the non-negative region and perform normalization to obtain a normalized feature vector.

[0032] Methods for extracting feature vectors include word2vec, fastText, glove, etc.

[0033] Overview: Word2Vec is a word embedding method based on neural networks. It can map words from the vocabulary into a continuous vector space, so that semantically similar words are close to each other in the vector space. There are two main models of Word2Vec: CBOW (Continuous Bag of Words) and Skip-gram. The CBOW model predicts the probability of occurrence of the current word based on the context, while the Skip-gram model predicts the words in the context based on the current word.

[0034] In this embodiment, the word vector is generated by calling Python's gensim library using the word2vec method. Using the CBOW model, the CBOW model can predict the word itself based on the words around the input, while the skip-gram model can predict the surrounding words based on the word itself. The generated word vector is not normalized data, there are many negative values, and the detection input of the Born network needs to use non-negative normalized word vector data, so the word vector data needs to be linearly mapped to the non-negative area and then normalized.

[0035] Step 3: Take the feature vector of the SQL statement as the input of the regularized Born network model, and the label of the SQL statement as the prediction result of the regularized Born network model to train the regularized Born network model. During training: Construct the wave function of the superposition state of the SQL statement feature vector, and establish the wave function of the quantum state according to the real label of the SQL statement.

[0036] According to the transition probability between the wave function of the superposition state and the wave function of the quantum state, the optimal hyperparameters of the regularized Born network model are determined. The optimal hyperparameters include the joint probability and conditional probability , and obtain the trained regularized Born network model.

[0037] Step 4: Classify and detect SQL statements based on the trained regularized Born network model.

[0038] During the detection process, the trained regularized Born network model constructs the wave function of the superposition state according to the feature vector of the SQL statement, calculates the collapse probability of the superposition state wave function vector quantum state conversion according to the wave function of the classifier, and classifies the quantum state of the SQL statement according to the collapse probability to obtain the classification result of the SQL statement.

[0039] As the best embodiment of the present application, the training method of the regularized Born network model in step 3 is as follows: S3.1. Construct a training data set for the regularized Born network model, which includes feature vectors of SQL statements and corresponding true labels, and input the feature vectors and true labels of the SQL statements into the regularized Born network model.

[0040] S3.2. Construct the wave function of the superposition state according to the SQL statement feature vector.

[0041] The SQL statement is regarded as a superposition state, whose eigenvector corresponds to a wave function, and the true label of the statement is regarded as a quantum state, whose eigenvalue corresponds to another wave function; when the wave function of the superposition state collapses to the wave function of the quantum state, it follows the Born rule, which describes the transition relationship between the two superposition states.

[0042] The feature vector of a given SQL statement Contains only non-negative values, feature vector The quantum state of Indicates that the superposition state combination of the eigenvectors can be used to represent the SQL statement itself, and the wave function of the superposition state of the SQL statement eigenvectors can be expressed as:

[0043] S3.3. Establish the wave function of the quantum state according to the real label of the SQL statement.

[0044] Since the superposition state corresponding to the SQL statement feature vector is not fixed, but is described probabilistically by the wave function, the wave function of the quantum state is established according to the label of the SQL statement, that is, the wave function of the k-class classifier, and the mathematical formula is as follows:

[0045] in, Represents the superposition state of the eigenvectors Transformed into a classifier wave function The conversion probability.

[0046] S3.4. Determine the collapse probability of the wave function of the superposition state and the wave function of the quantum state, and update the hyperparameters of the regularized Born network model according to the collapse probability until the optimal hyperparameters are obtained, thereby completing the training of the regularized Born network model.

[0047] According to Born's rule, the probability that the wave function of the superposition state of the SQL statement feature vector collapses to the true label (quantum state) in a specific context can be expressed in mathematical language as follows:

[0048] Among them, the coefficient Described by the eigenvector, the probability that the quantum state belongs to class k is obtained by calculating the collapse of the wave function. The probability of the quantum state belonging to class k is normalized to obtain the classification probability: The optimal hyperparameters include the joint probability and conditional probability , the expression is as follows:

[0049] Among them, the intermediate variable In order to ensure that the sum of the k-class probabilities is 1, The values ​​of are normalized, and the labels Taking values ​​between 0 and 1, we get:

[0050] As the optimal embodiment of the present application, the regularized Born network model includes a batch regularization layer, a superposition state wave function layer, a quantum state wave function layer and a normalization layer.

[0051] A batch normalization layer is added before the Born network, and the Born network is connected in series to increase the network depth. The batch normalization layer performs batch normalization on the input feature vector. Since the input feature vector may contain negative values, the feature vector is normalized to between 0 and 1 after batch normalization, making the network suitable for SQL statement injection classification detection tasks and having more stable performance.

[0052] As the best embodiment of the present application, the detection method of the regularized Born network model is as follows: S4.1. Input the feature vector of the SQL statement to be detected into the trained regularized Born network model. The feature vector only contains non-negative values. feature vector The quantum state of Indicates that the superposition state combination of the feature vector can be used to represent the SQL statement itself, then the wave function of the superposition state of the SQL statement feature vector can be expressed as:

[0053] S4.2. Determine the probability that the feature vector (k-class superposition state) of the SQL statement collapses to the true label (quantum state) in a specific context, which can be expressed in mathematical language as follows:

[0054] S4.3. Normalize the collapse probability to obtain the classification probability of the SQL statement.

[0055] By calculating the probability that the quantum state belongs to category k after the wave function collapse, and normalizing the probability that the quantum state belongs to category k, we can get the classification probability:

[0056] In the detection phase, for the feature vector of the newly received SQL statement, according to Born's rule, we can achieve classification by calculating the classification probability of the collapsed target, and the classification label corresponds to the maximum classification probability.

[0057] Based on the above training method of the SQL classification model based on the normalized Born network, the present application also proposes a training system of the SQL classification model based on the normalized Born network, comprising: The acquisition module is used to pre-process the SQL statement to obtain the structural features of the SQL statement, and extract the feature vector of the SQL statement according to the structural features of the SQL statement; The regularization module is used to map the feature vector to the non-negative region and perform normalization processing to obtain the normalized feature vector.

[0058] The training module is used to train the regularized Born network model using the feature vector of the SQL statement as the input of the regularized Born network model and the label of the SQL statement as the prediction result of the regularized Born network model. During training: Construct the wave function of the superposition state of the SQL statement feature vector, and establish the wave function of the quantum state according to the real label of the SQL statement; According to the transition probability between the wave function of the superposition state and the wave function of the quantum state, the optimal hyperparameters of the regularized Born network model are determined. The optimal hyperparameters include the joint probability and conditional probability , and obtain the trained regularized Born network model.

[0059] Example 1 The SQL injection detection method based on the normalized Born network includes the following steps: Step 1: SQL injection data preprocessing The dataset used in the experiment is the SQL injection dataset provided on the official website of Kaggle. This dataset contains a total of 30,919 data, including 11,330 SQL injection data and 19,589 normal SQL data. SQL injection samples account for 36.6% of the sample library.

[0060] First, use conventional methods to clean and remove duplicates, convert upper and lower cases, and process special characters for all data. However, this method will lead to an increase in the size of word vectors due to the diversity of strings such as user input and database field names, especially when the word frequency setting value is low when generating word vectors. In fact, whether a data sample is an injection statement is not affected by the specific string and value, but is determined by the sample structure and key features such as SQL keywords and special symbols. For example: select * from users where id = 1 or 1 = 1 select * from users where id = 1 or 1 = 2 Although the values ​​of 1=1 and 1=2 have changed, the key features of the SQL statements have not changed, and they are essentially digital SQL injection statements. Therefore, in order to obtain more accurate data features, specific representations are used to replace these non-key feature contents. At the same time, in order to preserve the structural features of the SQL statements, SQL keywords and special symbols must be excluded during replacement, and only numbers and strings that are not reserved words and do not contain special symbols are replaced.

[0061] Use Python's nltk module word_tokenize method to tokenize the data sample. Then the above SQL statement can be expressed as follows after tokenization: ['select', '*', 'from', 'users', 'where', 'id', '=', '1', 'or', '1','=', '1'] ['select', '*', 'from', 'users', 'where', 'id', '=', '1', 'or', '1','=', '2'] If A is used to represent a string and B is used to represent a number, the List of the above SQL statement can be represented as: ['select', '*', 'from', 'A', 'where', 'A', '=', 'B', 'or', 'B', '=','B'] Translated into SQL statements, it can be expressed as: select * from A where A = B or B = B This can effectively reduce the size of word vectors and reduce the amount and time of calculations caused by string diversity.

[0062] Step 2: Extract feature vectors This step requires generating word vectors from the data in the dataset for use by the classification algorithm. At present, commonly used methods for generating word vectors include word2vec, fastText, glove, etc. This method uses the word2vec method to generate word vectors. The word2vec CBOW model can predict the word itself based on the words around the input. When using word2vec, the word vector dimension (vector_size), word frequency (min_count) and window (window) settings directly affect the generation results of the word vector, and experiments are needed to find more suitable parameter values. Taking vector_size=10, min_count=5, window=3 as an example, the word vector generated using word2vec is as follows: where 0.589886 -0.9857297 -1.4725536 1.0911893 -1.3376539 1.8009664 -0.10035476 -1.5403110.52144741.0803413 union -1.321273 -2.5650597 -2.9167135 0.8603391 -1.716017 -0.98713140.21660152 -2.99930380.184949350.929173 Obviously, the generated word vector is not normalized data and has many negative values. However, the detection input of the Born network requires non-negative normalized word vector data, so the word vector data needs to be linearly mapped to the non-negative area and then normalized.

[0063] Step 3: SQL injection detection The normalized Born network structure is shown in the figure below: Figure 2 As shown, where BN represents batch normalization, and It means that the superposition state is mapped to the wave function. Indicates the square of the modulus value. The normalized Born network improves the original Born network. It mainly consists of a batch normalization layer, two wave function layers, and a normalization layer. The addition of a batch normalization layer solves the problem of overfitting. The SQL statement generates word vectors through data preprocessing, which are input into the normalized Born network as input data, and classification detection is achieved through the network.

[0064] This application also proposes a classification method for SQL statements, which may include: S100, obtaining a feature vector of the SQL statement to be classified; S200, inputting the structural features of the SQL statement into the trained regularized Born network model to obtain the collapse probability of the SQL statement, normalizing the collapse probability, and obtaining the classification result of the SQL statement.

[0065] This application also proposes a classification system for SQL statements, which may include A feature extraction module is used to obtain feature vectors of SQL statements to be classified; The classification module is used to input the structural features of the SQL statement into the trained regularized Born network model to obtain the collapse probability of the SQL statement, normalize the collapse probability, and obtain the classification result of the SQL statement.

[0066] It should be noted that in the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each module is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules can be combined or integrated into another device, or some features can be ignored or not executed. The module described as a separate component may or may not be physically separated. The component displayed as a module may be a physical unit or multiple physical units, that is, it may be located in one place, or it may be distributed in multiple different places. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.

[0067] In addition, each module in each embodiment of the present invention may be integrated into a processing unit, each module may exist physically separately, or two or more modules may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit.

[0068] An electronic device provided in an embodiment of the present application includes a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the steps of the SQL classification method based on the normalized Born network described in any of the above embodiments are implemented.

[0069] Another electronic device provided in the embodiment of the present application may also include: an input port connected to the processor, used to transmit multimodal data collected by an external acquisition device to the processor; and a display unit connected to the processor, used to display the processing results of the processor to the outside world; a communication module connected to the processor, used to realize the communication between the electronic device and the outside world. The display unit can be a display panel, a laser scanning display, etc.; the communication mode adopted by the communication module includes but is not limited to mobile high-definition link technology (HML), universal serial bus (USB), high-definition multimedia interface (HDMI), wireless connection (including wireless fidelity technology (WiFi), Bluetooth communication technology, low-power Bluetooth communication technology, and communication technology based on IEEE802.11s).

[0070] An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the SQL classification method based on the normalized Born network described in any of the above embodiments are implemented.

[0071] The computer-readable storage medium involved in the present application includes random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the technical field.

[0072] For the description of the relevant parts of the SQL classification system based on the normalized Born network, the electronic device and the computer-readable storage medium provided in the embodiment of the present application, please refer to the detailed description of the corresponding parts in the power load forecasting method provided in the embodiment of the present application, which will not be repeated here. In addition, the parts of the above technical solutions provided in the embodiment of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive elaboration.

[0073] The above contents are only for explaining the technical idea of ​​the present invention and cannot be used to limit the protection scope of the present invention. Any changes made on the basis of the technical solution in accordance with the technical idea proposed by the present invention shall fall within the protection scope of the claims of the present invention.

Claims

1. A SQL classification model training method based on a normalized Born network, characterized in that: include: Get the feature vector of the SQL statement and the corresponding true label, map the feature vector to the non-negative area and normalize it; The feature vector of the SQL statement is used as the input of the regularized Born network model, and the label of the SQL statement is used as the classification result of the regularized Born network model. The regularized Born network model is trained. During training: Construct the wave function of the superposition state of the SQL statement feature vector and the wave function of the quantum state of the real label of the SQL statement; According to the transition probability between the wave function of the superposition state and the wave function of the quantum state, the optimal hyperparameters of the regularized Born network model are determined. The optimal hyperparameters include the joint probability and conditional probability , get the trained regularized Born network model; The trained regularized Born network model calculates the collapse probability of the wave function of the superposition state of the feature vector to the quantum state, and classifies the SQL statements according to the collapse probability.

2. The method for training a SQL classification model based on a normalized Born network according to claim 1, characterized in that: The method for obtaining the feature vector of the SQL statement is as follows: Preprocess the SQL statement to obtain the structural features of the SQL statement, and extract the feature vector of the SQL statement based on the structural features of the SQL statement.

3. The SQL classification model training method based on the normalized Born network according to claim 2, characterized in that: The preprocessing of the SQL statement includes: The SQL statements are cleaned, deduplicated, case-converted, and special characters processed to obtain the structural features of the SQL statements.

4. The method for training a SQL classification model based on a normalized Born network according to claim 1, characterized in that: The wave function of the superposition state of the SQL statement feature vector is as follows: In the formula, is the number of SQL statements obtained after preprocessing and feature extraction. feature, is the wave function corresponding to the input; The wave function of the quantum state of the real label of the SQL statement is as follows: in, Represents the superposition state of the eigenvectors Transformed into a classifier wave function The conversion probability.

5. The method for training a SQL classification model based on a normalized Born network according to claim 4, characterized in that: The determination of the conversion probability between the wave function of the superposition state and the wave function of the quantum state includes: According to Born's rule, the probability that the wave function of the superposition state of the SQL statement feature vector collapses to the quantum state of the true label is as follows: In the formula, is the wave function corresponding to the output, The probability that the wave function representing the superposition state of the feature vector collapses to the quantum state of the true label.

6. The method for training a SQL classification model based on a normalized Born network according to claim 1, characterized in that: The joint probability and conditional probability The expression is as follows: In the formula, is the intermediate variable, is the classification probability.

7. A SQL classification model training system based on a normalized Born network, characterized in that: include: The acquisition module is used to obtain the feature vector of the SQL statement and the corresponding true label, map the feature vector to the non-negative area and normalize it; The training module is used to train the regularized Born network model using the feature vector of the SQL statement as the input of the regularized Born network model and the label of the SQL statement as the classification result of the regularized Born network model. During training: Construct the wave function of the superposition state of the SQL statement feature vector and the wave function of the quantum state of the real label of the SQL statement; According to the transition probability between the wave function of the superposition state and the wave function of the quantum state, the optimal hyperparameters of the regularized Born network model are determined. The optimal hyperparameters include the joint probability and conditional probability , get the trained regularized Born network model; The trained regularized Born network model calculates the collapse probability of the wave function of the superposition state of the feature vector to the quantum state, and classifies the SQL statements according to the collapse probability.

8. A SQL classification method based on a normalized Born network, characterized in that: include: Get the feature vector of the SQL statement; The feature vector of the obtained SQL statement is input into the trained SQL classification model based on the normalized Born network to obtain the collapse probability of the SQL statement, and the collapse probability is normalized to obtain the classification result of the SQL statement.

9. A SQL classification system based on a normalized Born network, characterized in that: include: A feature extraction module is used to obtain feature vectors of SQL statements to be classified; The classification module is used to input the structural features of the SQL statement into the trained regularized Born network model to obtain the collapse probability of the SQL statement, normalize the collapse probability, and obtain the classification result of the SQL statement.

10. An electronic device, characterized in that: include: Memory for storing computer programs; A processor is used to implement the steps of the SQL classification method based on the normalized Born network as claimed in claim 8 when executing the computer program.

Citation Information

Patent Citations

  • SQL (Structured Query Language) statement generation method and related device

    CN118535591A

  • A method for detecting data misuse in an organization's network

    EP2571225A1