A problem embedding representation method based on the similarity of code space solutions

By constructing a data set of programming problems, knowledge points and submitted codes, refining multiple solutions and establishing a solution similarity matrix, the limitations of the existing PKT model in characterizing the correlation between problems are solved, and more accurate evaluation and prediction of students' programming ability are achieved.

CN119989006BActive Publication Date: 2025-06-20JIANGXI NORMAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510477006.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-06-20
Estimated Expiration
2045-04-16

AI Technical Summary

Technical Problem

The existing programming knowledge tracking (PKT) model has limitations in characterizing the correlation between problems and fails to effectively capture the similarity of solutions and the diversity at the code implementation level.

Method used

By constructing a data set, including programming problems, knowledge points and submitting code, a clustering algorithm is used to extract multiple solutions, and a solution similarity matrix is ​​established, and a knowledge point correlation matrix is ​​combined to form a problem embedded representation based on solution similarity.

Benefits of technology

It effectively improves the expression ability and prediction accuracy of problem embedding representation, and can more accurately evaluate students' solution design ability and programming knowledge status.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119989006B_ABST
    Figure CN119989006B_ABST
Patent Text Reader

Abstract

The present invention discloses a problem embedding representation method based on the similarity of code space solutions, which includes the following steps: constructing a data set, setting problem texts, processing the data set and the problem texts respectively to obtain problem vertex vectors, knowledge point vertex vectors, and low-dimensional problem text vectors, processing the obtained data respectively to obtain the predicted association probability of the problem vertex vectors, the joint predicted association probability of the problem vertex vectors and the knowledge point vertex vectors, and the predicted association probability of the knowledge point vertex vectors; defining a knowledge point set associated with the problem vertex vectors and processing it to obtain an average knowledge point vector, and processing the problem vertex vectors, the average knowledge point vector, and the low-dimensional problem text vectors based on the obtained predicted association probabilities to obtain a final problem embedding representation vector. The present invention effectively improves the expression ability of the problem embedding representation vector by jointly considering the diversity of solutions and the hierarchical association of knowledge points.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of code space solution methods, and provides a problem embedding representation method based on the similarity of code space solutions. Background Art

[0002] Knowledge Tracing (KT) is a method for modeling and evaluating students' mastery of knowledge concepts by analyzing the interaction data between students and exercises. With the introduction of deep learning technology, the performance of KT models has been significantly improved in recent years and has been widely applied in fields such as second language learning and STEM education. In the field of programming education, relying on the massive interaction data accumulated by online programming platforms such as LeetCode and Niuke.com, deep learning-driven KT models have also achieved rapid development. Against this background, the knowledge tracing task focused on programming education - Programming Knowledge Tracing (PKT) has gradually become a research hotspot.

[0003] Programming knowledge tracing provides an effective way for dynamically evaluating and predicting students' programming abilities by analyzing students' behavioral data in programming tasks. Different from traditional knowledge tracing models, PKT focuses on the mastery evaluation of programming knowledge points, and its main objectives include: estimating students' mastery of programming knowledge points and predicting whether their code submissions in subsequent programming problems are correct. To achieve this goal, the effective embedding representation of problems is crucial. High-quality problem representations can accurately capture students' knowledge states, thereby improving the accuracy of prediction. Previous studies have shown that reasonably designed problem embeddings can significantly improve the performance of PKT models and become a key step in inferring students' programming knowledge levels.

[0004] The current problem embedding methods in the PKT model can be mainly classified into the following four categories: generating problem embeddings based on problem indices and students' answers, generating problem embeddings based on the relationship between problems and knowledge points, generating problem embeddings based on the content of problem texts, and generating problem embeddings using code information. However, there are still limitations in characterizing the correlation between problems, mainly reflected in the following two aspects: First, existing research often only focuses on the association of knowledge points and ignores the similarity of solutions contained in the code submitted by students. In fact, there may be multiple solutions to the same problem, and different problems may also adopt similar solutions; constructing problem representations based on solutions can not only highlight the differences in ideas and implementations of different solutions, but also capture the commonalities of solutions in related problems, thereby more accurately evaluating students' solution design capabilities and programming knowledge status. Second, even if two problems involve the same programming knowledge point (such as recursive algorithms), their code implementation methods may be very different - for example, one problem focuses on optimizing the depth of recursion, while the other emphasizes the processing of complex data structures. Relying solely on the association of knowledge points is difficult to fully reflect the diversity at the implementation level. Therefore, to more accurately characterize the essential features of problems, it is necessary to comprehensively consider the problem correlation at the "code space" and "knowledge point level" to provide more comprehensive modeling information for problem embedding representations. Summary of the Invention

