A deep knowledge tracing method and system applied to multi-element programming exercises
By employing a multi-head attention mechanism and unified processing of programming exercises, the limitations of existing models for single question types are overcome. By utilizing compilation log information, high-precision prediction of multiple types of exercises is achieved, making it suitable for programming learning platforms.
Patent Information
- Application Number
- CN202310816845.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-05
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2043-07-05
AI Technical Summary
Existing deep knowledge tracing models only consider a single question type in the field of programming learning, ignoring the characteristics of programming question types and regular question types, resulting in poor prediction performance and failing to make full use of the compilation log information of programming exercises.
A multi-head attention mechanism is adopted to uniformly process diverse exercise data, combine programming question type and general question type features to establish a compilation error knowledge base, and use log pattern clustering and position encoding to construct a question type feature matrix, which is then input into a deep knowledge tracing model for prediction.
The model improves the prediction accuracy of multiple exercises, is suitable for practical programming learning environments, enhances the ability to distinguish different question types, captures the correlation between question types, and improves prediction performance.
Smart Images

Figure CN116860995B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a deep knowledge tracking method and system applied to multi-element programming exercises, in particular, a knowledge tracking technology based on a multi-head attention mechanism, which is applied in the field of programming learning and can make model predictions on multi-element exercise data generated by learners. BACKGROUND
[0002] Knowledge tracking technology mines potential learning rules from learners' historical answer records, captures changes in knowledge states, and predicts learners' future problem-solving performance, thus providing personalized teaching for learners and achieving free high-quality personalized teaching for learners. Traditional knowledge tracking models include item response theory models, Bayesian models, and factor analysis models. These models have good interpretability, but the prediction effect of the models is generally poor. With the continuous development of artificial intelligence technology, deep learning technology has been widely applied in the field of knowledge tracking. Compared with traditional knowledge tracking models, knowledge tracking models using deep learning technologies such as recurrent neural networks, memory networks, and attention mechanisms can capture more complex representations of students' knowledge, and the accuracy has been significantly improved. Therefore, deep knowledge tracking technology is widely used in online learning platforms, intelligent tutoring systems, and other information-based teaching platforms, aiming to help educators understand students' knowledge levels and provide personalized teaching. In addition, this technology has been explored and applied in the fields of vocational assessment, student programming, language learning, and other fields. In the student programming scenario, deep knowledge tracking technology has been applied to programming learning platforms through continuous research and development. Related research has made useful explorations in programming learning analysis, prediction, and personalized learning guidance.
[0003] Specifically, in the field of programming learning prediction, deep knowledge tracking predicts students' knowledge mastery from their programming exercise sequences and submitted historical codes. By analyzing the knowledge points contained in the students' submitted source codes, the students' mastery level can be determined. Therefore, many researchers have studied various methods to extract student code features and integrate them into knowledge tracking models in different ways to predict students' performance in the programming learning process, helping learners understand programming languages and programming ideas, and improving their programming ability and problem-solving ability.
[0004] It should be noted that the programming exercise answering method is different from the ordinary "one-off" exercise answering method. Programming learning behavior has several specialities: 1. There is no unique standard answer to programming questions in general, and the content of the examination is more and the knowledge points are more closely related. 2. The programming code provided by the student and the compilation log generated during the compilation process contain a large amount of information, which can reflect the student's mastery of programming language knowledge content. 3. For most programming exercises, students will modify and submit the source code multiple times until the result is correct or satisfactory.
[0005] Therefore, in the current programming learning prediction field, there are still some deficiencies in the existing deep knowledge tracking models and methods, which can be summarized as follows:
[0006] First, the characteristics of programming questions are not fully utilized. Only the question and code features of programming questions are considered, and the rich log information after code compilation is ignored. Second, the model feature input is insufficient. Most existing knowledge tracking models and methods only consider the question and answer result features, ignoring the influence of question types and multiple knowledge points on knowledge mastery. Third, the applicable question types are single. Regular questions and programming questions cannot be used as inputs for the model, but are trained and predicted separately as different models. This independence is not conducive to improving the accuracy of the model and is not suitable for actual programming learning environments. SUMMARY
[0007] In view of the problems in the application of deep knowledge tracking in the field of programming learning, the present application provides a multi-element question-based programming knowledge tracking method and system based on multi-head attention. The first purpose is to solve the problem that existing programming knowledge tracking models only consider programming questions and ignore the prediction of regular questions. A method for simultaneously tracking programming knowledge for multi-element questions (multiple-choice questions, multiple-choice questions, fill-in-the-blank questions, judgment questions, and programming questions) is proposed. The generated multi-element question data of learners is uniformly processed, especially for programming questions, which are mapped to logs-knowledge points, converted into a format consistent with the model input, and fused with question type features to predict the knowledge mastery of learners.
[0008] Terminology explanation:
[0009] 1. DKT: Deep Learning-based Knowledge Tracking Technology, used to evaluate and predict students' knowledge mastery.
[0010] 2. Multi-head self-attention: a widely used attention mechanism in deep learning that can simultaneously weight and fuse information at different positions in the input sequence, better capturing important features in the sequence.
[0011] 3. Python: a high-level interpreted programming language designed for simple and readable code writing and rapid development. Python is known for its concise syntax, readability, and wide range of applications.
[0012] 4. re.findall module: a function in the re module that finds and returns all parts of a given string that match a regular expression pattern. Its function is to find all matching patterns in the string and return them in the form of a list.
[0013] 5、group method: a method in the re module that matches objects and returns strings that match a regular expression pattern.
[0014] 6、log pattern clustering: an analysis technique for log data that groups log entries with similar patterns or characteristics into the same category. In large-scale log data sets, log entries often exhibit diverse formats and structures, and log pattern clustering aims to discover commonalities and repetitions among them for more efficient log analysis and troubleshooting.
[0015] The technical solution of the present application is:
[0016] A deep knowledge tracking method applied to multi-element programming exercises, comprising:
[0017] Receiving user exercise data table and compiling log data file of the programming platform system; wherein the user exercise data table includes exercise ID, user ID, answer result, knowledge point, time information, exercise difficulty and exercise type. The compiling log data includes user information, code information, compiling command, error and warning information, compiling result and time information.
[0018] Data preprocessing is performed on the user exercise data table and the compiling log data; data preprocessing includes: preprocessing the user exercise data in the user exercise data table, including data integration, data format conversion and data cleaning; and preprocessing the user compiling log data file to extract error information;
[0019] Specifically, data integration is to integrate user exercise data in multiple nodes or databases into a user exercise data table. Data format conversion is to convert time information from a standard time representation format to a corresponding digital sequence. Data cleaning is to simplify and desensitize long user ID information in the user exercise data to improve data simplicity and usability. And the control contained in the user exercise data is deleted. Secondly, the answer result is standardized, specifically, the minimum and maximum normalization method is used to process the data of each type of question into a dimensionless value increasing in the interval [0, 1].
[0020] Log pattern clustering is performed on the error information; each type of compiling error is analyzed, a compiling error knowledge base is established, and related knowledge point mapping and compiling error keywords are extracted, wherein the knowledge point mapping is performed according to the error type and the code information contained in the error occurrence code line.
[0021] Extract the exercise ID, user ID, answer result, knowledge point, time information, exercise difficulty and exercise type from the processed user exercise data table and store them in the user exercise data table; Sort the sequence with user ID and time information as labels;
[0022] Construct a question type feature matrix;
[0023] Position coding based on time interval and learning ability;
[0024] Input into the trained deep knowledge tracking model to realize deep knowledge tracking.
[0025] According to the application, the deep knowledge tracking model comprises an encoder, a decoder and a prediction layer;
[0026] The encoder comprises a multi-head self-attention layer and a feedforward neural network layer; the multi-head self-attention layer and the feedforward neural network layer are processed using residual connection and group normalization;
[0027] The input of the multi-head self-attention layer comes from different projections of the interaction embedding, and the output score value is processed by residual connection and group normalization to serve as the input of the feedforward neural network; the output of the feedforward neural network is processed by residual connection and normalization to serve as the output of the encoder and the input of the second multi-head self-attention layer of the decoder;
[0028] The decoder comprises two multi-head self-attention layers and a feedforward neural network layer; the two multi-head self-attention layers comprise a first multi-head self-attention layer and a second multi-head self-attention layer;
[0029] The output of the encoder serves as the input of the decoder and is input into the second multi-head self-attention layer; the input of the first multi-head self-attention layer comes from different projections of the knowledge point embedding matrix k t , and the output score value is processed by residual connection and group normalization to serve as the input of the second multi-head self-attention layer.
[0030] The output of the decoder is processed by the prediction layer to obtain the final prediction result; the prediction layer comprises two fully connected layers, which are activated by ReLU first and sigmoid last.
[0031] According to the application, in the multi-head self-attention layer, a lower triangular matrix with all 1s is used as a mask matrix;
[0032] According to the application, in the multi-head self-attention layer, the student's exercise accuracy feature is used to represent the student's forgetting ability, so the calculation formula of the multi-head self-attention layer of the encoder and the first multi-head self-attention layer of the decoder considering the student's forgetting behavior and forgetting ability is shown in formula (I) and formula (II):
[0033]
[0034] Attention=Score·V(II)
[0035] In formula (I), formula (II), Q, K, V are three inputs of a multi-head self-attention layer; specifically, in the first layer self-attention layer of the encoder and the decoder, Q, K and V are all from x t different projections; in the attention layer of the last layer of the decoder, Q is from the output of the first layer attention of the decoder, K and V are from the output of the encoder; alpha and beta are learnable hyperparameters, delta ij is the interval between the solving time of the i-th and j-th exercises, is the learning ability of the student u i , Score is the attention value, and Attention is the final output, is to avoid the softmax gradient being too small due to too large parameters, and Mask() is a mask operation.
[0036] According to the present application, the user exercise data is preprocessed, including:
[0037] Data integration: the user exercise data in multiple nodes or databases is integrated into a data table;
[0038] Data format conversion: the time information is converted from a standard time representation format to a corresponding digital sequence;
[0039] Data cleaning: the long user ID information in the user exercise data is simplified and desensitized to improve the simplicity and usability of the data, and the control contained in the user exercise data is deleted;
[0040] Finally, the answer records of all users including exercise ID, user ID, answer result, knowledge point, time information, exercise difficulty and exercise type.
[0041] According to the present application, the error information of the programming log data is extracted, including:
[0042] The regular expression is used to extract the compilation error information of each user;
[0043] The re.findall function is used to find the compilation error error matching items in the programming log data, including error type, error description, error time and code line information, which are stored together with the question and learner information into a csv file.
[0044] According to the present application, the error information is clustered in a log mode, including:
[0045] The agglomerative hierarchical clustering algorithm is selected for clustering, and the clustering features used are error type, error description, error occurrence code line and the corresponding exercise, and the clustering result includes multiple clustering clusters, each of which represents a type of error with similar features, and each element in the clustering cluster represents a specific error information including error type, error description, error occurrence code line and the corresponding exercise information.
[0046] According to the preferred embodiment of the present application, the analysis of each type of compilation error is performed to establish a compilation error knowledge base, including: expert analysis of the error type, error description and error occurrence code line in each clustering cluster, and the knowledge points or concepts that may cause the error are inferred by deeply understanding the nature and context information of the error; the knowledge points or concepts are associated with the clustering cluster to establish the compilation error knowledge base.
[0047] According to the preferred embodiment of the present application, a question type feature matrix is constructed, including:
[0048] First, the student u i answer record is divided and marked according to the exercise type;
[0049] Then, the question type with the highest proportion is selected to mark the input sequence, and the question type is taken as a special mark of the input sequence; by counting the answer records of different students and time points, a question type feature matrix T i×j is formed, which has a size of i rows and j columns; wherein i is the number of students, j is the number of inputs, and each element represents the proportion of the question type made by the corresponding student at the corresponding time point;
[0050] The formula for calculating the proportion of the question type is shown in formula (III) and formula (IV):
[0051]
[0052] T ij max =argmax(P1,P2,...P type )(IV)
[0053] In formula (III) and formula (IV), for each input sequence, it is assumed that there are type different question types; for the ti-th question type, it is denoted as q ti , and the proportion P ti of the sequence is calculated, the argmax function represents selecting the parameter with the maximum value, and T ij max represents the element in the ith row and jth column of the question type feature matrix T i×j .
[0054] According to a preferred embodiment of the present invention, deep knowledge tracing includes:
[0055] 1) Input:
[0056] Student U i Answer records In this context, {Question ID, Answer Result, Knowledge Point} is represented as a triple.
[0057] Knowledge point kp t After one-hot encoding, the knowledge point vector k' is obtained. t Then, project the knowledge point matrix W. k Multiplying them together yields the final knowledge point embedding matrix k. t Among them, W k ∈R E×d E is the total number of knowledge points, d is the dimension of the model; W k Used to store the knowledge point vector k' t Mapped to the dimensions of deep knowledge tracing models;
[0058] Record the answers and knowledge points (a) t ,kp t According to a) t The included answer results will embed the encoded knowledge points into matrix k. t Perform a zero-vector concatenation operation at the appropriate positions, where the length of the zero vector is related to k. t With the same length, and then with the interactive projection matrix W x Multiplying them together yields the final interactive embedding x. t W x Used for recording answer results and knowledge points. t This is mapped onto the dimensions of the deep knowledge tracing model, as shown in equations (V), (VI), and (VII):
[0059]
[0060] x t =x' t ·W x (VI)
[0061] k t =k' t ·W k (VII)
[0062] In equations (V), (VI), and (VII), k' t It is a knowledge point kp t The vector representation after one-hot encoding, x' t It is a record of answer results and knowledge points (a)t ,kp t ) after one-hot encoding;
[0063] 2) Position encoding based on time interval and learning ability:
[0064] According to the time information in the student answer record , the time interval△ mn of the student after finishing any two exercises m,n is calculated ; According to the exercise result in the student answer record and the exercise difficulty information diff q , the exercise accuracy of the student u i when finishing exercise n is calculated, and the exercise accuracy is used to represent the learning ability of the student The learning ability is calculated according to the following formula (VIII):
[0065]
[0066] In formula (VIII), q represents the exercise ID, a q is the exercise result of student u i , diff q represents the difficulty of exercise q, q∈(0,1). sum n is the total number of exercises completed by student u i when finishing exercise n.
[0067] Then,△ mn and are added as parameter information to the multi-head attention layer for position encoding;
[0068] 3) In the multi-head self-attention layer of the encoder and the first self-attention layer of the decoder, the attention head is divided according to the question type feature matrix T i×j ; Specifically, the number of attention heads in the multi-head self-attention layer is set, if the number of question types is L, the number of attention heads is N·L, N is a settable training parameter of the deep knowledge tracking model; The attention head is one-to-one corresponding to the question type;
[0069] According to the question type feature matrix T i×j , the input of the multi-head self-attention layer is divided into the corresponding question type; The divided Q, K, and V are input into the corresponding question type attention head to obtain the attention value;
[0070] The calculation result of each attention head is multiplied by the weight matrix, so that the deep knowledge tracking model pays attention to information from different question type attention subspaces, as shown in formula (IX):
[0071] MHA(Q, K, V) = Concat(Attention1, Attention NL )W O (IX)
[0072] In formula (IX), W O is a weight matrix for linear transformation of the output vector, NL represents the number of attention heads, and MHA(Q, K, V) is the final output vector of the multi-head attention layer;
[0073] 4) Group normalization
[0074] The group normalization divides the output of the multi-head attention layer into L groups according to the number L of question types, and each group corresponds to a question type; specifically including:
[0075] First, calculate the mean and standard deviation in each group after dividing L groups;
[0076] Then, after normalizing the output in each group, the output in each group is spliced to obtain the final group-normalized output of the multi-head attention layer, and the output in each group is normalized, as shown in formula (X):
[0077]
[0078] In formula (X), Z L is the output in each group, mean is the mean of the sample features in the group, variance is the variance of the sample features in the group, and ψ is a small constant;
[0079] 5) in the encoder and the decoder;
[0080] First, the calculation of the encoder is shown in formula (XI) and formula (XII):
[0081] M = GN(Q + MHA(Q, K, V)) (XI)
[0082] OE = GN(M + (ReLU(MW1 + b1)W2 + b2)) (XII)
[0083] In formula (XI) and formula (XII), Q, K, and V are interaction matrices x t generated by different weight matrix projections, MHA is the attention score, GN represents the group normalization operation, M is the normalized output, W1 and W2 are weights, b1 and b2 are biases, ReLU is an activation function in a feedforward neural network, and OE is the output result of the encoder:
[0084] In the decoder, after the second layer multi-head self-attention layer calculates the attention value, the attention value is input to a feedforward neural network composed of two fully connected layers after residual connection and group normalization processing, and then the output of the feedforward neural network is taken as the final output of the decoder after residual connection and group normalization, and the formulas are as shown in formula (XIII), formula (XIV) and formula (XV):
[0085] M1=GN(Q+MHA(Q,K,V)) (XIII)
[0086] M2=GN(O E +MHA(O E ,M1,M1)) (XIV)
[0087] O D =GN(M2+FNN(M2)) (XV)
[0088] In formula (XIII), formula (XIV) and formula (XV), M1 and M2 are the results of the output after group normalization, and O D is the final result of the output of the decoder.
[0089] 6) After the prediction layer processing, the final prediction result is obtained;
[0090] The output of the decoder is h t , the weight of the first fully connected layer of the prediction layer is W1, the bias is b1, the weight of the second fully connected layer of the prediction layer is W2, and the bias is b2, wherein h1 is the output of the first fully connected layer, and the calculation formula of the prediction layer is as shown in formula (XII), formula (XVI) and formula (XVII):
[0091] h1=ReLU(W1h t +b) (XVI)
[0092] y t =sigmoid(W2h1+b2) (XVII)
[0093] In formula (XVI) and formula (XVII), the first fully connected layer of the prediction layer converts the output h t of the decoder into an intermediate feature vector h1, and uses a ReLU activation function; the second fully connected layer uses a sigmoid activation function to convert the intermediate feature vector h1 into the final prediction result y t .
[0094] According to the application, preferably, the deep knowledge tracking model adopts binary cross entropy of model prediction value and data true value as a loss function; L2 regularization is performed on the question characteristic parameters, and a regularization term is added as additional information into the loss function to form a total loss function of the deep knowledge tracking model together with the binary cross entropy loss, and the specific formula is shown in formula (XVIII):
[0095]
[0096] In formula (XVIII), the first term is a binary cross entropy loss function for measuring the difference between the model prediction value and the true value; the second term is an L2 regularization term for punishing the excessively large parameters of the model to avoid overfitting; λ is a regularization coefficient for controlling the strength of regularization; N is the number of samples, the true label of the i-th sample is {0, 1}, and the prediction probability of the deep knowledge tracking model is The question characteristic parameters are θ;
[0097] By minimizing the total loss function, the optimal parameters θ of the deep knowledge tracking model are obtained, and the trained deep knowledge tracking model is obtained.
[0098] A computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the deep knowledge tracking method applied to multi-element programming exercises when executing the computer program.
[0099] A computer readable storage medium stores a computer program, and the computer program implements the steps of the deep knowledge tracking method applied to multi-element programming exercises when executed by a processor.
[0100] A deep knowledge tracking system applied to multi-element programming exercises includes:
[0101] A data collection and preprocessing module is configured to receive user exercise data and compilation log data of a programming platform system for data preprocessing; the data preprocessing includes preprocessing the user exercise data and extracting error information from the programming log data;
[0102] A clustering module is configured to analyze each type of compilation error, establish a compilation error knowledge base, and perform related knowledge point mapping and extraction of compilation error keywords, wherein the knowledge point mapping is performed according to the error type and the code information contained in the error occurrence code line.
[0103] A question type characteristic matrix construction module is configured to construct a question type characteristic matrix;
[0104] A position coding module is configured to perform position coding based on time intervals and learning ability;
[0105] The deep knowledge tracking module is configured to implement deep knowledge tracking by inputting into the trained deep knowledge tracking model.
[0106] The present application has the following beneficial effects:
[0107] 1. In application, unlike traditional knowledge tracking models, the present application improves the model through data processing, establishment of a knowledge base and model improvement, so that the model can be applied to multiple question types, rather than predicting a single question type or a regular question type, which is more in line with the actual application scenario, especially by establishing a compiled result knowledge base, the application of knowledge tracking to multiple different exercise question types in the programming platform field is realized.
[0108] 2. In the field of programming learning situation prediction, the present application innovatively uses compiled result data as additional input of the model, fully excavates the potential value of the data, and improves the prediction accuracy of the model. The exercise number and exercise type features are added, and the running result of the programming question is mapped to the knowledge point. The answer data and the exercise data are respectively used as new model inputs, which improves the differentiation and prediction ability of the model for different question types.
[0109] 3. The model establishes multiple independent attention heads according to different question types, captures relevant information in different question types and the correlation between different question types, and further improves the prediction performance of the model for multiple exercises. BRIEF DESCRIPTION OF DRAWINGS
[0110] Figure 1 FIG. 1 is a logic flow diagram of a deep knowledge tracking method applied to multiple programming exercises of the present application;
[0111] Figure 2 FIG. 3 is a multi-head attention layer framework diagram of the present application;
[0112] Figure 3 FIG. 4 is a deep knowledge tracking model framework diagram of the present application. DETAILED DESCRIPTION
[0113] The present application is further limited by the following description and examples with reference to the accompanying drawings, but is not limited thereto.
[0114] Example 1
[0115] A deep knowledge tracking method applied to multiple programming exercises, as shown in FIG. 1, includes: Figure 1
[0116] The user's exercise data table and the compilation log data file of the programming platform system are received. The user's exercise data table includes exercise ID, user ID, answer result, knowledge point, time information, exercise difficulty and exercise type. The compilation log data includes user basic information, exercise information, code submission record and compilation error information.
[0117] The user's exercise data table and the compilation log data are preprocessed. The preprocessing includes preprocessing the user's exercise data in the user's exercise data table, including data integration, data format conversion and data cleaning; and preprocessing the user's compilation log data file to extract error information.
[0118] Specifically, data integration is to integrate user exercise data in multiple nodes or databases into a user exercise data table. Data format conversion is to convert time information from a standard time representation format to a corresponding numerical sequence. Data cleaning is to simplify and desensitize long user ID information in user exercise data to improve data simplicity and usability. And the control contained in the user's exercise data is deleted. Secondly, the answer result is standardized. Specifically, the minimum and maximum normalization method is used to process the data of each type of question into a dimensionless value increasing in the interval [0, 1].
[0119] The user's compilation log data in the compilation log data file is the log data file generated by the code compilation process of the learner in the programming learning platform system. Specifically, it includes user information, code information, compilation command, error and warning information, compilation result and time information.
[0120] The error information is clustered in a log mode. Each type of compilation error is analyzed, a compilation error knowledge base is established, and related knowledge points are mapped and compilation error keywords are extracted. The knowledge point mapping is based on the error type and the code information contained in the error occurrence code line.
[0121] The exercise ID, user ID, answer result, knowledge point, time information, exercise difficulty and exercise type are extracted from the processed user's exercise data table using the database standardized query language SQL statement, and stored in the user's exercise data table. The sequence is sorted with user ID and time information as labels. The time information and the exercise difficulty information are used to construct the position coding of the deep knowledge tracking model, and the exercise ID and the exercise type are used to construct the question type feature matrix.
[0122] Constructing a question type feature matrix.
[0123] Position coding based on time interval and learning ability.
[0124] The answer interaction sequence is one-hot coded to obtain an answer interaction embedding vector; and the answer interaction embedding vector is input into the trained deep knowledge tracking model to realize deep knowledge tracking.
[0125] Embodiment 2
[0126] The deep knowledge tracking method applied to multi-element programming exercises according to Embodiment 1 is different in that:
[0127] As shown in Figure 3 , the deep knowledge tracking model includes an encoder, a decoder and a prediction layer.
[0128] The encoder includes a multi-head self-attention layer and a feedforward neural network layer; the multi-head self-attention layer and the feedforward neural network layer are processed using residual connection and group normalization; in the multi-head attention mechanism, each attention head has its own feedforward neural network for transforming the input. The feedforward neural network of the present application adopts a ReLU activation function, and at the same time, a regularization technique Dropout is added to avoid overfitting problems. The function of the residual connection is to solve the problems of gradient disappearance and gradient explosion in the network, thereby improving the training effect and stability of the model. Group normalization adjusts the output to a similar range, making the training process smoother and more stable.
[0129] As shown in Figure 2 , the inputs Q, K and V of the multi-head self-attention layer come from different projections of the interaction embedding x t , and the output score value is processed by residual connection and group normalization as the input of the feedforward neural network; the output of the feedforward neural network is processed by residual connection and normalization, as the output of the encoder and the input of K and V of the second multi-head self-attention layer of the decoder.
[0130] The decoder includes two multi-head self-attention layers and a feedforward neural network layer; the two multi-head self-attention layers include a first multi-head self-attention layer and a second multi-head self-attention layer.
[0131] The output of the encoder is input into the decoder, specifically, K and V are input into the second multi-head self-attention layer; the inputs Q, K and V of the first multi-head self-attention layer come from different projections of the knowledge point embedding matrix k t , and the output score value is processed by residual connection and group normalization as the input Q of the second multi-head self-attention layer.
[0132] The output of the decoder is processed by the prediction layer to obtain the final prediction result; the prediction layer includes two fully connected layers, using ReLU activation function first and sigmoid activation function last.
[0133] The encoder comprises one multi-head self-attention layer; the decoder comprises two multi-head self-attention layers; because the self-attention mechanism can learn the global dependence of the input sequence at one time, there is no long-term dependence problem. Therefore, the same encoder-decoder structure as the Transformer is used for knowledge tracking in the application, and the self-attention mechanism has three layers, which are respectively the self-attention layer in the encoder and the two self-attention layers in the decoder.
[0134] However, due to the particularity of the knowledge tracking task, at time t, the model cannot know the inputs at time t-1 and after. However, the input at all times in the self-attention mechanism is performed at the same time, therefore, an additional masking operation is required to mask the input at subsequent times. The application uses a lower triangular matrix with all 1s as a mask matrix. After masking, the value of the diagonal and the following part of the embedding matrix remains unchanged, and the value above the diagonal is all 0. In this way, at time t, the model can only pay attention to the interaction at time t-1 and before, which meets the definition of the knowledge tracking task. Therefore, the application uses a masking mechanism in the attention layer to make the self-attention mechanism applicable to the knowledge tracking task.
[0135] In the multi-head self-attention layer, a lower triangular matrix with all 1s is used as a mask matrix;
[0136] In the multi-head self-attention layer, considering that the forgetting ability of different students is not the same, the application uses the correct rate feature of the student to represent the forgetting ability of the student, therefore, the calculation formula of the multi-head self-attention layer of the encoder and the first multi-head self-attention layer of the decoder considering the forgetting behavior and the forgetting ability of the student is shown in formula (I) and formula (II):
[0137]
[0138] Attention=Score·V (II)
[0139] In formula (I) and formula (II), Q, K, and V are three inputs of the multi-head self-attention layer; specifically, in the first layer self-attention layer of the encoder and the decoder, Q, K, and V all come from different projections of x t ; in the attention layer of the last layer of the decoder, Q comes from the output of the first layer attention of the decoder, and K and V come from the output of the encoder; α and β are learnable hyperparameters, △ ij is the interval between the solving times of questions i and j, is the learning ability of student u i , Score is the attention value, and Attention is the final output, is to avoid the softmax gradient being too small due to too large parameters, and Mask() is a masking operation.
[0140] Preprocessing of user's test data, including:
[0141] Data integration: integrating user's test data in multiple nodes or databases into a data table;
[0142] Data format conversion: converting time information from standard time representation format to corresponding numerical sequence;
[0143] Data cleaning: simplifying and desensitizing long user ID information in user's test data to improve data simplicity and usability, and deleting control contained in user's test data;
[0144] Finally, the answer records of all users are obtained Including exercise ID, user ID, answer result, knowledge point, time information, exercise difficulty and exercise type.
[0145] From the python practical course database of a university programming platform, user test data including exercise ID, user ID, test result, knowledge point, time information, exercise difficulty, exercise type data and compilation log file are obtained. The data is cleaned, and the missing values, repeated values and abnormal values in the data are deleted and repaired. The data set is divided, and the training, validation and test data are divided according to 6:2:2. The statistical information of the data set is shown in table 1.
[0146] Table 1
[0147] Total number of learners Number of questions Number of knowledge points Types of questions Total number of interactions 2703 2745 550 6 56694
[0148] Error information extraction is performed on the programming log data, including:
[0149] Regular expression is used to extract the compilation error information of each user; specifically, re module of Python is used to extract error information. re.findall function is used to find compilation error error matching items in programming log data, including error type, error description, error time and code line information, which are stored in csv file together with question and learner information.
[0150] Log mode clustering is performed on the error information, including:
[0151] Considering that the processed error information has different error types and different orders of magnitude, and the visualization needs of the front-end page, an agglomerative hierarchical clustering algorithm is selected for clustering, and the clustering features used are error type, error description, error occurrence code line and belonging exercise. The clustering result includes multiple clustering clusters, each of which represents a class of errors with similar features, and each element in the clustering cluster represents a specific error information, including error type, error description, error occurrence code line and belonging exercise information.
[0152] For each type of compilation error, analyze and establish a compilation error knowledge base, including: expert analysis of the error type, error description and error occurrence code line in each clustering cluster, through in-depth understanding of the nature and context information of the error, the expert can infer the knowledge points or concepts that may cause the error; determine that the error reason is caused by the learner's lack of understanding at a knowledge point, and then associate the knowledge point or concept with the clustering cluster to establish a compilation error knowledge base. Specifically, the corresponding relationship between the clustering cluster including error type, error description, error occurrence code line and belonging exercise information and the knowledge point is stored, which can be stored in a structured form in a database. The storage and sorting process can also be sorted and divided according to the error occurrence frequency, difficulty and knowledge range in the clustering cluster.
[0153] Construct a question type feature matrix, including:
[0154] Because the present application is aimed at knowledge tracking for multiple programming exercises, there are large differences between samples of different question types, especially between programming question types and regular question types. Therefore, when inputting the model, the proportion of different question types in the model input vector is considered.
[0155] Because the python practical course database contains 6 types of questions including programming questions, there are large differences between samples of different question types, especially between programming question types and regular question types. Therefore, when inputting the model, the proportion of different question types in the model input vector is considered.
[0156] First, the student u i answer record is divided and marked by question type; there are 6 types of questions, namely single-choice questions, multiple-choice questions, fill-in-the-blank questions, true-or-false questions, subjective questions and programming questions. Through statistics, the proportion of different question types in each input sequence is then calculated. According to the metadata information of the data set, the proportion of different question types in each input sequence is calculated through statistics.
[0157] Then, the question type with the highest proportion is selected to label the input sequence as a special label for the input sequence. By counting the answer records of different students and time points, a question type feature matrix T i×j is formed, which has a size of i rows and j columns. Here, i is the number of students, j is the number of inputs, and each element represents the proportion of the question type made by the corresponding student at the corresponding time. The question type feature matrix is used as one of the inputs of the multi-head self-attention layer in the encoder.
[0158] The formula for calculating the question type proportion is shown in equations (III) and (IV):
[0159]
[0160] T ij max = argmax (P1, P2,... P type )(IV)
[0161] In equations (III) and (IV), for each input sequence, there are type different question types. For the ti-th question type, denoted as q ti , the proportion P ti is calculated. The argmax function selects the parameter with the maximum value. T ij max represents the element in the ith row and jth column of the question type feature matrix T i×j .
[0162] The advantage of this method is that it considers the differences between different question types and uses the question type proportion as an important input feature, allowing the model to better understand and utilize the contributions of different question types to student knowledge tracking, improving the model's interpretability. By modeling the question type features, the student's performance on different question types can be more accurately analyzed, and the prediction accuracy of the student's learning status and knowledge level can be improved.
[0163] To implement deep knowledge tracking, the following steps are taken:
[0164] 1) Input:
[0165] The answer record of student u i is represented as a triple
[0166] After one-hot encoding of the knowledge point kp t , the knowledge point vector k' t is obtained, which is then multiplied by the knowledge point projection matrix W k to obtain the final knowledge point embedding matrix k t ; wherein, W k ∈R E×d , E is the total number of knowledge points, d is the dimension of the model; W k is used to map the knowledge point vector k' t to the dimension of the deep knowledge tracking model; so as to be used in the encoder.
[0167] Record the answer results and knowledge points (a t , kp t ), according to the answer results contained in a t , embed the encoded knowledge points into the matrix k t Perform the corresponding position connection zero vector operation, and the length of the zero vector is consistent with the length of k t , and then multiply it by the interaction projection matrix W x , to obtain the final interaction embedding x t ; W x is used to map the answer results and knowledge point records x' t to the dimension of the deep knowledge tracking model; so as to be used in the decoder: as shown in formula (V), formula (VI), formula (VII):
[0168]
[0169] x t =x' t ·W x (VI)
[0170] k t =k' t ·W k (VII)
[0171] In formula (V), formula (VI), formula (VII), k' t is the one-hot encoded vector representation of knowledge point kp t , and x' t is the one-hot encoded vector representation of answer results and knowledge point records (a t , kp t );
[0172] 2) Position coding based on time interval and learning ability:
[0173] Self-attention-based models are not suitable for knowledge tracking tasks because they do not consider the sequential relationships of the input sequence. To address this issue, this invention introduces positional encoding into the model, enabling it to consider the relative positions of different elements in the answer sequence. However, forgetting also occurs during student learning, and each student's learning ability and forgetting rate vary. Therefore, this invention proposes an algorithm that better reflects the actual student problem-solving process by incorporating the time interval information of student problem-solving and their learning ability into the positional encoding, thereby improving the model's predictive ability.
[0174] According to students' answer records The time information is used to calculate the time interval Δ between students after completing any two exercises m and n (where the completion time of exercise n is greater than the completion time of exercise m). mn According to students' answer records The diff between the results of solving the problems and the difficulty information of the problems q Calculate student u i The accuracy rate when completing exercise n, used to represent the students' performance. learning ability Among them, learning ability The calculation formula (VIII) is as follows:
[0175]
[0176] In equation (VIII), q represents the exercise ID, a q For students u i The results of the problem-solving, diff q The sum represents the difficulty of problem q, where q∈(0,1). n For students u i The total number of problems solved when completing problem n.
[0177] Then, △ mn and The positional information is incorporated as a parameter into the multi-head attention layer for positional encoding; see formula (I) for details. In this way, when performing self-attention calculations, the model considers not only the relative positions of sequence elements but also the time intervals between student responses and their learning abilities. Through this extended positional encoding method, the model can better understand students' learning behaviors and forgetting patterns, thereby improving its ability to predict student responses.
[0178] The advantage of this approach is that it incorporates individual differences among students and forgetting behavior during the learning process into the model, making the model more closely reflect the actual learning situation of students, thus enabling more accurate prediction and analysis.
[0179] 3) In the encoder and decoder, in the multi-head self-attention layer of the encoder and the first self-attention layer of the decoder, according to the question type feature matrix T i×j Attention head division is performed; specifically, the number of attention heads in the multi-head self-attention layer is set, and if the question type category is L, the number of attention heads is N·L, N is a training parameter of the depth knowledge tracking model that can be set; the attention heads are one-to-one corresponding to the question types;
[0180] According to the question type feature matrix T i×j The input of the multi-head self-attention layer is divided into the corresponding question type; the divided Q, K, and V are input into the corresponding question type attention head to obtain the attention value; according to the difference in the attention values output by different question type attention heads, the proportion of the interaction between different question types can be distinguished, and the prediction stability and interpretability of the model are increased.
[0181] The calculation result of each attention head is multiplied by the weight matrix to make the depth knowledge tracking model pay attention to information from different question type attention subspaces, as shown in formula (IX):
[0182] MHA(Q,K,V)=Concat(Attention1,…,Attention NL )W O (IX)
[0183] In formula (IX), W O is a weight matrix for linear transformation of the output vector, NL represents the number of attention heads, and MHA(Q,K,V) is the final output vector of the multi-head attention layer;
[0184] 4) Group normalization
[0185] The multi-head attention architecture based on the Transformer often uses layer normalization to normalize the output of each attention head to adjust the output to a similar range, making the training process smoother and more stable. However, in this invention, considering the differences between programming question types and regular question types, group normalization (Group Normalization) is introduced to replace layer normalization for the knowledge tracking task of multi-programming exercises. This method can divide the output of each attention layer into several groups and perform independent normalization processing on each group of features to reduce the differences between samples and improve the performance of the model in multi-programming exercises.
[0186] Compared with layer normalization, group normalization has the following advantages in multi-programming problem knowledge tracking: first, considering the difference between programming and regular types: group normalization fully considers the difference between programming and regular types, and can better capture the characteristics of different types by normalizing the output of each type independently. Second, reduce sample differences: group normalization divides samples into different groups according to the type of the sample, and each group is normalized independently, which can reduce the differences between different types of samples and improve the generalization ability of the model. Third, enhance model performance: by better adapting to the differences between programming and regular types, group normalization helps the model more accurately track knowledge and improve the prediction ability and accuracy of the model in multi-programming problems.
[0187] Specifically, group normalization divides the output of the multi-head attention layer into L groups according to the number of types of the attention head, that is, the type of the attention head, and each group corresponds to a type of problem; this division ensures that each type of problem has independent statistical information in the normalization process. The features within each group are normalized independently, rather than being normalized for the entire batch as in traditional batch normalization. This approach helps to reduce differences between different types of problems, as programming and regular types may have different distribution characteristics.
[0188] In summary, through group normalization, the model can better handle the differences between programming and regular types, and by reasonably selecting the grouping method and normalization parameters, the model performance can be further optimized, reducing the problem of model performance decline caused by type differences, and improving the knowledge tracking ability of multi-programming problems. It can avoid the strict imbalance of different types of data in the data set, resulting in poor prediction results, increase the stability and robustness of the model, and improve the generalization ability of the model on various types.
[0189] Specifically includes:
[0190] First, calculate the mean and standard deviation of each group;
[0191] Then, the output of each group is standardized, and the output of each group is spliced to obtain the final group-normalized multi-head attention layer output, and the output of each group is standardized, as shown in equation (X):
[0192]
[0193] In equation (X), Z L is the output of each group, mean is the mean of the sample features in the group, variance is the variance of the sample features in the group, and ψ is a small constant;
[0194] 5) in the encoder and the decoder;
[0195] First, the calculation of the encoder is shown in formula (XI), formula (XII):
[0196] M = GN(Q + MHA(Q, K, V)) (XI)
[0197] OE = GN(M + (ReLU(MW1 + b1)W2 + b2)) (XII)
[0198] In formula (XI), formula (XII), Q, K, V are interaction matrices x t MHA is the attention score, GN represents the group normalization operation, M is the normalized output, W1, W2 are weights, b1, b2 are biases, ReLU is an activation function in a feedforward neural network, and OE is the output result of the encoder:
[0199] In the decoder, after the second multi-head self-attention layer calculates the attention value, it is input to the feedforward neural network composed of two fully connected layers after residual connection and group normalization processing, and then it is input to the feedforward neural network composed of two fully connected layers after residual connection and group normalization processing. The final output of the decoder is shown in formula (XIII), formula (XIV), formula (XV):
[0200] M1 = GN(Q + MHA(Q, K, V)) (XIII)
[0201] M2 = GN(O E + MHA(O E , M1, M1)) (XIV)
[0202] O D = GN(M2 + FNN(M2)) (XV)
[0203] In formula (XIII), formula (XIV), formula (XV), M1, M2 are the results of the group normalization output, O D is the final result of the decoder output.
[0204] 6) After the prediction layer processing, the final prediction result is obtained;
[0205] The output of the decoder is h t , the weight of the first fully connected layer of the prediction layer is W1, the bias is b1, the weight of the second fully connected layer of the prediction layer is W2, and the bias is b2, wherein h1 is the output of the first fully connected layer. The calculation formula of the prediction layer is shown in formula (XII), formula (XVI), formula (XVII):
[0206] h1 = ReLU(W1h t+b) (XVI)
[0207] y t =sigmoid(W2h1+b2) (XVII)
[0208] In equations (XVI) and (XVII), the first fully connected layer of the prediction layer will convert the decoder's output h... t The intermediate feature vector h1 is transformed using the ReLU activation function; the second fully connected layer uses the sigmoid activation function to transform the intermediate feature vector h1 into the final prediction result y. t .
[0209] The deep knowledge tracing model uses the binary cross-entropy between the model's predicted values and the actual data values as the loss function. To avoid overfitting and improve the model's generalization ability, this invention performs L2 regularization on the question feature parameters, adding the regularization term as additional information to the loss function. Together with the binary cross-entropy loss, it forms the total loss function of the deep knowledge tracing model, as shown in Equation (XVIII).
[0210]
[0211] In equation (XVIII), the first term is the binary cross-entropy loss function, used to measure the difference between the model's predicted value and the true value; the second term is the L2 regularization term, used to penalize excessively large model parameters and avoid overfitting; λ is the regularization coefficient, controlling the strength of regularization; with N samples, the true label of the i-th sample is {0,1}, and the predicted probability of the deep knowledge tracking model is... The characteristic parameter of the problem is θ;
[0212] By minimizing the total loss function, we obtain the parameters θ of the optimal deep knowledge tracing model, thus obtaining the trained deep knowledge tracing model.
[0213] Example 3
[0214] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the deep knowledge tracing method for multi-programming exercises described in Embodiment 1 or 2.
[0215] Example 4
[0216] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the deep knowledge tracing method for multi-variable programming exercises described in Embodiment 1 or 2.
[0217] Example 5
[0218] A deep knowledge tracking system applied to multi-element programming exercises, comprising:
[0219] A data collection and preprocessing module is configured to receive user exercise data and compilation log data of a programming platform system for data preprocessing; the data preprocessing includes preprocessing the user exercise data and extracting error information from the programming log data;
[0220] A clustering module is configured to analyze each type of compilation error, establish a compilation error knowledge base, and perform related knowledge point mapping and extraction of compilation error keywords; the knowledge point mapping is performed according to the error type and code information contained in the error occurrence code line;
[0221] An exercise type feature matrix construction module is configured to construct an exercise type feature matrix;
[0222] A position coding module is configured to perform position coding based on time intervals and learning ability;
[0223] A deep knowledge tracking module is configured to input into a trained deep knowledge tracking model to realize deep knowledge tracking.
[0224] The above only describes the preferred embodiments of the present application and is not intended to limit the present application; any modification, equivalent replacement and improvement made within the innovation and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A deep knowledge tracing method applied to multi-dimensional programming exercises, characterized in that, include: Receive user problem-solving data tables and compilation log data files from the programming platform system; Perform data preprocessing on the user's question-answering data table and compilation log data; Data preprocessing includes: preprocessing user-answered question data in the user-answered question data table, including data integration, data format conversion, and data cleaning; and preprocessing user compilation log data files to extract error information. Error messages are clustered according to log patterns; each type of compilation error is analyzed, a compilation error knowledge base is established, and relevant knowledge points are mapped and compilation error keywords are extracted. The knowledge point mapping is based on the error type and the code information contained in the line of code where the error occurred. Extract the question ID, user ID, answer result, knowledge point, time information, question difficulty, and question type from the processed user question data table and store them in the user question data table; sort the sequence by user ID and time information as labels; and group the knowledge points kp t After one-hot encoding, the knowledge point vector k' is obtained. t Then, project the knowledge point matrix W. k Multiplying them together yields the final knowledge point embedding matrix k. t Among them, W k ∈R E×d E is the total number of knowledge points, d is the dimension of the model; W k Used to store the knowledge point vector k' t Mapped to the dimensions of deep knowledge tracing models; Record the answers and knowledge points (a) t ,kp t According to a) t The included answer results will embed the encoded knowledge points into matrix k. t Perform a zero-vector concatenation operation at the appropriate positions, where the length of the zero vector is related to k. t With the same length, and then with the interactive projection matrix W x Multiplying them together yields the final interactive embedding x. t ; Construct a question type feature matrix; The time interval and learning ability are added as parameters to the multi-head attention layer for position encoding; Inputting the data into a trained deep knowledge tracing model enables deep knowledge tracing. Deep knowledge tracing models include encoders, decoders, and prediction layers; The encoder consists of a multi-head self-attention layer and a feedforward neural network layer; residual connections and group normalization are used to process the multi-head self-attention layer and the feedforward neural network layer. The input to the multi-head self-attention layer comes from different projections of the interactive embedding. The output score is processed by residual connections and group normalization and then used as the input to the feedforward neural network. The output of the feedforward neural network is then processed by residual connections and normalization and used as the output of the encoder and the input to the second multi-head self-attention layer of the decoder. The decoder consists of two multi-head self-attention layers and a feedforward neural network layer; the two multi-head self-attention layers include a first multi-head self-attention layer and a second multi-head self-attention layer; The encoder's output serves as the decoder's input, which is then fed into the second multi-head self-attention layer; the input to the first multi-head self-attention layer comes from the knowledge point embedding matrix k. t The different projections, the output score values are processed by residual connection and group normalization and used as the input of the second multi-head self-attention layer; The decoder output is processed by the prediction layer to obtain the final prediction result; the prediction layer consists of two fully connected layers, first using the ReLU activation function and finally using the sigmoid activation function; Construct a question type feature matrix, including: First, regarding student u i Answer Record The exercises are categorized and labeled according to their types; Then, the question type with the highest percentage is selected to mark the input sequence, and this question type is used as a special label for the input sequence; by statistically analyzing the answer records of different students at different times, a question type feature matrix T is formed. i×j The matrix has a size of i rows and j columns; where i is the number of students, j is the number of inputs, and each element represents the proportion of the question type answered by the corresponding student at the corresponding time. The formulas for calculating the weight of each question type are shown in equations (III) and (IV): T ij max =argmax(P1,P2,...P type )(IV) In equations (III) and (IV), for each input sequence, assume there are 'type' different question types; for the 'ti'-th question type, denoted as 'q'. ti Calculate its proportion P in the sequence. ti The `argmax` function selects the parameter with the largest value. ij max The characteristic matrix T represents the question type. i×j The element in the i-th row and j-th column; In the encoder and decoder, in the multi-head self-attention layer of the encoder and the first self-attention layer of the decoder, based on the question type feature matrix T... i×j Attention heads are divided; specifically, the number of attention heads in the multi-head self-attention layer is set. If the question type is L, then the number of attention heads is N·L, where N is a configurable training parameter of the deep knowledge tracking model; attention heads correspond one-to-one with question types. Based on the question type feature matrix T i×j The input to the multi-head self-attention layer is classified into question types; the classified Q, K, V are input into the corresponding question type attention head to obtain the attention value.
2. The deep knowledge tracing method applied to multi-faceted programming exercises according to claim 1, characterized in that, In the multi-head self-attention layer, a lower triangular matrix consisting entirely of 1s is used as the mask matrix; In the multi-head self-attention layer, the student's accuracy rate is used to represent the student's forgetting ability. Therefore, the calculation formulas for the encoder's multi-head self-attention layer and the decoder's first multi-head self-attention layer, which consider the student's forgetting behavior and forgetting ability, are shown in Equations (I) and (II): Attention = Score·V(II) In equations (I) and (II), Q, K, and V are the three inputs to the multi-head self-attention layer; specifically, in the first self-attention layer of the encoder and decoder, Q, K, and V all come from the interactive embedding x. t Different projections; in the last attention layer of the decoder, Q comes from the output of the first attention layer of the decoder, K, V come from the output of the encoder; α, β are learnable hyperparameters, Δ ij Let i be the time interval between solving problems i and j. For students u i The learning ability is represented by a score, where Score is the attention value and Attention is the final output. Mask() is a masking operation used to avoid the softmax gradient being too small due to excessively large parameters.
3. The deep knowledge tracing method for multi-faceted programming exercises according to claim 1, characterized in that, Preprocessing of user-completed question data includes: Data integration: Integrating user-generated question data from multiple nodes or databases into a single data table; Data format conversion: This involves converting time information from a standard time representation format into a corresponding numerical sequence; Data cleaning: Simplify and de-identify long user ID information in the user's question-answering data, and delete control information contained in the user's question-answering data; Finally, the answer records of all users were obtained. This includes the question ID, user ID, answer result, knowledge point, time information, question difficulty, and question type.
4. The deep knowledge tracing method applied to multi-faceted programming exercises according to claim 1, characterized in that, Extract error messages from programming log data, including: Use regular expressions to extract compilation error information for each user; Use the `re.findall` function to find compilation error matches in the programming log data, including error type, error description, time of error occurrence, and line of code where the error occurred. Store these matches in a CSV file along with the question and learner information.
5. The deep knowledge tracing method applied to multi-faceted programming exercises according to claim 1, characterized in that, Error messages are clustered based on log patterns, including: Agglomerative hierarchical clustering algorithm was selected for clustering. The clustering features used were error type, error description, line of code where the error occurred, and the exercise to which the error belonged. The clustering result includes multiple clusters, each cluster representing a class of errors with similar characteristics. Each element in a cluster represents a specific error message, including error type, error description, line of code where the error occurred, and the exercise to which the error belongs. For each type of compilation error, an analysis is performed to establish a compilation error knowledge base. This includes: conducting expert analysis on the error type, error description, and line of code in each cluster; inferring the knowledge points or concepts that may lead to the error by deeply understanding the nature and context of the error; and associating the knowledge points or concepts with the clusters to establish a compilation error knowledge base.
6. A deep knowledge tracing method for multi-variable programming exercises according to any one of claims 1-5, characterized in that, To achieve deep knowledge tracing, including: 1) Input: Student U i Answer records In this context, {Question ID, Answer Result, Knowledge Point} is represented as a triple. W x Used for recording answer results and knowledge points. t This is mapped onto the dimensions of the deep knowledge tracing model, as shown in equations (V), (VI), and (VII): In equations (V), (VI), and (VII), k' t It is a knowledge point kp t The vector representation after one-hot encoding, x' t It is a record of answer results and knowledge points (a) t ,kp t The vector representation after one-hot encoding; 2) Location encoding based on time interval and learning ability: According to students' answer records The time information is used to calculate the time interval Δ between the completion of any two exercises m and n. mn According to students' answer records The diff between the results of solving the problems and the difficulty information of the problems q Calculate student u i The accuracy rate when completing exercise n, used to represent the students' performance. learning ability Among them, learning ability The calculation formula (VIII) is as follows: In equation (VIII), q represents the exercise ID, a q For students u i The results of the problem-solving, diff q The sum represents the difficulty of problem q, where q∈(0,1). n For students u i The total number of problems solved when completing problem n; Then, △ mn and This information is added as a parameter to the multi-head attention layer for position encoding; 3) Multiply the calculation result of each attention head by the weight matrix to make the deep knowledge tracking model pay attention to information from the attention subspaces of different question types, as shown in Equation (IX): MHA(Q,K,V)=Concat(Attention1,…,Attention NL )W O (IX) In equation (IX), W O It is the weight matrix for linear transformation of the output vector, NL represents the number of attention heads, and MHA(Q,K,V) is the final output vector of the multi-head attention layer; 4) Grouping Normalization Grouping normalization divides the output of the multi-head attention layer into L groups according to the number L of question types, with each group corresponding to one question type; specifically including: First, divide the group into L groups and calculate the mean and standard deviation for each group. Then, after standardizing the output within each group, the outputs within each group are concatenated to obtain the final group-normalized output of the multi-head attention layer. The output within each group is standardized as shown in equation (X): In equation (X), Z L ' refers to the standardized output within each group, mean is the mean of the sample features within the group, variance is the variance of the sample features within the group, and ψ is a small constant. 5) In the encoder and decoder; First, the encoder calculation is shown in equations (XI) and (XII): M = GN(Q + MHA(Q,K,V))(XI) OE=GN(M+(ReLU(MW1+b1)W2+b2))(XII) In equations (XI) and (XII), Q, K, and V are the interaction matrices x. t Generated through projections of different weight matrices, MHA represents the attention score, GN represents the grouping normalization operation, M is the normalized output, W1 and W2 are the weights, b1 and b2 are the biases, ReLU is the activation function in the feedforward neural network, and OE is the encoder output. In the decoder, after the second multi-head self-attention layer calculates the attention value, it is processed by residual connections and group normalization before being input into a feedforward neural network composed of two fully connected layers. After further processing by residual connections and group normalization, it becomes the final output of the decoder, as shown in equations (XIII), (XIV), and (XV). M1=GN(Q+MHA(Q,K,V))(XIII) M2=GN(O E +MHA(O E ,M1,M1))(XIV) O D =GN(M2+FNN(M2))(XV) In equations (XIII), (XIV), and (XV), M1 and M2 are the output results after grouping and normalization, and O D This is the final output of the decoder; 6) The final prediction result is obtained after processing by the prediction layer; The decoder output is h t The weights of the first fully connected layer in the prediction layer are W1, and the bias is b1. The weights of the second fully connected layer in the prediction layer are W2, and the bias is b2. Here, h1 is the output of the first fully connected layer. The calculation formulas for the prediction layer are shown in equations (XII), (XVI), and (XVII). h1=ReLU(W1h t +b)(XVI) y t =sigmoid(W2h1+b2)(XVII) In equations (XVI) and (XVII), the first fully connected layer of the prediction layer will convert the decoder's output h... t The intermediate feature vector h1 is transformed using the ReLU activation function; the second fully connected layer uses the sigmoid activation function to transform the intermediate feature vector h1 into the final prediction result y. t ; The deep knowledge tracing model uses the binary cross-entropy between the model's predicted values and the actual data values as the loss function. L2 regularization is applied to the question feature parameters, and the regularization term is added as additional information to the loss function. Together with the binary cross-entropy loss, this forms the total loss function of the deep knowledge tracing model, as shown in equation (XVIII). In equation (XVIII), the first term is the binary cross-entropy loss function, used to measure the difference between the model's predicted value and the true value; the second term is the L2 regularization term, used to penalize excessively large model parameters and avoid overfitting; λ is the regularization coefficient, controlling the strength of regularization; with N samples, the true label of the i-th sample is {0,1}, and the predicted probability of the deep knowledge tracking model is... The characteristic parameter of the problem is θ; By minimizing the total loss function, we obtain the parameters θ of the optimal deep knowledge tracing model, thus obtaining the trained deep knowledge tracing model.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the deep knowledge tracing method for applying multi-variable programming exercises as described in any one of claims 1-6.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the deep knowledge tracing method for applying multi-variable programming exercises as described in any one of claims 1-6.
9. A deep knowledge tracing system for multi-variable programming exercises, used to implement the deep knowledge tracing method for multi-variable programming exercises as described in any one of claims 1-6, characterized in that, include: The data collection and preprocessing module is configured to receive user problem-solving data and compilation log data from the programming platform system and perform data preprocessing. Data preprocessing includes: preprocessing user-generated problem-solving data and extracting error information from programming log data; The clustering module is configured to: analyze each type of compilation error, build a compilation error knowledge base, and perform related knowledge point mapping and extract compilation error keywords. The knowledge point mapping is based on the error type and the code information contained in the line of code where the error occurred. The question type feature matrix construction module is configured to: construct the question type feature matrix; The location coding module is configured to: location coding based on time intervals and learning capabilities; The deep knowledge tracing module is configured to input into a trained deep knowledge tracing model to achieve deep knowledge tracing.
Citation Information
Patent Citations
Exercise generation method and system based on differentiated teaching
CN112331003A
Knowledge tracking method and system based on multivariate concept attention model
CN113378581A