Programming exercise recommendation method and system based on knowledge tracking and text matching
Through the programming exercise recommendation method based on knowledge tracking and text matching, learners' programming ability and knowledge stages are evaluated in real time, and the problem of inappropriate exercise difficulty in the existing system is solved, which improves the accuracy of recommendations and learners' learning motivation.
Patent Information
- Application Number
- CN202411656169.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-11-19
AI Technical Summary
When recommending programming exercises, the existing programming education system cannot effectively consider the learners' current programming ability and knowledge stage, which leads to the inappropriate difficulty of the recommended exercises, which affects the learners' emotional cognition and learning motivation.
Using a programming exercise recommendation method based on knowledge tracking and text matching, the learner's programming ability and knowledge stage are tracked in real time through the programming ability evaluation model, knowledge stage evaluation module and knowledge tracking model, and programming exercises that meet their abilities and knowledge stages are recommended.
It improves the accuracy of programming exercise recommendations, ensures that the recommended exercise difficulty is suitable for learners, stimulates learners' enthusiasm for self-study, and reduces frustration and the idea of giving up learning.
Smart Images

Figure CN119761361A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a programming exercise recommendation method and system based on knowledge tracking and text matching. Background Art
[0002] With the rapid development of the Internet and the supply and demand of programming talents, programming education has gradually become a basic popular education. Therefore, studying the learning behavior of programming learners, tracking their learning status, and recommending appropriate learning materials for them has become a new field of recommendation exploration and research, known as personalized programming recommendation. The current mainstream recommendation method is to use the POJ (programming online judge) system. In the educational scenario, learners perform programming exercises in an integrated development environment bound to POJ, design algorithms, and submit them to the POJ system for evaluation. The POJ system will then provide learners with real-time feedback and exercise recommendations based on case test analysis.
[0003] Although the benefits of POJ in education are well known, the current systems may only recommend exercises that are suitable for learners in terms of content, without considering whether the learners' current abilities are suitable. This may affect learners' emotional cognition, leading to emotional states such as frustration over time, and even the idea of giving up learning. Therefore, the recommendation model for learners should be able to measure the learners' current learning status and problem-solving ability, find exercises that can be completed with a little effort, and stimulate learners' enthusiasm for self-study.
[0004] In order to adapt programming exercises to students' abilities, knowledge tracing seems to be a feasible method. Knowledge tracing is an application of educational systems that obtains students' interaction behaviors with exercises, models students' knowledge status, and predicts students' mastery of the next exercise. Currently, there are studies on knowledge tracing in various disciplines. However, few studies have explored how to use knowledge tracing to provide recommendations in programming recommendations. Summary of the invention
[0005] The main purpose of the embodiments of the present invention is to propose a programming exercise recommendation method and system based on knowledge tracking and text matching, which can track the learner's current programming ability and the current stage of knowledge learned, and improve the accuracy of the recommendation results.
[0006] To achieve the above object, an embodiment of the present invention provides a programming exercise recommendation method based on knowledge tracking and text matching, comprising:
[0007] The relevant interactive information when learners answer programming exercises and the information of the exercises themselves are input into the programming ability assessment model, and exercises of appropriate difficulty are selected according to the learners' abilities to obtain a first-level recommendation list;
[0008] Input the first-level recommendation list and the exercise library into the programming knowledge stage evaluation module, use the vector text matching method to perform exercise text matching, learn exercises that match the learner's knowledge stage, and obtain a second-level candidate recommendation list;
[0009] The secondary candidate recommendation list is input into the knowledge tracking model, and a tertiary recommendation list is output. According to the tertiary recommendation list, a personalized recommendation plan for the programming learning environment that meets the learner's ability and knowledge stage is determined.
[0010] In some embodiments, the step of inputting the relevant interactive information when the learner answers the programming exercises and the information of the exercises themselves into the programming ability assessment model, selecting exercises of appropriate difficulty according to the learner's ability, and obtaining a first-level recommendation list includes the following steps:
[0011] Perform graph convolution encoding on the solution code text in the interactive information, and encode the exercise number and submission score;
[0012] The solution code text, exercise number, and submission score are embedded and input into the interactive network for deep feature mining to obtain embedded information;
[0013] Inputting the embedded information after interaction into a double-layer LSTM network for training to obtain a model output result;
[0014] Match the model output results with the question bank to obtain a candidate first-level recommendation list;
[0015] Obtaining the first-level recommendation list according to the candidate first-level recommendation list;
[0016] Among them, after the solution code text is embedded, it is split into learner programming knowledge reserve CK and learner programming iteration ability CA, and then the graph embedding of learner programming knowledge reserve CK is obtained through the GraphCodeBert encoding layer. And the graph embedding of learners’ programming iteration ability CA The exercise number N and submission score R are mapped to a continuous vector space by discrete integer indices to form the exercise number embedding e id and submit score embed R ; Finally, e id and e R Respectively and Splicing to obtain learners' programming knowledge reserves including question information and learners’ programming iteration capabilities The calculation formula of the embedding layer can be expressed as:
[0017]
[0018] in, W1, W2 are learnable parameters; symbols represents the splicing operation, i represents the i-th moment;
[0019] Among them, for the embedded information, a hierarchical method is used to extract the corresponding text features, and the expression of the extraction process is:
[0020] H A1 =Encoder l (e A1 )
[0021] H D =Encoder l (e D )
[0022] Among them, H A1 Represents the text features of text A1; H D Represents the text features of the question bank D; Encoder l represents the feature extraction function; e A1 The word embedding representation of the text A1 representing the exercise bank D; e D Represents the word embedding representation of the question bank D.
[0023] In some embodiments, obtaining the first-level recommendation list according to the candidate first-level recommendation list comprises the following steps:
[0024] The vector representing the learner's programming ability output by the double-layer LSTM network and the exercise numbers of the programming exercise library are input into the fully connected layer to obtain the learner's current predicted mastery of each exercise.
[0025] The exercise numbers and corresponding scores are filtered and the exercise numbers in the interval of 0.5-1 are selected and combined to obtain the first-level recommendation list;
[0026] Among them, the calculation formula of the two-layer LSTM network is:
[0027]
[0028] in, represent: represent: and Represents the state of each time step when the learner's programming history answers: Dual LSTM()Represents a two-layer LSTM network.
[0029] In some embodiments, the first-level recommendation list and the exercise library are input into the programming knowledge stage evaluation module, the exercise text is matched using the vector text matching method, and the exercises that match the learner's knowledge stage are learned to obtain the second-level candidate recommendation list, including the following steps:
[0030] Input the ID of the first-level recommendation list and the corresponding exercise text content into the Stella text matching network to obtain a text feature vector;
[0031] Calculate the similarity of text feature vectors;
[0032] The knowledge points in the first-level recommendation list and a number of similar exercises together form the second-level candidate recommendation list.
[0033] In some embodiments, the expression for generating the first-level recommendation list is:
[0034] A1=F(P(1|X h ,q t+1 )),
[0035] Where A1 is a list of k exercise numbers, P is the probability function, and X h is the information input to the input layer, q t+1 is the exercise text for the next time step; F(x) is the filter.
[0036] In some embodiments, the expression for generating the secondary candidate recommendation list A2 is:
[0037] A2=A1∪Top k (S),
[0038] Among them, Top k (S) represents the k exercises most relevant to the given text.
[0039] In some embodiments, the expression for generating the three-level recommendation list is:
[0040] A3=F(KT(A1, Stella(A1))),
[0041] Among them, A3 refers to the exercises recommended to learners, filter(x) is the filter, Stella(x) is the text encoding model, KT(x) is F(P(1|X h ,q t+1 )) is a simplification of the model. The output is the candidate list of exercises output by the knowledge tracking model, and the filtering rule uses the Top_k filtering method.
[0042] Another aspect of the embodiment of the present invention further provides a programming exercise recommendation system based on knowledge tracking and text matching, comprising:
[0043] The first module is used to input the relevant interactive information when learners answer programming exercises and the information of the exercises themselves into the programming ability evaluation model, select exercises of appropriate difficulty according to the learners' abilities, and obtain a first-level recommendation list;
[0044] The second module is used to input the first-level recommendation list and the exercise library into the programming knowledge stage evaluation module, use the vector text matching method to perform exercise text matching, learn exercises that meet the learner's knowledge stage, and obtain a second-level candidate recommendation list;
[0045] The third module is used to input the secondary candidate recommendation list into the knowledge tracking model, output a tertiary recommendation list, and determine a personalized recommendation plan for the programming learning environment that meets the learner's ability and knowledge stage based on the tertiary recommendation list.
[0046] To achieve the above objective, another aspect of an embodiment of the present invention provides an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the above-mentioned method when executing the computer program.
[0047] To achieve the above objective, another aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned method is implemented.
[0048] The embodiment of the present invention also discloses a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above method.
[0049] The embodiments of the present invention include at least the following beneficial effects: the present invention provides a programming exercise recommendation method and system based on knowledge tracking and text matching, which inputs the relevant interactive information when the learner answers the programming exercise and the information of the exercise itself into the programming ability evaluation model, selects exercises of appropriate difficulty according to the learner's ability, and obtains a first-level recommendation list; the first-level recommendation list and the exercise library are input into the programming knowledge stage evaluation module, and the exercise text is matched using the vector text matching method to learn exercises that meet the learner's knowledge stage, and obtain a second-level candidate recommendation list; the second-level candidate recommendation list is input into the knowledge tracking model, and a third-level recommendation list is output, and a personalized recommendation scheme for the programming learning environment that meets the learner's ability and knowledge stage is determined according to the third-level recommendation list. The embodiments of the present invention can track the learner's current programming ability and the current stage of knowledge learned, and improve the accuracy of the recommendation results. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a schematic diagram of an implementation environment provided by an embodiment of the present invention;
[0051] Figure 2 is a flow chart of the overall steps provided by an embodiment of the present invention;
[0052] Figure 3 The information interactive programming knowledge tracking method provided by the embodiment of the present invention is used for programming exercise recommendation function module diagram;
[0053] Figure 4 is a schematic diagram of the structure of a programming capability matching module within a model provided by an embodiment of the present invention;
[0054] Figure 5 It is a structural diagram of a programming knowledge stage matching module within a model provided by an embodiment of the present invention;
[0055] Figure 6 It is a schematic diagram of the overall framework provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present invention. They are only examples of devices and methods consistent with some aspects of the embodiments of the present invention as detailed in the attached claims.
[0057] It is understood that the terms "first", "second", etc. used in the present invention may be used herein to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of the present invention, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0058] The terms "at least one", "multiple", "each", "any", etc. used in the present invention, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.
[0059] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.
[0060] The programming exercise recommendation method and system based on knowledge tracking and text matching provided in the embodiment of the present invention relate to the field of computer technology. The programming exercise recommendation method based on knowledge tracking and text matching provided in the embodiment of the present invention can be applied to a terminal, can also be applied to a server, and can also be software running in a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and a car terminal, etc., but is not limited to this; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network; the software can be an application that implements a programming exercise recommendation method based on knowledge tracking and text matching, etc., but is not limited to the above forms.
[0061] The present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0062] like Figure 1 FIG. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present invention. Figure 1 The implementation environment includes at least one terminal 102 and a server 101. The terminal 102 and the server 101 can be connected to a network wirelessly or wired to complete data transmission and exchange.
[0063] Server 101 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as big data and artificial intelligence platforms.
[0064] In addition, the server 101 can also be a node server in the blockchain network. Blockchain is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm.
[0065] The terminal 102 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc. The terminal 102 may also be a vehicle-mounted terminal of various device types described above, but is not limited thereto. The terminal 102 and the server 101 may be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment of the present invention.
[0066] Based on the example Figure 1In the implementation environment shown, an embodiment of the present invention provides a programming exercise recommendation method based on knowledge tracking and text matching. The following is explained using the example of the programming exercise recommendation method based on knowledge tracking and text matching applied in the server 101. It can be understood that the method can also be applied in the terminal 102.
[0067] Reference Figure 2 , Figure 2 The flowchart of the programming exercise recommendation method based on knowledge tracking and text matching applied to the server provided by the embodiment of the present invention, the execution subject of the method can be any of the aforementioned computer devices (including servers or terminals). Figure 2 , the method may include the following steps:
[0068] The relevant interactive information when learners answer programming exercises and the information of the exercises themselves are input into the programming ability assessment model, and exercises of appropriate difficulty are selected according to the learners' abilities to obtain a first-level recommendation list;
[0069] Input the first-level recommendation list and the exercise library into the programming knowledge stage evaluation module, use the vector text matching method to perform exercise text matching, learn exercises that match the learner's knowledge stage, and obtain a second-level candidate recommendation list;
[0070] The secondary candidate recommendation list is input into the knowledge tracking model, and a tertiary recommendation list is output. According to the tertiary recommendation list, a personalized recommendation plan for the programming learning environment that meets the learner's ability and knowledge stage is determined.
[0071] In some embodiments, the step of inputting the relevant interactive information when the learner answers the programming exercises and the information of the exercises themselves into the programming ability assessment model, selecting exercises of appropriate difficulty according to the learner's ability, and obtaining a first-level recommendation list includes the following steps:
[0072] Perform graph convolution encoding on the solution code text in the interactive information, and encode the exercise number and submission score;
[0073] The solution code text, exercise number, and submission score are embedded and input into the interactive network for deep feature mining to obtain embedded information;
[0074] Inputting the embedded information after interaction into a double-layer LSTM network for training to obtain a model output result;
[0075] Match the model output results with the question bank to obtain a candidate first-level recommendation list;
[0076] Obtaining the first-level recommendation list according to the candidate first-level recommendation list;
[0077] Among them, after the solution code text is embedded, it is split into learner programming knowledge reserve CK and learner programming iteration ability CA, and then the graph embedding of learner programming knowledge reserve CK is obtained through the GraphCodeBert encoding layer. And the graph embedding of learners’ programming iteration ability CA The exercise number N and submission score R are mapped to a continuous vector space by discrete integer indices to form the exercise number embedding e id and submit score embed R ; Finally, e id and e R Respectively and Splicing to obtain learners' programming knowledge reserves including question information and learners’ programming iteration capabilities The calculation formula of the embedding layer can be expressed as:
[0078]
[0079] in, W1, W2 are learnable parameters; symbols represents the splicing operation, i represents the i-th moment;
[0080] Among them, for the embedded information, a hierarchical method is used to extract the corresponding text features, and the expression of the extraction process is:
[0081] H A1 =Encoder l (e A1 )
[0082] H D =Encoder l (e D )
[0083] Among them, H A1 Represents the text features of text A1; H D Represents the text features of the question bank D; Encoder l represents the feature extraction function; e A1 The word embedding representation of the text A1 representing the exercise bank D; e D Represents the word embedding representation of the question bank D.
[0084] In some embodiments, obtaining the first-level recommendation list according to the candidate first-level recommendation list comprises the following steps:
[0085] The vector representing the learner's programming ability output by the double-layer LSTM network and the exercise numbers of the programming exercise library are input into the fully connected layer to obtain the learner's current predicted mastery of each exercise.
[0086] The exercise numbers and corresponding scores are filtered and the exercise numbers in the interval of 0.5-1 are selected and combined to obtain the first-level recommendation list;
[0087] Among them, the calculation formula of the two-layer LSTM network is:
[0088]
[0089] in, represent; represent; and Represents the state of each time step when the learner answers programming questions in history; Dual LSTM() Represents a two-layer LSTM network.
[0090] In some embodiments, the first-level recommendation list and the exercise library are input into the programming knowledge stage evaluation module, the exercise text is matched using the vector text matching method, and the exercises that match the learner's knowledge stage are learned to obtain the second-level candidate recommendation list, including the following steps:
[0091] Input the ID of the first-level recommendation list and the corresponding exercise text content into the Stella text matching network to obtain a text feature vector;
[0092] Calculate the similarity of text feature vectors;
[0093] The knowledge points in the first-level recommendation list and a number of similar exercises together form the second-level candidate recommendation list.
[0094] In some embodiments, the expression for generating the first-level recommendation list is:
[0095] A1=F(P(1|X h ,q t+1 )),
[0096] Where A1 is a list of k exercise numbers, P is the probability function, and X h is the information input to the input layer, q t+1 is the exercise text for the next time step; F(x) is the filter.
[0097] In some embodiments, the expression for generating the secondary candidate recommendation list A2 is:
[0098] A2=A1∪Top k (S),
[0099] Among them, Top k (S) represents the k exercises most relevant to the given text.
[0100] In some embodiments, the expression for generating the three-level recommendation list is:
[0101] A3=F(KT(A1, Stella(A1))),
[0102] Among them, A3 refers to the exercises recommended to learners, filter(x) is the filter, Stella(x) is the text encoding model, KT(x) is F(P(1|X h ,q t+1 )) is a simplification of the model. The output is the candidate list of exercises output by the knowledge tracking model, and the filtering rule uses the Top_k filtering method.
[0103] The implementation process of the present invention is described in detail below using a specific application scenario as an example:
[0104] The present invention is mainly aimed at the problem of exercise recommendation in online programming learning. In the present invention, the exercises recommended to learners have both the explainability of learners' programming ability and the explainability of learners' programming knowledge stage. The explainability of learners' ability is reflected by the submitted code content and submitted score provided by the interaction between learners and exercises, and the explainability of learners' knowledge stage is reflected by the learners' historical learning question text and the predicted solvable exercise text output by the model. Among them, the submitted code text content is divided into various programming languages, and the correct answer is regarded as 1 in the submission score, and the wrong answer is regarded as 0. These feature information can well show the learners' mastery of different types of exercises, and at the same time can capture the learners' learning trajectory, so as to better conduct research on exercise recommendation in real-time online programming learning.
[0105] like Figure 3 As shown, a programming personalized recommendation system based on knowledge tracking and text matching includes the following modules: programming ability assessment module, programming knowledge stage assessment module, and exercise recommendation module.
[0106] The embodiment of the present invention provides a programming personalized recommendation method based on knowledge tracking and text matching, which specifically includes the following steps:
[0107] Feature extraction is performed on the relevant interactive information when learners answer programming exercises and the information of the exercises themselves.
[0108] The processed features are input into the programming ability assessment model, and the learner's ability representation is outputted to match all the exercises in the exercise database, so as to obtain a list of exercises that the learner can solve, i.e., the first-level candidate recommendation list.
[0109] The first-level candidate recommendation list and exercise bank are input into the programming knowledge stage matching module, and the vector text matching and similarity calculation methods are used to obtain the second-level candidate recommendation list that matches the learner's knowledge stage.
[0110] The secondary candidate recommendation list is input into the knowledge tracking model again, and a personalized recommendation scheme that conforms to the programming learning environment is provided to learners through the recommender.
[0111] The interactive information of the learners and the text information of the exercises themselves are first feature extracted before being input into the knowledge tracking model. Feature extraction of the interactive information between learners and exercises refers to obtaining all the solution code texts and corresponding scores submitted by the learners when doing the same programming problem. There are only two types of scores, 0 and 1. In the data cleaning stage, in order to prevent the gradient from disappearing, the embodiment of the present invention encodes it into two values of -1 and 1. In order to better refine the feature information contained in the code of the learner, the embodiment of the present invention decomposes the code submitted by the learner into two parts, one representing the learner's mastery of programming knowledge, and the other representing the embodiment of the learner's problem-solving ability.
[0112] In this embodiment, the embodiment of the present invention uses the GraphCodeBERT programming coding module to vectorize the submitted code text. GraphCodeBERT is a coding model specifically for programming languages. Compared with the traditional AST syntax tree model, GraphCodeBERT can more intuitively represent code text. In the case that there are more than two code texts submitted for all answers to the same exercise, the steps of obtaining code text features in the embodiment of the present invention include:
[0113] The first step is to use the solution code text submitted by the learner at time t as the representation of the learner's programming knowledge reserve CK.
[0114] The second step is to subtract the solution code text submitted by the learner at time t-1 from the solution code text submitted by the learner at time t to obtain the difference code text as the performance of programming iteration ability CA.
[0115] Finally, the representation of programming knowledge reserve CK and the representation of programming iteration ability CA are input into the GraphCodeBERT code text representation model for graph construction and vectorization, and finally the embedding of the learner's programming knowledge reserve is obtained. CK , and embedding learners’ programming iteration capabilities CA .
[0116] In the knowledge tracking KT part of this example, an interactive memory network IMN is included. Compared with models based on a single time series such as DKT, IMN can learn the nonlinear relationship between the interaction between students and exercises. IMN consists of two parts. The first part is an interactive network, and the second part is a two-layer LSTM network. The output of one layer is used as the input of the next layer.
[0117] First, the information of the underlying input layer is input into the embedding layer, and the features of the learner and exercise interaction information obtained are the exercise text embedding e Q , the embedding of learners’ programming knowledge reserve CK , embedding learners’ programming iteration ability CA and submit answer code e R .
[0118] Furthermore, above the embedding layer is an interactive memory network IMN. Through the interactive layer, the deep correlation information between the latent vector at the previous moment and the embedding of the learner's programming knowledge reserve, and the embedding of the latent vector at the previous moment and the embedding of the learner's programming iteration ability are obtained. Then they are input into the two-layer LSTM network together to capture the contextual relationship between the learner's historical learning records and obtain the learner's global knowledge state h at the current moment.
[0119] Furthermore, the learner's global knowledge state and the exercise ID of the exercise bank are embedded through the output layer to obtain the learner's predicted score for the exercise.
[0120] Finally, according to the filter F, the top k items with prediction scores between 0.7 and 0.8 are selected to form a first-level candidate recommendation list A1.
[0121] In summary, the calculation of the knowledge tracking part can be expressed as:
[0122] A1=F(P(1|X h ,q t+1 ))
[0123] Where A1 is a list of k exercise IDs, P is the probability function, and X h is the information input to the input layer, q t+1 is the exercise text for the next time step. F(x) is the filter.
[0124] The recommendation part of this embodiment includes a text matching model, which is divided into two parts. The first part is a coding model based on hierarchical granularity, Stella, and the second part is a cosine similarity calculation method. The steps of the recommendation part are as follows:
[0125] First, it matches several semantically similar exercises from the exercise database. The module input is the exercise ID and exercise text of the filtered first-level candidate recommendation list A1, where the text content can be in multiple natural languages. In this example, the text language is uniformly translated into Chinese.
[0126] In some embodiments, the exercise text is encoded into an embedding vector.
[0127] In some embodiments, the candidate recommendation list embedding is calculated using cosine similarity. A1 Exercise Bank Text Embedding D The distance between the two is used to obtain the similarity score. The score range is 0-1, with 1 being the exact same score, and the score decreases with the degree of text difference.
[0128] In some embodiments, the exercise IDs containing similarity values are input into the filter, and the filter uses the Top_k method to take the first k exercise IDs with the highest similarity scores, and together with the first-level candidate recommendation list A1, form a second-level candidate list A2.
[0129] In this example, the recommended candidate list A2 is input into the KT model again, with the purpose of screening out the list of exercises that match the knowledge stage and have abilities similar to the learner. In the KT model, the previously learned learner's global programming ability state h and the secondary candidate list A2 are input into the fully connected layer again, and the corresponding prediction score is output according to the corresponding exercise id.
[0130] In some embodiments, the exercise ID containing the predicted score is input into the filter, and the first m exercises with predicted scores in the range of 0.8-0.9 are selected to form a three-level candidate recommendation list A3, which is input into the recommender. For learners, exercises with predicted scores close to 0 may cause learners to be completely unable to answer, while exercises close to 1 may be too simple for learners, both of which are not conducive to stimulating learners' learning motivation. After experiments, the score screening standard of the embodiment of the present invention is taken in the range of 0.7-0.8.
[0131] In summary, the calculation of the recommendation part can be expressed as:
[0132] A3=F(KT(A1,Stella(A1)))
[0133] Among them, A3 refers to the number of exercises recommended to learners, filter(x) is the filter, Stella(x) is the text encoding model, KT(x) is F(P(1|X h ,q t+1 )) is a simplification of the model. The output is the candidate list of exercises output by the knowledge tracking model, and the filtering rule uses the Top_k filtering method.
[0134] Thus, the recommendation task is completed.
[0135] like Figure 4 As shown in FIG. 1 , in a programming personalized recommendation system based on knowledge tracking and text matching, the internal structure diagram of the model of the capability matching module includes:
[0136] Input layer. The input layer will input a series of historical data of the interaction between learners and exercises. It contains three categories: exercise number N, learner submitted answer text C, and submission score R.
[0137] Embedding layer. In the embedding layer, the learner’s answer text C is split into two parts: the learner’s programming knowledge reserve CK and the learner’s programming iteration ability CA. Then, the corresponding graph embedding is obtained through the GraphCodeBert encoding layer. The exercise number N and submission score R are mapped to a continuous vector space by discrete integer indices to form the exercise number embedding e id and submit score embed R Finally, e id and e R Respectively and Splicing to obtain learners' programming knowledge reserves including question information and learners’ programming iteration capabilities The calculation formula of the embedding layer can be expressed as:
[0138]
[0139] in, is a learnable parameter. Symbol represents the splicing operation, and i represents the i-th moment.
[0140] Interactive Memory Networks. It is then input into the interactive memory network, first The latent vector h retained by the model at the previous moment is input into the interactive network for interaction. This module can be regarded as enriching the addition of the recursive transformation, integrating additional information while keeping consistent with the original input range. Note that at the first input, since there is no information from the previous moment, the embodiment of the present invention will skip the interactive network module.
[0141] In some embodiments, the present invention converts the latent vector h of the interactive network into the embedding e of the learner's programming knowledge reserve. CK Embedding learners’ programming iteration ability CA Submit answer code R The LSTM network is a time model with memory, which can store the state of each time step when the learner answers the programming history questions. and And retain it to the next time step, so as to predict the learner's knowledge state from both macro and micro aspects. At the same time, LSTM can avoid the problem of gradient explosion compared to RNN model. The double-layer LSTM network is built by two single-layer LSTM in parallel, in order to learn e CK and e CA The feature information of the network is used to ensure the consistency of the feature information division. The calculation of the two-layer LSTM network can be expressed as:
[0142]
[0143] Finally, the output of the two-layer network is unified into a vector, which is the learner's global knowledge state h′ i . h′ i The calculation formula can be expressed as:
[0144]
[0145] like Figure 5 As shown in FIG. 1 , in a programming personalized recommendation system based on knowledge tracking and text matching, the internal structure diagram of the model of the knowledge stage matching module includes:
[0146] Input layer. Through the knowledge tracking model, the embodiment of the present invention can obtain the deep connection between the learner's learning state and exercises, thereby inferring the connection between new exercises and learning state. The embodiment of the present invention obtains the learner's global knowledge state h′ i Embed and concatenate all the exercise IDs in exercise database D, input into a fully connected layer, and output the predicted scores of all exercises Finally, according to the filter F, the first k exercise IDs with predicted scores between 0.7 and 0.8 are selected to form a first-level candidate recommendation list A1.
[0147] The calculation of the first-level candidate recommendation list A1 can be expressed as:
[0148]
[0149] in relu is the activation function, is a learnable parameter, A1 is a list of k exercise IDs, a=0.7, b=0.8.
[0150] Embedding layer. A coding model based on hierarchical granularity. When training such representations, the computational limitations of each exercise text are often unknown. In this case, a rigid fixed-length representation may be too long or too short to be adapted to all exercise texts. Therefore, the embodiment of the present invention uses the Stella text coding model to vectorize the text content. Stella has flexible embedding coding capabilities, can selectively encode a piece of text from coarse-grained to fine-grained, and has almost the same effect as independently trained single-dimensional vector representations. First, the exercise text Q in the candidate recommendation list A1 is A1 and the exercise text Q of exercise bank D D Input to the embedding layer and converted into exercise text e A1 and the exercise text e of exercise bank D D .
[0151] e A1 =Embed(A1)
[0152] e D =Embed(D)
[0153] in, are the word embedding representations of text A1 and exercise bank D respectively, m1 and m2 are the number of words in text A1 and D respectively, and d is the embedding dimension.
[0154] In some embodiments, text features are extracted hierarchically. A1 , e D In this embodiment of the present invention, Matrioshka representation learning is used to obtain feature representations at different levels H A1 , H D , the calculation formula can be expressed as:
[0155] H A1 =Encoder l (e A1 )
[0156] H D =Encoder l (e D )
[0157] The Encoder l is the feature extraction function of a specific layer, and l represents the number of layers.
[0158] Context-aware module. In some embodiments, the embodiment of the present invention inputs the text feature representation into the context-aware module. In this module, the word embedding matrix is first mapped to a query vector, a key vector, and a value vector respectively. The query vector and the key vector are used to calculate the attention score matrix, and the value vector is weighted and summed. The embodiment of the present invention obtains a context-aware word representation. This mechanism can effectively capture the dependency between words and enhance the model's ability to understand semantic information. Subsequently, after processing by a multi-layer self-attention mechanism and a feedforward neural network, the embodiment of the present invention can generate a context-aware representation of the text. Through the self-attention mechanism, the model can flexibly focus on the importance of different parts of the sentence, thereby adaptively adjusting the representation of each word. Finally, the vector is normalized and residually connected to update the feature representation H. A1 , H D The output H after the context-aware module A1 , H D The calculation can be expressed as:
[0159]
[0160] in Aggregate(x) is the feature aggregation layer, is the corresponding context word representation.
[0161] In some embodiments, an average pooling layer is used to convert the word embedding of each text into a vector representation of a fixed dimension, e A1 , e D They are the first-level recommendation list A1 and the final encoding result of the question bank text. The calculation formula can be expressed as:
[0162]
[0163] Similarity calculation. A1 , e D Perform similarity calculation and select
[0164]
[0165] In some embodiments, the present invention uses the Top-k method to filter out the top k exercises IDs with the highest similarity scores from the similarity score set S. Specifically, the present invention sorts the similarity scores and selects the top k exercise IDs, which are recorded as
[0166] Top k (S) = {id1, id2, ..., id k}
[0167] In some embodiments, the embodiments of the present invention combine the first-level candidate recommendation list A1 and the exercise ID obtained by the Top-k method to form a second-level candidate list A2. At this time, the second-level candidate list A2, A2 contains all the exercises in the first-level candidate list and the k exercises that are most relevant to the given text. This method not only enriches the content of the candidate list, but also improves the pertinence and effectiveness of the recommendation, thereby better meeting the needs of learners. Through this comprehensive strategy, learners can obtain more relevant and challenging exercises to promote their learning and improve their programming skills. The calculation of the second-level recommendation list can be expressed as:
[0168] A2=A1∪Top k (S)
[0169] Finally, a list of exercises is constructed based on the predicted probability. The secondary recommendation list is re-entered into the knowledge tracking model KT, and the predicted scores of the exercises in the list are calculated. The first m exercise IDs with scores between a and b are selected from the predicted scores and recorded as A3, indicating exercises that learners can moderately challenge. The calculation of A3 can be expressed as:
[0170]
[0171] Loss function: For more accurate prediction, the knowledge tracking model is trained using the loss function Loss. The embodiment of the present invention uses the cross entropy logarithmic loss to train the model.
[0172] In summary, the recommendation section ends.
[0173] Compared with the prior art, the embodiments of the present invention have the following advantages and beneficial effects: using a knowledge tracking model with programming feature learning ability, by encoding the text features of code answers unique to programming and inputting them into a time-aware sequence model to evaluate the learner's current programming ability; using a text similarity matching model that allows variable vector length, using the Stella model to match exercises with similar knowledge points for the current learner; using multiple indicators to evaluate the model results and optimize the model. This method can effectively take into account the characteristics of the programming field in knowledge tracking and model the learning model of programming learners. It solves problems such as gradient vanishing and coarse feature division granularity, and greatly improves the accuracy of programming exercise recommendations.
[0174] refer to Figure 6 In the overall system framework of the embodiment of the present invention, another aspect of the embodiment of the present invention further provides a programming exercise recommendation system based on knowledge tracking and text matching, including:
[0175] The first module is used to input the relevant interactive information when learners answer programming exercises and the information of the exercises themselves into the programming ability evaluation model, select exercises of appropriate difficulty according to the learners' abilities, and obtain a first-level recommendation list;
[0176] The second module is used to input the first-level recommendation list and the exercise library into the programming knowledge stage evaluation module, use the vector text matching method to perform exercise text matching, learn exercises that meet the learner's knowledge stage, and obtain a second-level candidate recommendation list;
[0177] The third module is used to input the secondary candidate recommendation list into the knowledge tracking model, output a tertiary recommendation list, and determine a personalized recommendation plan for the programming learning environment that meets the learner's ability and knowledge stage based on the tertiary recommendation list.
[0178] It can be understood that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0179] The embodiment of the present invention further provides an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the above-mentioned programming exercise recommendation method based on knowledge tracking and text matching when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0180] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0181] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-mentioned programming exercise recommendation method based on knowledge tracking and text matching.
[0182] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0183] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0184] It should be noted that in various specific embodiments of the present invention, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present invention needs to obtain the user's sensitive personal information, it will obtain the user's separate permission or consent through a pop-up window or jump to a confirmation page, and after clearly obtaining the user's separate permission or consent, it will obtain the necessary user-related data for the normal operation of the embodiment of the present invention.
[0185] The embodiments described in the embodiments of the present invention are intended to more clearly illustrate the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. Those skilled in the art can appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.
[0186] Those skilled in the art will appreciate that the technical solutions shown in the figures do not limit the embodiments of the present invention and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0187] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0188] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0189] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0190] It should be understood that in the present invention, "at least one (item)" refers to one or more, and "plurality" refers to two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can represent: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0191] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0192] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0193] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0194] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including multiple instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store programs.
[0195] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the embodiments of the present invention is not limited thereby. Any modification, equivalent substitution and improvement made by those skilled in the art without departing from the scope and essence of the embodiments of the present invention shall be within the scope of the rights of the embodiments of the present invention.
Claims
1. A programming exercise recommendation method based on knowledge tracking and text matching, characterized in that: The following steps are involved: The relevant interactive information when learners answer programming exercises and the information of the exercises themselves are input into the programming ability assessment model, and exercises of appropriate difficulty are selected according to the learners' abilities to obtain a first-level recommendation list; Input the first-level recommendation list and the exercise library into the programming knowledge stage evaluation module, use the vector text matching method to match the exercise text, learn the exercises that match the learner's knowledge stage, and obtain the second-level candidate recommendation list; The secondary candidate recommendation list is input into the knowledge tracking model, and a tertiary recommendation list is output. According to the tertiary recommendation list, a personalized recommendation plan for the programming learning environment that meets the learner's ability and knowledge stage is determined.
2. A programming exercise recommendation method based on knowledge tracking and text matching according to claim 1, characterized in that: The method of inputting the relevant interactive information when the learner answers the programming exercises and the information of the exercises themselves into the programming ability evaluation model, selecting exercises of appropriate difficulty according to the learner's ability, and obtaining a first-level recommendation list includes the following steps: Perform graph convolution encoding on the solution code text in the interactive information, and encode the exercise number and submission score; The solution code text, exercise number, and submission score are embedded and input into the interactive network for deep feature mining to obtain embedded information; Inputting the embedded information after interaction into a double-layer LSTM network for training to obtain a model output result; Match the model output results with the question bank to obtain a candidate first-level recommendation list; Obtaining the first-level recommendation list according to the candidate first-level recommendation list; Among them, after the solution code text is embedded, it is split into learner programming knowledge reserve CK and learner programming iteration ability CA, and then the graph embedding of learner programming knowledge reserve CK is obtained through the GraphCodeBert encoding layer. And the graph embedding of learners’ programming iteration ability CA The exercise number N and submission score R are mapped to a continuous vector space by discrete integer indices to form the exercise number embedding e id and submit score embed R ; Finally, e id and e R Respectively and Splicing to obtain learners' programming knowledge reserves including question information and learners’ programming iteration capabilities The calculation formula of the embedding layer can be expressed as: in, W1, W2 are learnable parameters; symbols represents the splicing operation, i represents the i-th moment; Among them, for the embedded information, a hierarchical method is used to extract the corresponding text features, and the expression of the extraction process is: H A1 =Encoder l (e A1 ) H D =Encoder l (e D ) Among them, H A1 Represents the text features of text A1; H D Represents the text features of the question bank D; Encoder l represents the feature extraction function; e A1 The word embedding representation of the text A1 representing the exercise bank D; D Represents the word embedding representation of the question bank D.
3. A programming exercise recommendation method based on knowledge tracking and text matching according to claim 2, characterized in that: The step of obtaining the first-level recommendation list according to the candidate first-level recommendation list comprises the following steps: The vector representing the learner's programming ability output by the double-layer LSTM network and the exercise numbers of the programming exercise library are input into the fully connected layer to obtain the learner's current predicted mastery of each exercise. The exercise numbers and corresponding scores are filtered and the exercise numbers in the interval of 0.5-1 are selected and combined to obtain the first-level recommendation list; Among them, the calculation formula of the two-layer LSTM network is: in, represent: represent: and Represents the state of each time step when the learner's programming history answers: Dual LSTM() Represents a two-layer LSTM network.
4. The method for recommending programming exercises based on knowledge tracking and text matching according to claim 1, characterized in that: The first-level recommendation list and the exercise library are input into the programming knowledge stage evaluation module, the exercise text is matched using the vector text matching method, the exercises that meet the learner's knowledge stage are learned, and the second-level candidate recommendation list is obtained, including the following steps: Inputting the ID of the first-level recommendation list and the corresponding exercise text content into the stell a text matching network to obtain a text feature vector; Calculate the similarity of text feature vectors; The knowledge points in the first-level recommendation list and a number of similar exercises together form the second-level candidate recommendation list.
5. The method for recommending programming exercises based on knowledge tracking and text matching according to claim 1, characterized in that: The expression for the generation process of the first-level recommendation list is: A1=F(P(1|X h ,q t+1 )), Where A1 is a list of k exercise numbers, P is the probability function, and X h is the information input to the input layer, q t+1 is the exercise text for the next time step; F(x) is the filter.
6. The method for recommending programming exercises based on knowledge tracking and text matching according to claim 5, characterized in that: The expression for the generation process of the secondary candidate recommendation list A2 is: A2=A1∪Top k (S), Among them, Top k (S) represents the k exercises most relevant to the given text.
7. A programming exercise recommendation method based on knowledge tracking and text matching according to claim 6, characterized in that: The expression for the generation process of the three-level recommendation list is: A3=F(KT(A1, Stella(A1))), Among them, A3 refers to the exercises recommended to learners, filter(x) is the filter, Stella(x) is the text encoding model, KT(x) is F(P(1|X h ,q t+1 )) is a simplification of the model. The output is the candidate list of exercises output by the knowledge tracking model, and the filtering rule uses the Top_k filtering method.
8. A programming exercise recommendation system based on knowledge tracking and text matching, characterized in that: include: The first module is used to input the relevant interactive information when learners answer programming exercises and the information of the exercises themselves into the programming ability evaluation model, select exercises of appropriate difficulty according to the learners' abilities, and obtain a first-level recommendation list; The second module is used to input the first-level recommendation list and the exercise library into the programming knowledge stage evaluation module, use the vector text matching method to perform exercise text matching, learn exercises that meet the learner's knowledge stage, and obtain a second-level candidate recommendation list; The third module is used to input the secondary candidate recommendation list into the knowledge tracking model, output a tertiary recommendation list, and determine a personalized recommendation plan for the programming learning environment that meets the learner's ability and knowledge stage based on the tertiary recommendation list.
9. An electronic device, characterized in that: including a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The storage medium stores a program, and the program is executed by a processor to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Test question recommendation method and device, electronic equipment and storage medium
CN113837910A
Personalized exercise recommendation method and system based on knowledge tracking
CN118277663A