[0005] In view of the deficiencies of the prior art, the present invention provides a problem embedding representation method based on the similarity of solutions in the code space to solve the problems proposed in the above background technology.

[0006] To achieve the above object, the present invention provides the following technical solutions: A problem embedding representation method based on the similarity of solutions in the code space, comprising the following steps:

[0007] Step S1: Construct a data set, which includes programming problems, knowledge points, and all submitted codes corresponding to the programming problems;

[0008] Step S2: Process the programming problems and knowledge points to obtain problem vertex vectors and knowledge point vertex vectors, set a problem text, and process the problem text to obtain a problem text vector;

[0009] Step S3: Process the problem vertex vector to obtain the predicted association probability of the problem vertex vector;

[0010] Step S4: Process the problem vertex vector and the knowledge point vertex vector to obtain the joint predicted association probability of the problem vertex vector and the knowledge point vertex vector;

[0011] Step S5: Process the knowledge point vertex vector to obtain the predicted association probability of the knowledge point vertex vector;

[0012] Step S6: Map the problem text vector using a linear neural network to obtain a low-dimensional problem text vector; define the knowledge point set associated with the problem vertex vector, process the knowledge point set by the arithmetic mean method to obtain the average knowledge point vector, and concatenate the problem vertex vector, the average knowledge point vector, and the low-dimensional problem text vector based on the predicted association probability of the problem vertex vector, the joint predicted association probability of the problem vertex vector and the knowledge point vertex vector, and the predicted association probability of the knowledge point vertex vector to construct a first-order feature matrix. Process the first-order feature matrix by defining an interaction function to construct a second-order feature matrix, process the first-order feature matrix and the second-order feature matrix, obtain the scalar of the first-order feature matrix and the scalar of the second-order feature matrix, and add the scalar of the first-order feature matrix and the scalar of the second-order feature matrix to obtain the final problem embedding representation vector.

[0013] Furthermore, let be the set of programming problems , represent the th programming problem, and be the total number of programming problems; let be the set of knowledge points ; represent the th knowledge point; represent the th knowledge point; and be the total number of knowledge points; let be the set of all submitted codes corresponding to the programming problem ,

[0014] Furthermore, the problem vertex vector includes the first problem vertex vector , the second problem vertex vector, the knowledge point vertex vector includes the first knowledge point vertex vector and

[0015] the second knowledge point vertex vector; The specific process of obtaining the problem text vector is as follows: Define a problem text. The large-scale pre-trained language model first decomposes the problem text into a sequence of tokens, and then processes the token sequence through the token embedding layer to obtain the token embedding sequence , being the th token embedding sequence; finally, calculate the average value of the token embedding sequence to obtain the problem text vector

[0016] Further, let the set of all submitted codes corresponding to the th programming problem be represented as a set of programming problems, and let the th submitted code vector for the th programming problem be the th code vector submission; let represent the number of code vector submissions for the th programming problem ; for the set of all submitted codes corresponding to the th programming problem perform processing using a selected clustering algorithm to generate multiple cluster center vectors, where the multiple cluster center vectors include the th programming problem and the th programming problem ; consider the multiple cluster center vectors as the solution vector sets for the th programming problem and the th programming problem and represent them as: ; and , expressed as:

[0017] (1);

[0018] (2);

[0019] In the formula, represents the number of cluster center vectors generated by the clustering algorithm; represents the th cluster center vector for the th programming problem ; represents the th cluster center vector for the th programming problem ; represents the set of cluster center vectors for the th programming problem ; represents the set of cluster center vectors for the th programming problem ;

[0020] Calculate the cosine values for the solution vectors in the solution vector sets and respectively, and take the maximum value from the cosine values as the th programming problem and the programming problem similarity at the solution level is expressed as:

[0021] (3);

[0022] In the formula, represents the programming problem and the programming problem similarity between them; and respectively represent any solution center vectors in the solution vector sets and ; represents the transpose operation; represents the vector norm; represents the maximum value in the similarity;

[0023] Based on the programming problem and the programming problem similarity at the solution level, construct a solution similarity matrix , where ; represents the programming problem and the programming problem solution similarity; represents real matrix;

[0024] Set a similarity threshold , and construct a problem-solution association matrix with the same dimension as the solution similarity matrix ; For the in the solution similarity matrix make a judgment. When is greater than the similarity threshold , set in the problem-solution association matrix to 1, otherwise set it to 0, which is expressed as:

[0025] (4);

[0026] Finally, obtain the problem-solution association matrix ; represents the programming problem and the programming problem Is there a solution association; when is 1, it indicates that there is a solution association; when is 0, it indicates that there is no association;

[0027] The predicted association probability of the problem vertex vector in step S3. The specific process is as follows:

