An online course recommendation method and system based on big data
Through technical means such as singular value decomposition and multi-head attention mechanism, combined with dynamic search strategies, the problem of insufficient personalization and local optimal solutions in online course recommendation is solved, the recommendation accuracy and interpretability are improved, and the correlation between courses is enhanced. performance and search efficiency.
Patent Information
- Application Number
- CN202410816053.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-06-24
AI Technical Summary
Existing online course recommendation methods have problems such as low personalization, insufficient learning of correlations between courses, weak model interpretability, incomplete loss function design, and insufficient recommendation accuracy, and are prone to falling into local optimal solutions and search Inefficient, inflexible and slow to converge.
Use singular value decomposition for tensor reconstruction, introduce multi-head attention mechanism and residual connection, optimize the calculation process of the course's potential embedding matrix, and design the overall loss function of regularization loss and correlation loss; design dynamic selection through priority update The search strategy adopts spiral search, neighborhood search and adaptive wander search strategies.
It improves the efficiency and recommendation accuracy of the model, enhances the ability to capture correlations between courses, generates recommendation results that are more interpretable, avoids local optimal solutions, improves search efficiency and convergence speed, and increases search flexibility. and globality.
Smart Images

Figure CN118379117B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of course recommendation, and specifically refers to an online course recommendation method and system based on big data. Background Art
[0002] The online course recommendation method is to analyze students' interests and course characteristics through big data mining and analysis technology to achieve personalized and accurate course recommendations. However, the existing online course recommendation methods have problems such as low personalization, insufficient learning of the correlation between courses, weak model interpretability, incomplete loss function design and insufficient recommendation accuracy; the existing online course recommendation methods have problems such as local optimal solutions, low search efficiency, lack of flexibility, slow convergence and over-search problems. Summary of the invention
[0003] In view of the above situation, in order to overcome the defects of the prior art, the present invention provides an online course recommendation method and system based on big data. In view of the problems of low personalization, insufficient learning of the correlation between courses, weak model interpretability, incomplete loss function design and insufficient recommendation accuracy in the existing online course recommendation methods, the present invention uses singular value decomposition for tensor reconstruction to fully mine the potential information hidden in the data, thereby improving the efficiency of the model and the accuracy of recommendation; introduces a multi-head attention mechanism to process the course embedding matrix, which can better capture the correlation between courses; uses residual connection and layer normalization technology to optimize the calculation process of the course potential embedding matrix, thereby improving the training speed and stability of the model; based on the introduction of regularization The overall loss function is designed by combining the reconstruction loss and prediction loss of the optimization loss and correlation loss, so that the recommendation results generated by the model are more explainable; in view of the problems of local optimal solutions, low search efficiency, lack of flexibility, slow convergence speed and over-search problems in existing online course recommendation methods, this scheme designs a dynamic selection search strategy through priority update, so that the search uses different strategies for search at different stages, which increases the search efficiency and convergence speed; three different strategies, spiral search, neighborhood search and adaptive walking search, are designed to meet the needs of global search, local search and balancing global and local search respectively, which improves the diversity and globality of the search, increases the flexibility and randomness of the search, and helps to avoid falling into the local optimal solution.
[0004] The technical solution adopted by the present invention is as follows: The present invention provides an online course recommendation method based on big data, which comprises the following steps:
[0005] Step S1: data collection;
[0006] Step S2: tensor processing;
[0007] Step S3: Building an online course recommendation model;
[0008] Step S4: online course recommendation model parameter search;
[0009] Step S5: Real-time online course recommendation.
[0010] Furthermore, in step S1, the data collection is based on the collection of historical learning data on the online education platform, and the historical learning data includes student data, course data, interaction data and the actual interaction status between students and courses; the student data includes student number, learning goals, learning preferences and cognitive level; the course data includes course number, course learning sequence, course content and teaching teachers; the interaction data includes frequency data of students learning courses, learning time data, pause and drag frequency data, frequency data of interaction with teaching teachers during learning, and interaction time data with teaching teachers during learning; the actual interaction status between students and courses includes interaction and non-interaction; the actual interaction status between students and courses is used as a data label.
[0011] Furthermore, in step S2, the tensor processing specifically includes the following steps:
[0012] Step S21: Data preprocessing, data cleaning, data conversion and data normalization processing are performed on the collected data; data cleaning includes processing noise, duplicate values, missing values and outliers; data conversion is to convert the data into vector form; data normalization is to uniformly scale the numerical range of the data to [0, 1] based on the maximum and minimum normalization method;
[0013] Step S22: construct a tensor, represent the student data and course data as tensors, obtain a student tensor and a course tensor, calculate the student-course interaction degree and the student-teacher interaction degree based on the interaction data, and then represent the student number, course number, student-course interaction degree and student-teacher interaction degree as tensors to obtain an interaction tensor; the dimensions of the student tensor are student number, learning goal, learning preference and cognitive level; the dimensions of the course tensor are course number, course learning sequence, course content and teacher; the dimensions of the interaction tensor are student number, course number, student-course interaction degree and student-teacher interaction degree; the formula used to calculate the student-course interaction degree and the student-teacher interaction degree is as follows:
[0014] ;
[0015] ;
[0016] In the formula, S a,b and E a,bare the student-course interaction degree between the a-th student and the b-th course and the student-teacher interaction degree between the a-th student and the b-th course teacher, a and b are the student number index and course number index, γ1, γ2 and γ3 are the first weight, second weight and third weight, respectively. , and are the frequency data, learning duration data, and pause and drag frequency data of the a-th student learning the b-th course, max{·} is the maximum value function, q a,b is the frequency data of the interaction between the a-th student and the teacher when studying the b-th course, t 1,b ,t a,b and t A,b These are the interaction time data of the 1st, ath and Ath students and the teacher when they study the bth course, and A is the total number of students;
[0017] Step S23: Tensor fusion, based on the connection operation, the student tensor, course tensor and interaction tensor are fused to obtain the student-course tensor; the dimensions of the student-course tensor are student number, learning goal, learning preference, cognitive level, course number, course learning sequence, course content, teaching teacher, student-course interaction degree and student-teacher interaction degree.
[0018] Furthermore, in step S3, the construction of the online course recommendation model specifically includes the following steps:
[0019] Step S31: Calculate the initial recommendation list, including the following steps:
[0020] Step S311: tensor reconstruction. The student-course tensor obtained in step S23 is used as the original student-course tensor. The original student-course tensor is expanded into a matrix along each dimension. Each expanded matrix is subjected to singular value decomposition. The stage parameter of the singular value decomposition is k. The left singular matrix corresponding to each matrix is obtained. A core tensor is constructed based on the original student-course tensor and all left singular matrices. A tensor similar to the original student-course tensor is reconstructed based on the core tensor and the left singular matrix. The reconstructed student-course tensor is expanded along the student number dimension to obtain the student interest matrix D. student ; The formula used is as follows:
[0021] ;
[0022] ;
[0023] Where B is the core tensor, C and are the original student-course tensor and the reconstructed student-course tensor, T is the matrix transpose operator, Z1, Z2 and ZN are the left singular matrices corresponding to the matrices expanded along the 1st, 2nd, and Nth dimensions of the original student-course tensor, respectively. N is the number of dimensions of the original student-course tensor. , , and They are modulus 1 product, modulus 2 product, modulus 3 product and modulus N product;
[0024] Step S312: Design a reconstruction loss function, the formula used is as follows:
[0025] ;
[0026] Where, L cg is the reconstruction loss function, is the square of the F norm of the matrix, β1, β2 and β3 are the reconstruction weight, regularization weight and correlation weight respectively, Z n is the left singular matrix corresponding to the matrix expanded along the nth dimension of the original student-course tensor, n is the dimension index of the original student-course tensor, and Corr(·) is the correlation coefficient;
[0027] Step S313: Initial recommendation list, sorting the courses based on the frequency data of students learning courses in the reconstructed student-course tensor, and generating the initial recommendation list TJ Y ;
[0028] Step S32: Constructing a course latent embedding matrix, including the following steps:
[0029] Step S321: Encode the course sequence information, convert the initial recommendation list into an embedding vector, perform position encoding based on the course learning sequence, add the calculated position encoding to the embedding vector of the corresponding position, and obtain the course embedding matrix KC embed , the formula used is as follows:
[0030] ;
[0031] ;
[0032] ;
[0033] In the formula, TJ embedding is the embedding vector, Embedding (·) is the embedding operation function, pos is the course learning order, d is the dimension of the embedding vector, i is used to control the parity check and has the same dimension as d, sin (·) and cos (·) are the sine function and cosine function respectively, O sin (·) and O cos(·) are sine position coding and cosine position coding respectively;
[0034] Step S322: Multi-head attention mechanism, the formula used is as follows:
[0035] ;
[0036] ;
[0037] In the formula, KC multi is the output matrix of the multi-head attention mechanism, concat(·) is the concatenation function, , and They are the j-th attention head to course embedding matrix KC embed The processed query weight matrix, key weight matrix and value weight matrix, Q j , K j and V j They are the j-th attention head to course embedding matrix KC embed The processed query vector, key vector and value vector, head1, head j and head h are the outputs of the 1st, jth, and hth attention heads respectively, Attention(·) is the attention mechanism function, and W O is the output transformation matrix, j is the attention head index, and h is the number of attention heads in the multi-head attention mechanism;
[0038] Step S323: residual connection, the formula used is as follows:
[0039] ;
[0040] In the formula, KC connect is the residual connection matrix, LayerNorm(·) is the layer normalization function;
[0041] Step S324: Calculate the course potential embedding matrix, using the following formula:
[0042] ;
[0043] In the formula, KC feed is the course latent embedding matrix, ReLu(·) is the activation function, and Linear(·) is the linear mapping function;
[0044] Step S33: Calculate the final recommendation list and use the Softmax function to calculate the student interest matrix D student and the class latent embedding matrix KC feedProcessing is performed to obtain the predicted interaction probability between students and courses, and an interaction threshold is set in advance. Courses with predicted interaction probabilities greater than the interaction threshold are sorted according to the predicted interaction probabilities to generate a final recommendation list. In addition, the predicted interaction status between the courses on the final recommendation list and the students is set to interactive, and the predicted interaction status between the courses not on the final recommendation list and the students is set to non-interactive. The formula used to calculate the predicted interaction probability is as follows:
[0045] ;
[0046] Where P is the predicted interaction probability, W f is the weight matrix, is the element-wise multiplication operator;
[0047] Step S34: Design an overall loss function. Design an overall loss function based on the reconstruction loss and the prediction loss. The formula used is as follows:
[0048] ;
[0049] Where, L zt is the overall loss function, G is the number of courses, g is the course index, and y g and are the predicted interaction state and the actual interaction state respectively, and α is the balance weight.
[0050] Furthermore, in step S4, the online course recommendation model parameter search specifically includes the following steps:
[0051] Step S41: Initialization, based on the singular value decomposition stage parameter k, the number of attention heads h in the multi-head attention mechanism, and the weight matrix W f The search space is established by randomly generating the initial position of the individual in the search space, and the individual position is used as the representative of the online course recommendation model parameters. The loss function of the online course recommendation model established based on the model parameters is used as the fitness value of the corresponding individual position, and the individual position with the lowest fitness value is taken as the global optimal position M. best ;
[0052] Step S42: Dynamically select a search strategy, design three search strategies, and prioritize the three search strategies. c They are all initialized to 1. Before each iterative search, the probability of strategy selection is calculated based on the priority. , based on the strategy selection probability, a search strategy is selected using the roulette wheel selection method to update the individual position. If the fitness value of the global optimal position after the update is less than the fitness value of the global optimal position before the update, the priority of the search strategy used is increased by 1; otherwise, the priority of the search strategy used remains unchanged; the three search strategies are as follows:
[0053] Step S421: spiral search strategy. The spiral search strategy is that each individual randomly updates a dimensional position around a random dimensional position of the global optimal position, and the information used to update the dimensional position comes from other dimensions. The formula used is as follows:
[0054] ;
[0055] ;
[0056] ;
[0057] In the formula, is the position of the wth individual in the vth dimension after updating using the spiral search strategy. h, w, and v are iteration index, individual index, and dimension index, respectively. H is the maximum number of iterations. is the random dimension position of the global optimal position at the hth iteration, f and l are the variable factor and decreasing parameter of the logarithmic spiral curve, respectively. is the random dimensional position of the random individual at the hth iteration, is the random dimensional position of the global worst position at the hth iteration. The global worst position is the position of the individual with the highest fitness value. r1 and r3 are the first and third integers randomly selected from [1, dim]. r2 is the second integer randomly selected from [1, U]. dim is the dimension of the individual position and U is the number of individuals.
[0058] Step S422: Neighborhood search strategy. The neighborhood search strategy is to update each individual position based on the neighborhood position. The formula used is as follows:
[0059] ;
[0060] ;
[0061] ;
[0062] In the formula, is the position of the wth individual in the vth dimension after updating using the neighborhood search strategy, rand(·) is the random number generation function, is the position of the wth individual in the vth dimension at the hth iteration, is the position of the vth dimension of the global optimal position at the hth iteration, yes The neighborhood position of , LY(h) is the neighborhood factor at the hth iteration, is the position of the vth dimension of the random individual at the hth iteration, r4 is the fourth integer randomly selected from [1, U], is the L2 norm;
[0063] Step S423: Adaptive walk search strategy, based on Gaussian random walk strategy and adaptive control step size factor to update each individual position, the formula used is as follows:
[0064] ;
[0065] ;
[0066] ;
[0067] In the formula, is the position of the wth individual in the vth dimension after updating using the adaptive walk search strategy, Gaussion (·) is the Gaussian random walk strategy, σ(h) is the standard deviation at the hth iteration, ω(h) is the adaptive control step size factor at the hth iteration, is the position of the vth dimension of the worst position of the whole play at the hth iteration;
[0068] Step S43: Determine the model parameters, pre-set the fitness threshold, update the individual fitness, and when the fitness value of the global optimal position is lower than the fitness threshold, the model parameters corresponding to the global optimal position are used as the optimal model parameters, and an online course recommendation model is constructed based on the optimal model parameters; otherwise, if the maximum number of iterations is reached, go to step S41; otherwise, go to step S42 to continue the iterative search.
[0069] Furthermore, in step S5, the real-time online course recommendation is based on real-time learning data collected by the online education platform. The real-time learning data includes student data, course data and interaction data. After tensor processing, the real-time learning data is input into the online course recommendation model constructed based on the optimal model parameters, and online courses are recommended to users in real time based on the final recommendation list output by the model.
[0070] The present invention provides an online course recommendation system based on big data, comprising a data acquisition module, a tensor processing module, an online course recommendation model construction module, an online course recommendation model parameter search module and a real-time online course recommendation module;
[0071] The data acquisition module collects historical learning data based on the online education platform and sends the data to the tensor processing module;
[0072] The tensor processing module performs data preprocessing, tensor construction and tensor fusion on the collected data, and sends the data to the online course recommendation model construction module;
[0073] The online course recommendation model construction module uses singular value decomposition to reconstruct tensors, introduces a multi-head attention mechanism to process the course embedding matrix, uses residual connection and layer normalization technology to optimize the calculation process of the course potential embedding matrix, designs an overall loss function based on the reconstruction loss and prediction loss that introduce regularization loss and correlation loss, and sends data to the online course recommendation model parameter search module;
[0074] The online course recommendation model parameter search module dynamically selects the search strategy through priority update design, uses different strategies for search at different stages, designs three strategies of spiral search, neighborhood search and adaptive walking search, respectively targeting the needs of global search, local search and balancing global and local search, and sends the data to the real-time online course recommendation module;
[0075] The real-time online course recommendation module recommends online courses to users in real time based on a final recommendation list output by an online course recommendation model constructed using optimal model parameters.
[0076] The beneficial effects achieved by the present invention using the above scheme are as follows:
[0077] (1) In view of the problems of low personalization, insufficient learning of the correlation between courses, weak model interpretability, incomplete loss function design and insufficient recommendation accuracy in existing online course recommendation methods, this scheme uses singular value decomposition for tensor reconstruction, efficiently reduces the dimension of the original student-course tensor, fully mines the potential information hidden in the data, and improves the efficiency of the model and the accuracy of recommendation; introduces a multi-head attention mechanism to process the course embedding matrix, which can better capture the correlation between courses and improve the accuracy and personalization of the recommendation results; uses residual connection and layer normalization technology to optimize the calculation process of the course potential embedding matrix, and improves the training speed and stability of the model; designs the overall loss function based on the reconstruction loss and prediction loss that introduce regularization loss and correlation loss, and comprehensively considers multiple aspects of the recommendation model, making the recommendation results generated by the model more interpretable.
[0078] (2) In view of the problems of local optimal solutions, low search efficiency, lack of flexibility, slow convergence and over-search in existing online course recommendation methods, this scheme designs a dynamic selection search strategy through priority update, so that different strategies are used in different stages of the search, which improves the search efficiency and convergence speed; three different strategies are designed, namely spiral search, neighborhood search and adaptive walking search, which respectively target the needs of global search, local search and balancing global and local search, improve the diversity and globality of the search, increase the flexibility and randomness of the search, and help avoid falling into the local optimal solution. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] Figure 1 A flowchart of an online course recommendation method based on big data provided by the present invention;
[0080] Figure 2 A schematic diagram of an online course recommendation system based on big data provided by the present invention;
[0081] Figure 3 is a schematic flow chart of step S3;
[0082] Figure 4 It is a schematic diagram of the process of step S4.
[0083] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention. DETAILED DESCRIPTION
[0084] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0085] In the description of the present invention, it should be understood that terms such as “upper”, “lower”, “front”, “back”, “left”, “right”, “top”, “bottom”, “inside” and “outside” indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as limiting the present invention.
[0086] Example 1, see Figure 1 The present invention provides an online course recommendation method based on big data, which comprises the following steps:
[0087] Step S1: Data collection, collecting historical learning data based on the online education platform;
[0088] Step S2: tensor processing, performing data preprocessing, tensor construction and tensor fusion on the collected data;
[0089] Step S3: Build an online course recommendation model, use singular value decomposition to reconstruct tensors, introduce a multi-head attention mechanism to process the course embedding matrix, use residual connection and layer normalization technology to optimize the calculation process of the course potential embedding matrix, and design the overall loss function based on the reconstruction loss and prediction loss that introduce regularization loss and correlation loss;
[0090] Step S4: Parameter search of online course recommendation model. Dynamic selection search strategy is designed through priority update. Different strategies are used for search at different stages. Three strategies, spiral search, neighborhood search and adaptive walking search, are designed to meet the needs of global search, local search and balance global and local search respectively.
[0091] Step S5: Real-time online course recommendation, recommending online courses to users in real time based on the final recommendation list output by the online course recommendation model constructed using the optimal model parameters.
[0092] Example 2, see Figure 1 This embodiment is based on the above embodiment. In step S1, the historical learning data includes student data, course data, interaction data and the actual interaction status between students and courses; the student data includes student number, learning goals, learning preferences and cognitive level; the course data includes course number, course learning sequence, course content and teaching teacher; the interaction data includes frequency data of students learning courses, learning time data, pause and drag frequency data, frequency data of interaction with teaching teacher during learning and interaction time data with teaching teacher during learning; the actual interaction status between students and courses includes interaction and non-interaction; the actual interaction status between students and courses is used as a data label.
[0093] Example 3, see Figure 1 This embodiment is based on the above embodiment. In step S2, the tensor processing specifically includes the following steps:
[0094] Step S21: Data preprocessing, data cleaning, data conversion and data normalization processing are performed on the collected data; data cleaning includes processing noise, duplicate values, missing values and outliers; data conversion is to convert the data into vector form; data normalization is to uniformly scale the numerical range of the data to [0, 1] based on the maximum and minimum normalization method;
[0095] Step S22: construct a tensor, represent the student data and course data as tensors, obtain a student tensor and a course tensor, calculate the student-course interaction degree and the student-teacher interaction degree based on the interaction data, and then represent the student number, course number, student-course interaction degree and student-teacher interaction degree as tensors to obtain an interaction tensor; the dimensions of the student tensor are student number, learning goal, learning preference and cognitive level; the dimensions of the course tensor are course number, course learning sequence, course content and teacher; the dimensions of the interaction tensor are student number, course number, student-course interaction degree and student-teacher interaction degree; the formula used to calculate the student-course interaction degree and the student-teacher interaction degree is as follows:
[0096] ;
[0097] ;
[0098] In the formula, S a,b and E a,b are the student-course interaction degree between the a-th student and the b-th course and the student-teacher interaction degree between the a-th student and the b-th course teacher, a and b are the student number index and course number index, γ1, γ2 and γ3 are the first weight, second weight and third weight, respectively. , and are the frequency data, learning duration data, and pause and drag frequency data of the a-th student learning the b-th course, max{·} is the maximum value function, q a,b is the frequency data of the interaction between the a-th student and the teacher when studying the b-th course, t 1,b ,t a,b and t A,b These are the interaction time data of the 1st, ath and Ath students and the teacher when they study the bth course, and A is the total number of students;
[0099] Step S23: Tensor fusion, based on the connection operation, the student tensor, course tensor and interaction tensor are fused to obtain the student-course tensor; the dimensions of the student-course tensor are student number, learning goal, learning preference, cognitive level, course number, course learning sequence, course content, teaching teacher, student-course interaction degree and student-teacher interaction degree.
[0100] Example 4, see Figure 1 and Figure 3 Based on the above embodiment, in step S3, building an online course recommendation model specifically includes the following steps:
[0101] Step S31: Calculate the initial recommendation list, including the following steps:
[0102] Step S311: tensor reconstruction. The student-course tensor obtained in step S23 is used as the original student-course tensor. The original student-course tensor is expanded into a matrix along each dimension. Each expanded matrix is subjected to singular value decomposition. The stage parameter of the singular value decomposition is k. The left singular matrix corresponding to each matrix is obtained. A core tensor is constructed based on the original student-course tensor and all left singular matrices. A tensor similar to the original student-course tensor is reconstructed based on the core tensor and the left singular matrix. The reconstructed student-course tensor is expanded along the student number dimension to obtain the student interest matrix D. student ; The formula used is as follows:
[0103] ;
[0104] ;
[0105] Where B is the core tensor, C and are the original student-course tensor and the reconstructed student-course tensor, T is the matrix transpose operator, Z1, Z2 and Z N are the left singular matrices corresponding to the matrices expanded along the 1st, 2nd, and Nth dimensions of the original student-course tensor, respectively. N is the number of dimensions of the original student-course tensor. , , and They are modulus 1 product, modulus 2 product, modulus 3 product and modulus N product;
[0106] Step S312: Design a reconstruction loss function, introduce regularization loss and correlation loss to design a reconstruction loss function; the formula used is as follows:
[0107] ;
[0108] Where, L cg is the reconstruction loss function, is the square of the F norm of the matrix, β1, β2 and β3 are the reconstruction weight, regularization weight and correlation weight respectively, Z n is the left singular matrix corresponding to the matrix expanded along the nth dimension of the original student-course tensor, n is the dimension index of the original student-course tensor, and Corr(·) is the correlation coefficient;
[0109] Step S313: Initial recommendation list, sorting the courses based on the frequency data of students learning courses in the reconstructed student-course tensor, and generating the initial recommendation list TJ Y ;
[0110] Step S32: Constructing a course latent embedding matrix, including the following steps:
[0111] Step S321: Encode the course sequence information, convert the initial recommendation list into an embedding vector, perform position encoding based on the course learning sequence, add the calculated position encoding to the embedding vector of the corresponding position, and obtain the course embedding matrix KC embed , the formula used is as follows:
[0112] ;
[0113] ;
[0114] ;
[0115] In the formula, TJ embedding is the embedding vector, Embedding (·) is the embedding operation function, pos is the course learning order, d is the dimension of the embedding vector, i is used to control the parity check and has the same dimension as d, sin (·) and cos (·) are the sine function and cosine function respectively, O sin (·) and O cos (·) are sine position coding and cosine position coding respectively;
[0116] Step S322: Multi-head attention mechanism, course embedding matrix KC embed Perform multi-head attention mechanism processing, the formula used is as follows:
[0117] ;
[0118] ;
[0119] In the formula, KC multi is the output matrix of the multi-head attention mechanism, concat(·) is the concatenation function, , and They are the j-th attention head to course embedding matrix KC embed The processed query weight matrix, key weight matrix and value weight matrix, Q j , K j and V j They are the j-th attention head to course embedding matrix KC embed The processed query vector, key vector and value vector, head1, head j and head h are the outputs of the 1st, jth, and hth attention heads respectively, Attention(·) is the attention mechanism function, and W O is the output transformation matrix, j is the attention head index, and h is the number of attention heads in the multi-head attention mechanism;
[0120] Step S323: residual connection, KC multi Add to KC embed To perform residual connection and perform layer normalization, the formula used is as follows:
[0121] ;
[0122] In the formula, KC connect is the residual connection matrix, LayerNorm(·) is the layer normalization function;
[0123] Step S324: Calculate the course potential embedding matrix. The course potential embedding matrix is obtained by processing the residual connection matrix with a two-layer linear mapping and an activation function. The formula used is as follows:
[0124] ;
[0125] In the formula, KC feed is the course latent embedding matrix, ReLu(·) is the activation function, and Linear(·) is the linear mapping function;
[0126] Step S33: Calculate the final recommendation list and use the Softmax function to calculate the student interest matrix D student and the class latent embedding matrix KC feed Processing is performed to obtain the predicted interaction probability between students and courses, and an interaction threshold is set in advance. Courses with predicted interaction probabilities greater than the interaction threshold are sorted according to the predicted interaction probabilities to generate a final recommendation list. In addition, the predicted interaction status between the courses on the final recommendation list and the students is set to interactive, and the predicted interaction status between the courses not on the final recommendation list and the students is set to non-interactive. The formula used to calculate the predicted interaction probability is as follows:
[0127] ;
[0128] Where P is the predicted interaction probability, W f is the weight matrix, is the element-wise multiplication operator;
[0129] Step S34: Design an overall loss function. Design an overall loss function based on the reconstruction loss and the prediction loss. The formula used is as follows:
[0130] ;
[0131] Where, L zt is the overall loss function, G is the number of courses, g is the course index, and y g and are the predicted interaction state and the actual interaction state respectively, and α is the balance weight.
[0132] By performing the above operations, in view of the problems of low personalization, insufficient learning of the correlation between courses, weak model interpretability, incomplete loss function design and insufficient recommendation accuracy in existing online course recommendation methods, this scheme uses singular value decomposition for tensor reconstruction, efficiently reduces the dimension of the original student-course tensor, fully mines the potential information hidden in the data, and improves the efficiency of the model and the accuracy of recommendation; introduces a multi-head attention mechanism to process the course embedding matrix, which can better capture the correlation between courses and improve the accuracy and personalization of the recommendation results; uses residual connection and layer normalization technology to optimize the calculation process of the course potential embedding matrix, and improves the training speed and stability of the model; designs the overall loss function based on the reconstruction loss and prediction loss that introduce regularization loss and correlation loss, and comprehensively considers multiple aspects of the recommendation model, making the recommendation results generated by the model more interpretable.
[0133] Example 5, see Figure 1 and Figure 4 This embodiment is based on the above embodiment. In step S4, the online course recommendation model parameter search specifically includes the following steps:
[0134] Step S41: Initialization, based on the singular value decomposition stage parameter k, the number of attention heads h in the multi-head attention mechanism, and the weight matrix W f The search space is established by randomly generating the initial position of the individual in the search space, and the individual position is used as the representative of the online course recommendation model parameters. The loss function of the online course recommendation model established based on the model parameters is used as the fitness value of the corresponding individual position, and the individual position with the lowest fitness value is taken as the global optimal position M. best ;
[0135] Step S42: Dynamically select a search strategy and design three search strategies, namely: a spiral search strategy suitable for global search, a neighborhood search strategy suitable for local search, and an adaptive wandering search strategy that balances global search and local search. The priority of the three search strategies is c They are all initialized to 1. Before each iterative search, the probability of strategy selection is calculated based on the priority. , based on the strategy selection probability, a search strategy is selected using the roulette wheel selection method to update the individual position. If the fitness value of the global optimal position after the update is less than the fitness value of the global optimal position before the update, the priority of the search strategy used is increased by 1; otherwise, the priority of the search strategy used remains unchanged; the three search strategies are as follows:
[0136] Step S421: spiral search strategy. The spiral search strategy is that each individual position randomly updates a dimensional position around a random dimensional position of the global optimal position, and the information used to update the dimensional position comes from other dimensions. The formula used is as follows:
[0137] ;
[0138] ;
[0139] ;
[0140] In the formula, is the position of the wth individual in the vth dimension after updating using the spiral search strategy. h, w, and v are iteration index, individual index, and dimension index, respectively. H is the maximum number of iterations. is the random dimension position of the global optimal position at the hth iteration, f and l are the variable factor and decreasing parameter of the logarithmic spiral curve, respectively. is the random dimensional position of the random individual at the hth iteration, is the random dimensional position of the global worst position at the hth iteration. The global worst position is the position of the individual with the highest fitness value. r1 and r3 are the first and third integers randomly selected from [1, dim]. r2 is the second integer randomly selected from [1, U]. dim is the dimension of the individual position and U is the number of individuals.
[0141] Step S422: Neighborhood search strategy. The neighborhood search strategy is to update each individual position based on the neighborhood position. The formula used is as follows:
[0142] ;
[0143] ;
[0144] ;
[0145] In the formula, is the position of the wth individual in the vth dimension after updating using the neighborhood search strategy, rand(·) is the random number generation function, is the position of the wth individual in the vth dimension at the hth iteration, is the position of the vth dimension of the global optimal position at the hth iteration, yes The neighborhood position of , LY(h) is the neighborhood factor at the hth iteration, is the position of the vth dimension of the random individual at the hth iteration, r4 is the fourth integer randomly selected from [1, U], is the L2 norm;
[0146] Step S423: Adaptive walk search strategy, based on Gaussian random walk strategy and adaptive control step size factor to update each individual position, the formula used is as follows:
[0147] ;
[0148] ;
[0149] ;
[0150] In the formula, is the position of the wth individual in the vth dimension after updating using the adaptive walk search strategy, Gaussion (·) is the Gaussian random walk strategy, σ(h) is the standard deviation at the hth iteration, ω(h) is the adaptive control step size factor at the hth iteration, is the position of the vth dimension of the worst position of the whole play at the hth iteration;
[0151] Step S43: Determine the model parameters, pre-set the fitness threshold, update the individual fitness, and when the fitness value of the global optimal position is lower than the fitness threshold, the model parameters corresponding to the global optimal position are used as the optimal model parameters, and an online course recommendation model is constructed based on the optimal model parameters; otherwise, if the maximum number of iterations is reached, go to step S41; otherwise, go to step S42 to continue the iterative search.
[0152] By performing the above operations, in view of the problems of local optimal solutions, low search efficiency, lack of flexibility, slow convergence and over-searching in existing online course recommendation methods, this scheme designs a dynamic selection search strategy through priority update, so that different strategies are used for search at different stages, thereby increasing search efficiency and convergence speed; three different strategies, spiral search, neighborhood search and adaptive walking search, are designed to meet the needs of global search, local search and balancing global and local search respectively, thereby improving the diversity and globality of the search, increasing the flexibility and randomness of the search, and helping to avoid falling into the local optimal solution.
[0153] Example 6, see Figure 1 This embodiment is based on the above embodiment. In step S5, real-time online course recommendation is based on the collection of real-time learning data by the online education platform. The real-time learning data includes student data, course data and interaction data. After tensor processing, the real-time learning data is input into the online course recommendation model constructed based on the optimal model parameters. The final recommendation list output by the model is used to recommend online courses to users in real time.
[0154] Embodiment 7, see Figure 2, this embodiment is based on the above embodiment. The present invention provides an online course recommendation system based on big data, including a data acquisition module, a tensor processing module, a module for building an online course recommendation model, an online course recommendation model parameter search module and a real-time online course recommendation module;
[0155] The data acquisition module collects historical learning data based on the online education platform and sends the data to the tensor processing module;
[0156] The tensor processing module performs data preprocessing, tensor construction and tensor fusion on the collected data, and sends the data to the online course recommendation model construction module;
[0157] The online course recommendation model construction module uses singular value decomposition to reconstruct tensors, introduces a multi-head attention mechanism to process the course embedding matrix, uses residual connection and layer normalization technology to optimize the calculation process of the course potential embedding matrix, designs an overall loss function based on the reconstruction loss and prediction loss that introduce regularization loss and correlation loss, and sends data to the online course recommendation model parameter search module;
[0158] The online course recommendation model parameter search module dynamically selects the search strategy through priority update design, uses different strategies for search at different stages, designs three strategies of spiral search, neighborhood search and adaptive walking search, respectively targeting the needs of global search, local search and balancing global and local search, and sends the data to the real-time online course recommendation module;
[0159] The real-time online course recommendation module recommends online courses to users in real time based on a final recommendation list output by an online course recommendation model constructed using optimal model parameters.
[0160] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0161] While the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that many changes, modifications, substitutions and variations can be made to the embodiments without departing from the principles and spirit of the invention.
[0162] The present invention and its embodiments are described above, and such description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. In short, if ordinary technicians in the field are inspired by it, without departing from the purpose of the invention, they can design a structure and embodiment similar to the technical solution without creativity, which should belong to the protection scope of the present invention.
Claims
1. A method for recommending online courses based on big data, characterized by: The method comprises the following steps: Step S1: data collection; Step S2: tensor processing; Step S3: Build an online course recommendation model, use singular value decomposition to reconstruct tensors, introduce a multi-head attention mechanism to process the course embedding matrix, use residual connection and layer normalization technology to optimize the calculation process of the course potential embedding matrix, and design the overall loss function based on the reconstruction loss and prediction loss that introduce regularization loss and correlation loss; Step S4: Parameter search of online course recommendation model. Dynamic selection search strategy is designed through priority update. Different strategies are used for search at different stages. Three strategies, spiral search, neighborhood search and adaptive walking search, are designed to meet the needs of global search, local search and balance global and local search respectively. Step S5: real-time online course recommendation; In step S3, the construction of the online course recommendation model specifically includes the following steps: Step S31: Calculate the initial recommendation list, including the following steps: Step S311: tensor reconstruction. The student-course tensor obtained in step S23 is used as the original student-course tensor. The original student-course tensor is expanded into a matrix along each dimension. Each expanded matrix is subjected to singular value decomposition. The stage parameter of the singular value decomposition is k. The left singular matrix corresponding to each matrix is obtained. A core tensor is constructed based on the original student-course tensor and all left singular matrices. A tensor similar to the original student-course tensor is reconstructed based on the core tensor and the left singular matrix. The reconstructed student-course tensor is expanded along the student number dimension to obtain the student interest matrix D. student ; The formula used is as follows: ; ; Where B is the core tensor, C and are the original student-course tensor and the reconstructed student-course tensor, T is the matrix transpose operator, Z1, Z2 and Z N are the left singular matrices corresponding to the matrices expanded along the 1st, 2nd, and Nth dimensions of the original student-course tensor, respectively. N is the number of dimensions of the original student-course tensor. , , and They are modulus 1 product, modulus 2 product, modulus 3 product and modulus N product; Step S312: Design a reconstruction loss function, the formula used is as follows: ; Where, L cg is the reconstruction loss function, is the square of the F norm of the matrix, β1, β2 and β3 are the reconstruction weight, regularization weight and correlation weight respectively, Z n is the left singular matrix corresponding to the matrix expanded along the nth dimension of the original student-course tensor, n is the dimension index of the original student-course tensor, and Corr(·) is the correlation coefficient; Step S313: Initial recommendation list, sorting the courses based on the frequency data of students learning courses in the reconstructed student-course tensor, and generating the initial recommendation list TJ Y ; Step S32: constructing a course latent embedding matrix; Step S33: Calculate the final recommendation list and use the Softmax function to calculate the student interest matrix D student and the class latent embedding matrix KC feed Processing is performed to obtain the predicted interaction probability between students and courses, and an interaction threshold is pre-set. Courses with predicted interaction probabilities greater than the interaction threshold are sorted according to the predicted interaction probabilities to generate a final recommendation list. In addition, the predicted interaction status between the courses on the final recommendation list and the students is set to interactive, and the predicted interaction status between the courses not on the final recommendation list and the students is set to non-interactive. The formula used to calculate the predicted interaction probability is as follows: ; Where P is the predicted interaction probability, W f is the weight matrix, is the element-wise multiplication operator; Step S34: Design the overall loss function, the formula used is as follows: ; Where, L zt is the overall loss function, G is the number of courses, g is the course index, and y g and are the predicted interaction state and the actual interaction state, respectively, and α is the balance weight; In step S32, constructing the course potential embedding matrix specifically includes the following steps: Step S321: Encode the course sequence information, convert the initial recommendation list into an embedding vector, perform position encoding based on the course learning sequence, add the calculated position encoding to the embedding vector of the corresponding position, and obtain the course embedding matrix KC embed , the formula used is as follows: ; ; ; In the formula, TJ embedding is the embedding vector, Embedding (·) is the embedding operation function, pos is the course learning order, d is the dimension of the embedding vector, i is used to control the parity check and has the same dimension as d, sin (·) and cos (·) are the sine function and cosine function respectively, O sin (·) and O cos (·) are sine position coding and cosine position coding respectively; Step S322: Multi-head attention mechanism, the formula used is as follows: ; ; In the formula, KC multi is the output matrix of the multi-head attention mechanism, concat(·) is the concatenation function, , and They are the j-th attention head to course embedding matrix KC embed The processed query weight matrix, key weight matrix and value weight matrix, Q j , K j and V j They are the j-th attention head to course embedding matrix KC embed The processed query vector, key vector and value vector, head1, head j and head h are the outputs of the 1st, jth, and hth attention heads respectively, Attention(·) is the attention mechanism function, and W O is the output transformation matrix, j is the attention head index, and h is the number of attention heads in the multi-head attention mechanism; Step S323: residual connection, the formula used is as follows: ; In the formula, KC connect is the residual connection matrix, LayerNorm(·) is the layer normalization function; Step S324: Calculate the course potential embedding matrix, using the following formula: ; In the formula, KC feed is the course latent embedding matrix, ReLu(·) is the activation function, and Linear(·) is the linear mapping function; In step S4, the online course recommendation model parameter search specifically includes the following steps: Step S41: Initialization, based on the singular value decomposition stage parameter k, the number of attention heads h in the multi-head attention mechanism, and the weight matrix W f The search space is established by randomly generating the initial position of the individual in the search space, and the individual position is used as the representative of the online course recommendation model parameters. The loss function of the online course recommendation model established based on the model parameters is used as the fitness value of the corresponding individual position, and the individual position with the lowest fitness value is taken as the global optimal position M. best ; Step S42: Dynamically select a search strategy, design three search strategies, and prioritize the three search strategies. c They are all initialized to 1. Before each iterative search, the probability of strategy selection is calculated based on the priority. , based on the strategy selection probability, a search strategy is selected using the roulette wheel selection method to update the individual position. If the fitness value of the global optimal position after the update is less than the fitness value of the global optimal position before the update, the priority of the search strategy used is increased by 1; otherwise, the priority of the search strategy used remains unchanged; the three search strategies are as follows: Step S421: spiral search strategy, the formula used is as follows: ; ; ; In the formula, is the position of the wth individual in the vth dimension after updating using the spiral search strategy. h, w, and v are iteration index, individual index, and dimension index, respectively. H is the maximum number of iterations. is the random dimension position of the global optimal position at the hth iteration, f and l are the variable factor and decreasing parameter of the logarithmic spiral curve, respectively. is the random dimensional position of the random individual at the hth iteration, is the random dimensional position of the global worst position at the hth iteration. The global worst position is the position of the individual with the highest fitness value. r1 and r3 are the first and third integers randomly selected from [1, dim]. r2 is the second integer randomly selected from [1, U]. dim is the dimension of the individual position and U is the number of individuals. Step S422: Neighborhood search strategy, the formula used is as follows: ; ; ; In the formula, is the position of the wth individual in the vth dimension after updating using the neighborhood search strategy, rand(·) is the random number generation function, is the position of the wth individual in the vth dimension at the hth iteration, is the position of the vth dimension of the global optimal position at the hth iteration, yes The neighborhood position of , LY(h) is the neighborhood factor at the hth iteration, is the position of the vth dimension of the random individual at the hth iteration, r4 is the fourth integer randomly selected from [1, U], is the L2 norm; Step S423: Adaptive wandering search strategy, the formula used is as follows: ; ; ; In the formula, is the position of the wth individual in the vth dimension after updating using the adaptive walk search strategy, Gaussion (·) is the Gaussian random walk strategy, σ(h) is the standard deviation at the hth iteration, ω(h) is the adaptive control step size factor at the hth iteration, is the position of the vth dimension of the worst position of the whole play at the hth iteration; Step S43: Determine the model parameters, pre-set the fitness threshold, update the individual fitness, and when the fitness value of the global optimal position is lower than the fitness threshold, the model parameters corresponding to the global optimal position are used as the optimal model parameters, and the online course recommendation model is constructed based on the optimal model parameters; otherwise, if the maximum number of iterations is reached, go to step S41; otherwise, go to step S42 to continue iterative search; In step S2, the tensor processing specifically includes the following steps: Step S21: Data preprocessing, data cleaning, data conversion and data normalization processing are performed on the collected data; data cleaning includes processing noise, duplicate values, missing values and outliers; data conversion is to convert the data into vector form; data normalization is to uniformly scale the numerical range of the data to [0, 1] based on the maximum and minimum normalization method; Step S22: construct tensors, represent student data and course data as tensors respectively, obtain student tensors and course tensors, calculate the student-course interaction degree and student-teacher interaction degree based on the interaction data, and then represent the student number, course number, student-course interaction degree and student-teacher interaction degree as tensors to obtain the interaction tensor; the formula used to calculate the student-course interaction degree and student-teacher interaction degree is as follows: ; ; In the formula, S a,b and E a,b are the student-course interaction degree between the a-th student and the b-th course and the student-teacher interaction degree between the a-th student and the b-th course teacher, a and b are the student number index and course number index, γ1, γ2 and γ3 are the first weight, second weight and third weight, respectively. , and They are the frequency data, learning duration data, and pause and drag frequency data of the a-th student learning the b-th course, max{·} is the maximum value function, q a,b is the frequency data of the interaction between the a-th student and the teacher when studying the b-th course, t 1,b ,t a,b and t A,b These are the interaction time data of the 1st, ath and Ath students and the teacher when they study the bth course, and A is the total number of students; Step S23: tensor fusion, fusing the student tensor, course tensor and interaction tensor based on the connection operation to obtain the student-course tensor; In step S1, the data collection is based on the collection of historical learning data on the online education platform, and the historical learning data includes student data, course data, interaction data and the actual interaction status between students and courses; the student data includes student number, learning goals, learning preferences and cognitive level; the course data includes course number, course learning sequence, course content and teaching teachers; the interaction data includes frequency data of students learning courses, learning time data, pause and drag frequency data, frequency data of interaction with teaching teachers during learning, and interaction time data with teaching teachers during learning; the actual interaction status between students and courses includes interaction and non-interaction; the actual interaction status between students and courses is used as a data label.
2. The online course recommendation method based on big data according to claim 1, characterized in that: In step S5, the real-time online course recommendation is based on the real-time learning data collected by the online education platform. The real-time learning data includes student data, course data and interaction data. After tensor processing, the real-time learning data is input into the online course recommendation model constructed based on the optimal model parameters, and the online courses are recommended to the user in real time based on the final recommendation list output by the model.
3. An online course recommendation system based on big data, used to implement an online course recommendation method based on big data as described in any one of claims 1-2, characterized in that: It includes a data acquisition module, a tensor processing module, a module for building an online course recommendation model, a module for searching online course recommendation model parameters, and a real-time online course recommendation module.
4. The online course recommendation system based on big data according to claim 3 is characterized by: The data acquisition module collects historical learning data based on the online education platform and sends the data to the tensor processing module; The tensor processing module performs data preprocessing, tensor construction and tensor fusion on the collected data, and sends the data to the online course recommendation model construction module; The online course recommendation model construction module uses singular value decomposition to reconstruct tensors, introduces a multi-head attention mechanism to process the course embedding matrix, uses residual connection and layer normalization technology to optimize the calculation process of the course potential embedding matrix, designs an overall loss function based on the reconstruction loss and prediction loss that introduce regularization loss and correlation loss, and sends data to the online course recommendation model parameter search module; The online course recommendation model parameter search module dynamically selects the search strategy through priority update design, uses different strategies for search at different stages, designs three strategies of spiral search, neighborhood search and adaptive walking search, respectively targeting the needs of global search, local search and balancing global and local search, and sends the data to the real-time online course recommendation module; The real-time online course recommendation module recommends online courses to users in real time based on a final recommendation list output by an online course recommendation model constructed using optimal model parameters.