[0028] Calculate the first problem vertex vector and the second problem vertex vector The inner product between them , obtain the predicted similarity, and map the predicted similarity to the predicted association probability of the problem vertex vector through an activation function , which is expressed as:

[0029] (5);

[0030] In the formula, is the activation function; represents the input value; represents the function; represents the 1st to th programming problems;

[0031] Adopt the cross-entropy loss function to quantify the difference between the predicted association probability of the problem vertex vector and the problem solution association matrix in , that is, the first difference, which is expressed as:

[0032] (6);

[0033] In the formula, represents the logarithmic function.

[0034] Furthermore, use the set of programming problems and the set of knowledge points to construct a bipartite graph , where is the vertex set of the bipartite graph, is represented by the binary adjacency matrix ; represents whether there is an association relationship between the th programming problem and the th knowledge point . When is 1, it indicates that there is an association relationship; when is 0, it indicates that there is no association relationship;

[0035] ​The specific process of the joint prediction correlation probability between the problem vertex vector and the knowledge point vertex vector in step S4 is as follows:

[0036] The first problem vertex vector is processed through an activation function and the first knowledge point vertex vector to obtain the processed result by dealing with the measurement correlation degree between them, and then map the processed result to the joint prediction correlation probability of the problem vertex vector and the knowledge point vertex vector ;

[0037] The cross-entropy loss function is adopted to quantify the difference between the joint prediction correlation probability of the problem vertex vector and the knowledge point vertex vector and the binary adjacency matrix in the , which is the second difference and is expressed as:

[0038] (7).

[0039] Furthermore, define the set of knowledge points associated with the th programming problem as , indicating the correlation degree between the th programming problem and the th knowledge point ;

[0040] And construct a programming problem correlation matrix th programming problem according to the set of knowledge points associated with the , indicating whether there are common associated knowledge points between the th programming problem and the th programming problem ; when is 1, it means there are common associated knowledge points, and when is 0, it means there are no common associated knowledge points;

[0041] The cross-entropy loss function is adopted to quantify the difference between the predicted correlation probability of the problem vertex vector and the programming problem correlation matrix in the , which is the third difference and is expressed as:

[0042] (8).

[0043] Furthermore, the definition and Knowledge Points The set of related programming problems is , Indicates Knowledge Points With Programming Questions The degree of correlation between

[0044] And according to Knowledge Points A collection of related programming problems Constructing knowledge point relevance matrix , Indicates Knowledge Points With Knowledge Points Are there common related issues? 1 indicates that there is a common association problem; A value of 0 indicates that there is no common association problem;

[0045] The predicted association probability of the knowledge point vertex vector in step S5 is as follows:

[0046] By calculating the vertex vector of the first knowledge point and the second knowledge point vertex vector The inner product of After the activation function mapping, the predicted association probability of the knowledge point vertex vector is obtained ;

[0047] The cross entropy loss function is used to quantify the predicted association probability of the knowledge point vertex vector Relevance matrix with knowledge points middle The difference between , which is the fourth difference, is expressed as:

[0048] (9).

[0049] Furthermore, the final question embedding representation vector in step S6 is as follows:

[0050] Question text vector Use linear neural network mapping to obtain low-dimensional representation , expressed as:

[0051] (10);

[0052] In the formula, Represents a low-dimensional question text vector; Denote the weight matrix that linearly maps the problem text vector to a low-dimensional space; Denote the transpose of the weight matrix; Denote the bias term;

[0053] Define the first problem vertex vector The associated knowledge point set is , and calculate the average of the knowledge point set associated with the first problem vertex vector to obtain the average knowledge point vector , which is expressed as:

[0054] (11);

[0055] In the formula, Denote the number of knowledge points related to the first problem vertex vector ;

[0056] The predicted association probability based on the problem vertex vector , the joint predicted association probability of the problem vertex vector and the knowledge point vertex vector , and the predicted association probability of the knowledge point vertex vector Concatenate the first problem vertex vector , the average knowledge point vector and the low-dimensional problem text vector in sequence to construct the first-order feature matrix ; The first-order feature matrix consists of the first problem vertex vector , the average knowledge point vector and the low-dimensional problem text vector , that is , , ; and Denote any two vectors among the first problem vertex vector , the average knowledge point vector and the low-dimensional problem text vector in the first-order feature matrix ;

[0057] Define the interaction function , and calculate the interaction value between and in the first-order feature matrix through the defined interaction function ; Let , and construct the second-order feature matrix based on; Denote the first-order feature matrix in and the interaction value between; Denote a 3×3 real matrix;

[0058] For the first-order feature matrix select weight matrices Generate the th scalar in the way of element-wise multiplication and summation, denoted as:

[0059] (12);

[0060] In the formula, denote the th scalar; denote the th weight matrix; denote the first-order feature matrix in the th row and th column element; denote the element-wise multiplication and summation operation;

[0061] For the second-order feature matrix adopt weight matrices Generate the th scalar in the way of element-wise multiplication and summation, denoted as:

[0062] (13);

[0063] In the formula, denote the th scalar; denote the th weight matrix; denote the second-order feature matrix in the th row and th column element;

[0064] Add the th scalar of the first-order feature matrix and the th scalar of the second-order feature matrix with the bias vector element-wise, and after mapping through the activation function, obtain the final problem embedding representation vector , denoted as:

[0065] (14);

[0066] In the formula, ReLU represents the activation function.

[0067] Furthermore, define the true difficulty value of the th problem; use a linear layer to map the final problem embedding representation vector to the predicted difficulty value , which is expressed as:

[0068] (15);

[0069] In the formula, represents the weight vector;

[0070] Construct a function of the predicted difficulty value and the true difficulty of the th problem using the squared error, that is, the fifth difference, which is expressed as:

[0071] (16);

[0072] Finally, jointly optimize and integrate the first difference, the second difference, the third difference, the fourth difference, and the fifth difference into an objective function, which is expressed as:

[0073] (17);

[0074] In the formula, represents minimizing the joint loss function; is the importance coefficient for balancing the importance of each constraint.

[0075] Compared with the existing technologies, the present invention has the following beneficial effects: By clustering multiple correct code submissions for each problem, the present invention extracts diverse solutions to the problem at the code implementation level and establishes the similarity between problems at the solution level; by combining the similarity at the solution level with the problem relevance matrix of knowledge points, a problem embedding representation based on solution similarity is formed; compared with the traditional methods that only rely on knowledge points or text features, the present invention can capture the relevance and diversity of problems in the code implementation ideas; by jointly considering solution diversity and knowledge point hierarchical association, the present invention effectively improves the expression ability and prediction accuracy of the problem embedding representation, providing more comprehensive and accurate support for more in-depth problem analysis and student learning status diagnosis in the field of programming education. BRIEF DESCRIPTION OF THE DRAWINGS

[0076] Figure 1 is a flowchart of the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0077] As Figure 1As shown in the figure, the present invention provides a technical solution: a problem embedding representation method based on the similarity of code space solutions, including the following steps:

[0078] Step S1: Construct a data set, which includes programming problems, knowledge points, and all submitted codes corresponding to the programming problems;

[0079] Step S2: Process the programming problems and knowledge points to obtain problem vertex vectors and knowledge point vertex vectors. Set a problem text and process the problem text to obtain a problem text vector;

[0080] Step S3: Process the problem vertex vector to obtain the predicted association probability of the problem vertex vector;

[0081] Step S4: Process the problem vertex vector and the knowledge point vertex vector to obtain the joint predicted association probability of the problem vertex vector and the knowledge point vertex vector;

[0082] Step S5: Process the knowledge point vertex vector to obtain the predicted association probability of the knowledge point vertex vector;

[0083] Step S6: Map the problem text vector using a linear neural network to obtain a low-dimensional problem text vector; Define the set of knowledge points associated with the problem vertex vector, process the set of knowledge points by the arithmetic mean method to obtain an average knowledge point vector, and concatenate the problem vertex vector, the average knowledge point vector, and the low-dimensional problem text vector based on the predicted association probability of the problem vertex vector, the joint predicted association probability of the problem vertex vector and the knowledge point vertex vector, and the predicted association probability of the knowledge point vertex vector to construct a first-order feature matrix. Process the first-order feature matrix by defining an interaction function to construct a second-order feature matrix, process the first-order feature matrix and the second-order feature matrix to obtain the scalar of the first-order feature matrix and the scalar of the second-order feature matrix, and add the scalar of the first-order feature matrix and the scalar of the second-order feature matrix to obtain the final problem embedding representation vector.

[0084] Among them, let be the set of programming problems , represent the th programming problem, be the total number of programming problems; Let be the set of knowledge points ; represent the th knowledge point; represent the th knowledge point; be the total number of knowledge points; Let be the set of all submitted codes corresponding to the programming problems , Represents all the submitted codes corresponding to the th programming problem .

[0085] Among them, the problem vertex vector includes the first problem vertex vector , the second problem vertex vector , and the knowledge point vertex vector includes the first knowledge point vertex vector and the second knowledge point vertex vector ;

[0086] The specific process of obtaining the problem text vector is as follows: Define a problem text. The large-scale pre-trained language model first decomposes the problem text into a sequence of tokens, and then processes the token sequence through the token embedding layer to obtain a token embedding sequence , is the th token embedding sequence; finally, by calculating the average value of the token embedding sequence, the problem text vector is obtained.

[0087] Among them, let all the submitted codes corresponding to the th programming problem represent the set of programming problems, represents the th programming problem 's th code vector submission, represents the th programming problem 's code vector submission times; corresponding to the th programming problem All the submitted codes are processed using the selected clustering algorithm to generate multiple cluster center vectors. The multiple cluster center vectors include the th programming problem and the th programming problem . The multiple cluster center vectors are regarded as the solution vector sets of the th programming problem and the th programming problem , and are expressed as: and , which is expressed as:

[0088] (1);

[0089] (2);

[0090] In the formula, represents the number of cluster center vectors generated by the clustering algorithm; represents the th programming problem of the th cluster's center vector; represents the th programming problem of the th cluster's center vector; represents the set of cluster center vectors of the th programming problem ; represents the set of cluster center vectors of the th programming problem ;

[0091] Calculate the cosine values of the solution vectors in the solution vector sets and respectively, and take the maximum value from the cosine values as the similarity at the solution level between the th programming problem and the th programming problem , which is expressed as:

[0092] (3);

[0093] In the formula, represents the similarity between the th programming problem and the th programming problem ; and respectively represent any solution center vector in the solution vector sets and ; represents the transpose operation; represents the vector norm; represents the maximum value in the similarity;

[0094] Based on the similarity at the solution level between the th programming problem and the th programming problem , construct the solution similarity matrix , where ; represents the solution similarity between the th programming problem and the th programming problem ; representation real number matrix of

[0095] Set a similarity threshold and construct a problem-solution association matrix with the same dimension as the solution similarity matrix ; For the solution similarity matrix judge, when in is greater than the similarity threshold , set the corresponding element in the problem-solution association matrix to 1, otherwise set it to 0, which is expressed as: in ;

[0096] (4);

[0097] Finally, obtain the problem-solution association matrix ; represents the th programming problem and the th programming problem whether there is a solution association; when is 1, it means there is a solution association; when is 0, it means there is no association;

[0098] The predicted association probability of the problem vertex vector in step S3, the specific process is as follows:

[0099] Calculate the inner product between the first problem vertex vector and the second problem vertex vector to obtain the predicted similarity, and map the predicted similarity to the predicted association probability of the problem vertex vector through the activation function , which is expressed as:

[0100] (5);

[0101] In the formula, is the activation function; represents the input value; represents the function; represents the 1st to th programming problems;

[0102] Adopt the cross-entropy loss function to quantify the difference between the predicted association probability of the problem vertex vector in and the problem-solution association matrix , that is, the first difference, which is expressed as:

[0103] (6);

[0104] In the formula, represents the logarithmic function.

[0105] Among them, using the set of programming problems and the set of knowledge points to construct a bipartite graph where is the vertex set of the bipartite graph, and is represented by a binary adjacency matrix ; ; represents whether there is an association between the th programming problem and the th knowledge point . When is 1, it means there is an association; when is 0, it means there is no association;

[0106] In step S4, the joint prediction association probability of the problem vertex vector and the knowledge point vertex vector is as follows:

[0107] The degree of association between the first problem vertex vector and the first knowledge point vertex vector is processed through an activation function to obtain a processed result, and the processed result is mapped to the joint prediction association probability of the problem vertex vector and the knowledge point vertex vector ; ;

[0108] The cross-entropy loss function is used to quantify the difference between the joint prediction association probability of the problem vertex vector and the knowledge point vertex vector and the binary adjacency matrix in , that is, the second difference, which is expressed as: That is,

[0109] (7).

[0110] Among them, the set of knowledge points associated with the th programming problem is defined as , , represents the degree of association between the th programming problem and the th knowledge point ;

[0111] And based on the Programming Questions Related knowledge point collection Constructing a Programming Problem Relevance Matrix , express Programming Questions With Programming Questions Are there any common related knowledge points? 1 indicates that there are common related knowledge points. A value of 0 indicates that there are no commonly related knowledge points;

[0112] The cross entropy loss function is used to quantify the predicted association probability of the problem vertex vector Programming Problem Relevance Matrix middle The difference between , which is the third difference, is expressed as:

[0113] (8).

[0114] The definition is the same as Knowledge Points The set of related programming problems is , Indicates Knowledge Points With Programming Questions The degree of correlation between

[0115] And according to Knowledge Points A collection of related programming problems Constructing knowledge point relevance matrix , Indicates Knowledge Points With Knowledge Points Are there common related issues? 1 indicates that there is a common association problem; A value of 0 indicates that there is no common association problem;

[0116] The predicted association probability of the knowledge point vertex vector in step S5 is as follows:

[0117] By calculating the vertex vector of the first knowledge point and the second knowledge point vertex vector The inner product of After the activation function mapping, the predicted association probability of the knowledge point vertex vector is obtained ;

[0118] The cross - entropy loss function is used to quantify the prediction correlation probability of the knowledge point vertex vector and the knowledge point correlation matrix in the difference between , that is, the fourth difference, is expressed as:

[0119] (9).

[0120] Among them, the final problem embedding representation vector in step S6, the specific process is:

[0121] For the problem text vector a linear neural network mapping is adopted to obtain a low - dimensional representation , which is expressed as:

[0122] (10);

[0123] In the formula, represents the low - dimensional problem text vector; represents the weight matrix for linearly mapping the problem text vector to the low - dimensional space; represents the transpose of the weight matrix; represents the bias term;

[0124] Define the knowledge point set associated with the first problem vertex vector as , and the average knowledge point vector is obtained by averaging the knowledge point set associated with the first problem vertex vector , which is expressed as:

[0125] (11);

[0126] In the formula, represents the number of knowledge points related to the first problem vertex vector ;

[0127] Based on the prediction correlation probability of the problem vertex vector , the joint prediction correlation probability of the problem vertex vector and the knowledge point vertex vector , and the prediction correlation probability of the knowledge point vertex vector The first problem vertex vector , the average knowledge point vector and the low - dimensional problem text vector are concatenated in sequence to construct a first - order feature matrix ; The first - order feature matrix Composed of the first problem vertex vector , the average knowledge point vector , and the low-dimensional problem text vector , that is , , ; and represent any two vectors among the first problem vertex vector , the average knowledge point vector , and the low-dimensional problem text vector in the first-order feature matrix ;

[0128] Define the interaction function . By defining the interaction function , calculate the interaction value between and in the first-order feature matrix ; Let , and construct the second-order feature matrix based on ; represents the interaction value between and in the first-order feature matrix ; represents a 3×3 real matrix;

[0129] Select weight matrices from the first-order feature matrix and generate the th scalar in the way of element-wise multiplication and summation, expressed as:

[0130] (12);

[0131] In the formula, represents the th scalar; represents the th weight matrix; represents the element at the th row and th column of the first-order feature matrix ; represents the element-wise multiplication and summation operation;

[0132] Select weight matrices from the second-order feature matrix and generate the th scalar in the way of element-wise multiplication and summation, expressed as:

[0133] (13);

[0134] In the formula, represents the th scalar; represents the th weight matrix; represents the element at the th row and th column of the second-order feature matrix ;

[0135] Add the th scalar of the first-order feature matrix and the th scalar of the second-order feature matrix element-wise with the bias vector , and after mapping through the activation function, obtain the final problem embedding representation vector , expressed as:

[0136] (14);

[0137] In the formula, ReLU represents the activation function.

[0138] Among them, define the true difficulty value of the th problem; Use the linear layer to map the final problem embedding representation vector to the predicted difficulty value , expressed as:

[0139] (15);

[0140] In the formula, represents the weight vector;

[0141] Construct the function of the predicted difficulty value and the true difficulty of the th problem using the mean squared error, that is, the fifth difference, expressed as:

[0142] (16);

[0143] Finally, jointly optimize and integrate the first difference, second difference, third difference, fourth difference, and fifth difference into the objective function, expressed as:

[0144] (17);

[0145] In the formula, represents minimizing the joint loss function; is the importance coefficient for balancing each constraint.

[0146] Although embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A problem embedding representation method based on code space solution similarity, characterized in that: The steps include: Step S1: construct a data set, which includes programming problems, knowledge points, and all submitted codes corresponding to the programming problems; Step S2: Process the programming problem and the knowledge point to obtain the problem vertex vector and the knowledge point vertex vector, set a problem text, and process the problem text to obtain the problem text vector; Step S3: by processing the problem vertex vector, the predicted association probability of the problem vertex vector is obtained; Step S4: by processing the problem vertex vector and the knowledge point vertex vector, a joint prediction association probability of the problem vertex vector and the knowledge point vertex vector is obtained; Step S5: obtaining the predicted association probability of the knowledge point vertex vector by processing the knowledge point vertex vector; Step S6: Use a linear neural network to map the question text vector to obtain a low-dimensional question text vector; Define a set of knowledge points associated with the question vertex vector, process the knowledge point set through the arithmetic mean method to obtain the average knowledge point vector, concatenate the question vertex vector, the average knowledge point vector and the low-dimensional question text vector based on the predicted association probability of the question vertex vector, the joint predicted association probability of the question vertex vector and the knowledge point vertex vector and the predicted association probability of the knowledge point vertex vector, construct a first-order feature matrix, process the first-order feature matrix by defining an interaction function, construct a second-order feature matrix, process the first-order feature matrix and the second-order feature matrix, obtain the scalar of the first-order feature matrix and the scalar of the second-order feature matrix, add the scalar of the first-order feature matrix and the scalar of the second-order feature matrix, and obtain the final question embedding representation vector.

2. The problem embedding representation method based on code space solution similarity according to claim 1, characterized in that: set up For programming problems A collection of Indicates A programming question, is the total number of programming problems; let For knowledge points A collection of; Indicates Knowledge points; Indicates Knowledge points; is the total number of knowledge points; Submit code for all programming questions A collection of Indicates that the corresponding Programming Questions All submitted code.

3. The problem embedding representation method based on code space solution similarity according to claim 2, characterized in that: The problem vertex vectors include the first problem vertex vector , the second problem vertex vector , the knowledge point vertex vector includes the first knowledge point vertex vector and the second knowledge point vertex vector ; Get the question text vector The specific process is as follows: define a question text, the large-scale pre-trained language model first decomposes the question text into a word sequence, and then processes the word sequence through the word embedding layer to obtain the word embedding sequence , For the word embedding sequence; finally, the question text vector is obtained by calculating the average value of the word embedding sequence .

4. The problem embedding representation method based on code space solution similarity according to claim 3, characterized in that: Let the corresponding Programming Questions All submitted code represents a set of programming problems, Indicates Programming Questions No. code vectors submitted, Indicates Programming Questions The number of code vector submissions corresponding to Programming Questions All submitted codes Use the selected clustering algorithm Processing is performed to generate multiple cluster center vectors, and multiple cluster center vectors include the first Programming Questions and Programming Questions , multiple cluster center vectors are regarded as Programming Questions and Programming Questions The solution vector set and , expressed as: (1); (2); In the formula, Represents the number of cluster center vectors generated by the clustering algorithm; Indicates Programming Questions No. The center vector of each cluster; Indicates Programming Questions No. The center vector of each cluster; Indicates Programming Questions The set of cluster center vectors; Indicates Programming Questions The set of cluster center vectors; Solution vector set and Calculate the cosine value of each normal vector and take the maximum value as the first Programming Questions and Programming Questions The similarity at the solution level is expressed as: (3); In the formula, Indicates Programming Questions and Programming Questions similarities between; and Represents the solution vector set and Any solution center vector in ; Represents a transpose operation; represents the vector norm; Indicates the maximum value of similarity; Based on Programming Questions and Programming Questions Similarity at the solution level, constructing a solution similarity matrix ,in ; Indicates Programming Questions and Programming Questions The similarity of solutions; express A real matrix of ; Set a similarity threshold , and construct a similarity matrix with the solution Problems with the same dimensions and solutions to correlation matrices ; Solution similarity matrix middle Make a judgment, when Greater than the similarity threshold When the problem solution association matrix middle Set to 1, otherwise set to 0, expressed as: (4); Finally, we get the problem solution correlation matrix ; Indicates Programming Questions and Programming Questions Is there a solution association? When 1 means there is a solution association; A value of 0 indicates that there is no association; The predicted association probability of the problem vertex vector in step S3 is as follows: Calculate the first problem vertex vector And the second problem vertex vector The inner product between , obtain the predicted similarity, and map the predicted similarity to the predicted association probability of the problem vertex vector through the activation function , expressed as: (5); In the formula, is the activation function; Represents the input value; Represents a function; Indicates the first to A programming question; The cross entropy loss function is used to quantify the predicted association probability of the problem vertex vector and Problem Solution Correlation Matrix middle The difference between , i.e. the first difference, is expressed as: (6); In the formula, Represents a logarithmic function.

5. The problem embedding representation method based on code space solution similarity according to claim 4, characterized in that: Exploiting Programming Problems Collection And knowledge points Collection Constructing a bipartite graph ,in is the vertex set of the bipartite graph, is a binary adjacency matrix representation ; Indicates Programming Questions With Knowledge Points Is there a correlation? 1 indicates that there is an association relationship; A value of 0 indicates that there is no association; The joint prediction association probability of the problem vertex vector and the knowledge point vertex vector in step S4 is as follows: The first problem vertex vector is transformed by the activation function With the first knowledge point vertex vector Between Measure the degree of association and process it to obtain the result of the processing, and map the result of the processing into the joint predicted association probability of the problem vertex vector and the knowledge point vertex vector ; The cross entropy loss function is used to quantify the joint prediction association probability of the question vertex vector and the knowledge point vertex vector. With the binary adjacency matrix middle The difference between , i.e. the second difference, is expressed as: (7)。 6. The problem embedding representation method based on code space solution similarity according to claim 5, characterized in that: Definition and Programming Questions The associated knowledge point set is , Indicates Programming Questions No. Knowledge Points The degree of correlation between And according to Programming Questions Related knowledge point collection Constructing a Programming Problem Relevance Matrix , express Programming Questions With Programming Questions Are there any common related knowledge points? 1 indicates that there are common related knowledge points. 0 means there is no commonly related knowledge point; The cross entropy loss function is used to quantify the predicted association probability of the problem vertex vector Programming Problem Relevance Matrix middle The difference between , i.e. the third difference, is expressed as: (8)。 7. The problem embedding representation method based on code space solution similarity according to claim 6, characterized in that: Definition and Knowledge Points The set of related programming problems is , Indicates Knowledge Points With Programming Questions The degree of correlation between And according to Knowledge Points A collection of related programming problems Constructing knowledge point relevance matrix , Indicates Knowledge Points With Knowledge Points Are there common related issues? 1 indicates that there is a common association problem; A value of 0 indicates that there is no common association problem; The predicted association probability of the knowledge point vertex vector in step S5 is as follows: By calculating the vertex vector of the first knowledge point and the second knowledge point vertex vector The inner product of After the activation function mapping, the predicted association probability of the knowledge point vertex vector is obtained ; The cross entropy loss function is used to quantify the predicted association probability of the knowledge point vertex vector Relevance matrix with knowledge points middle The difference between , which is the fourth difference, is expressed as: (9)。 8. The problem embedding representation method based on code space solution similarity according to claim 7, characterized in that: The final question embedding representation vector in step S6 is as follows: Question text vector Use linear neural network mapping to obtain low-dimensional representation , expressed as: (10); In the formula, Represents a low-dimensional question text vector; Indicates that the question text vector The weight matrix that is linearly mapped to a low-dimensional space; represents the transpose of the weight matrix; represents the bias term; Define the first problem vertex vector The associated knowledge point set is , the vertex vector of the first problem is calculated by arithmetic mean The associated knowledge point set is averaged to obtain the average knowledge point vector , expressed as: (11); In the formula, Represents the first problem vertex vector The number of relevant knowledge points; Predicted association probability based on question vertex vector , the joint prediction association probability of the question vertex vector and the knowledge point vertex vector , the predicted association probability of the knowledge point vertex vector The first problem vertex vector , average knowledge point vector and the low-dimensional problem text vector Concatenate in sequence to construct a first-order feature matrix ; First-order characteristic matrix From the first problem vertex vector , average knowledge point vector and the low-dimensional problem text vector Composition, that is , , ; and Represents the first-order characteristic matrix The vertex vector in the first problem , average knowledge point vector and the low-dimensional problem text vector Any two vectors; Defining interaction functions , by defining the interaction function Calculate the first-order characteristic matrix middle and The interaction value between ,based on Construct the second-order characteristic matrix ; Represents the first-order characteristic matrix middle and The interaction value between represents a 3×3 real matrix; For the first-order characteristic matrix Select Weight matrix Generate the first A scalar, expressed as: (12); In the formula, Indicates scalar; Indicates A weight matrix; Represents the first-order characteristic matrix Middle Line Elements of a column; Represents element-wise multiplication and sum operation; For the second-order characteristic matrix use Weight matrix Generate the first A scalar, expressed as: (13); In the formula, Indicates scalar; Indicates A weight matrix; Represents the second-order characteristic matrix Middle Line Elements of a column; The first-order feature matrix No. scalar and second-order characteristic matrix No. scalar and bias vector After adding each element and mapping it through the activation function, we get the final question embedding representation vector , expressed as: (14); Where ReLU represents the activation function.

9. The problem embedding representation method based on code space solution similarity according to claim 8, characterized in that: Definition The actual difficulty of the question ; Use a linear layer to embed the final question into a representation vector Mapped to prediction difficulty value , expressed as: (15); In the formula, represents the weight vector; Use squared error to construct the prediction difficulty value With The actual difficulty of the problem Function , the fifth difference, is expressed as: (16); Finally, the first difference, the second difference, the third difference, the fourth difference and the fifth difference are jointly optimized and integrated into the objective function, which is expressed as: (17); In the formula, Represents minimizing the joint loss function; is the importance coefficient for balancing the constraints.

Citation Information

Patent Citations

  • Knowledge tracking method for enhancing topic similarity embedding based on weighted meta-path

    CN116502713A

  • Programming knowledge tracking method fusing code and score information

    CN118569447A