An Improved Genetic Algorithm for Multi-Objective Movie Recommendation
By constructing a gene pool using an improved genetic algorithm and combining it with reinforcement learning, a multi-objective movie recommendation method is developed. This method addresses the challenges of optimizing accuracy, diversity, and fairness in existing technologies, achieving multi-objective optimization of movie recommendation and improving user experience and the convergence speed of the genetic algorithm.
Patent Information
- Application Number
- CN202311830302.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-28
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-12-28
AI Technical Summary
Existing movie recommendation algorithms struggle to simultaneously optimize accuracy, diversity, and fairness in movie exposure, resulting in a poor user viewing experience.
An improved genetic algorithm is used to construct a gene pool with high accuracy, diversity, and exposure fairness. Combined with multi-parent crossover and mutation operations of reinforcement learning, a multi-objective movie recommendation method is designed. By adaptively selecting crossover and mutation operators, the evolutionary direction is controlled to improve the recommendation effect.
It effectively improves the accuracy, diversity, and fairness of movie recommendations, enhances the user's viewing experience, and increases the convergence speed and recommendation effect of the genetic algorithm.
Smart Images

Figure CN117786219B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of recommendation method technology, specifically a multi-objective movie recommendation method based on an improved genetic algorithm. Background Technology
[0002] Currently, movie recommendation algorithms are widely used in the field of movie recommendation. These algorithms can recommend movies of interest to users even when faced with information overload. However, most traditional movie recommendation algorithms simply recommend the most accurate movies to users. In reality, improving the diversity of movie recommendations and the fairness of movie exposure are equally important and can significantly enhance the user's viewing experience. Current multi-objective movie recommendation methods rarely consider multiple optimization objectives simultaneously, such as accuracy, diversity, and fairness of movie exposure. Summary of the Invention
[0003] This invention addresses the shortcomings of existing technologies by proposing an improved genetic algorithm for multi-objective movie recommendation. The aim is to achieve recommendations based on multiple metrics, including accuracy, diversity, and fairness of movie exposure, thereby enabling multi-objective recommendations and effectively controlling the direction of evolution to improve the overall movie recommendation performance.
[0004] To achieve the above-mentioned objectives, the present invention adopts the following technical solution:
[0005] The present invention provides an improved multi-objective movie recommendation method based on genetic algorithms, characterized by the following steps:
[0006] Step 1: Obtain a list of movies viewed by M users from the movie website, U = {u1, u2, ..., u...} i ,...,u M}, u i Let u represent the list of movies viewed by the i-th user, and u i ={u i1 ,u i2 ,...,u is ,...,u iS}, where u is This represents the s-th movie viewed by the i-th user; S represents the total number of movies viewed by the user.
[0007] Obtain a movie list D = {d1, d2, ..., d...} consisting of J movies from a movie website. j ,...,d J}, d j This represents the j-th movie;
[0008] Step 2, according to u iThe accuracy of the gene pool b for the i-th user is calculated using the lightGCN method. i Thus, an accuracy gene pool {b1,b2,...,b} is obtained for M users. i ,...,b M};
[0009] Step 3, for D = {d1, d2, ..., d...} j ,...,d J By statistically analyzing the genres included in each film in the list, a genre list F = {f1, f2, ..., f...} is obtained. j ,...,f J}, where f j d represents the j-th movie j The number of types included is determined, and based on F, the C movies with the largest number of types are selected to construct a diversity gene pool F. C ;
[0010] For D = {d1, d2, ..., d...} j ,...,d J The number of times each movie in the list is viewed is counted to obtain the movie exposure list V = {v1, v2, ..., v}. j ,...,v J}, where v j d represents the j-th movie j Number of views;
[0011] Based on V, select C movies with the fewest views to construct a movie exposure fairness gene pool V. C ;
[0012] Sort D in ascending order of page views, and select the top Δ movies to build a low-exposure movie list V. (low) The remaining films constitute the list of highly explicit films. (high) ;
[0013] Step 4: Define the current iteration number as t and initialize t = 1; define the maximum number of evolutions as t. max ;
[0014] Define the N movie recommendation schemes of the i-th user as the t-th generation parent population of the i-th user, denoted as .
[0015] P i t ={p i,1 t ,p i,2 t ,...,p i,n t ,...,p i,Nt}, where p i,n t P represents the parent population of generation t. i t The nth chromosome represents the nth movie recommendation for the i-th user; N represents the population size; and p i,n t ={p i,n,1 t ,p i,n,2 t ,...,p i,n,e t ,...,p i,n,E t}, p i,n,e t p represents the nth chromosome i,n t The e-th gene in the chromosome represents the e-th recommended movie in the n-th movie recommendation scheme for the i-th user, where E represents the gene length of the chromosome.
[0016] Initialize P i t The chromosomes of each of the N / 3 populations in the data are derived from the accuracy gene pool b. i In addition, the chromosomes of each of the N / 3 populations come from the diverse gene pool F. C The remaining N / 3 populations come from the movie exposure fair gene pool W. C Thus completing P i t Initialization;
[0017] Step 5, cross-operation of multiple parent classes:
[0018] Step 5.1 Construct three objective functions for accuracy, diversity, and fairness:
[0019] Step 5.1.1 Construct the accuracy objective function for the i-th user in the t-th round of evolution using equation (1).
[0020]
[0021] In equation (1), It is p i,n t The number of movies accurately recommended in the w (fp)i t It is p i,n t The number of movies not accurately recommended in the report;
[0022] Step 5.1.2 Construct the diversity objective function for the i-th user in the t-th round of evolution using equation (2).
[0023]
[0024] In equation (2), p i,n t The e'th recommended movie in the middle, S represents the difference index, which is obtained by equation (3), and R is p i,n t The number of times the difference index was calculated between each pair of films in the Chinese film database, L (div) It is p i,n t The ratio of the total number of all film categories included in D to the total number of all film categories in D;
[0025]
[0026] In equation (3), and The movies and The types included; || indicates the number of elements in the set;
[0027] Step 5.1.3 Construct the movie fairness objective function for the i-th user in the t-th round of evolution using equation (4).
[0028]
[0029] In equation (4), It is p i,n t V is a low-exposure film list (low) Number of movies, V (high)i t It is p i,n t V is a list of highly explicit films. (high) The number of movies;
[0030] Step 5.2, calculate P i t The accuracy, diversity, and fairness objective function values of each movie recommendation scheme were calculated, and P was obtained. i t The movie recommendation scheme p that maximizes the objective function value with moderate accuracy i,acc t The movie recommendation scheme p that maximizes the diversity objective function value i,div t The movie recommendation scheme p that maximizes the objective function value of movie exposure fairness. i,fair t ;
[0031] Step 5.3: Adaptively obtain the parent population p of the nth crossover in the tth generation using the q-learning algorithm of reinforcement learning. i t,n :
[0032] Step 5.4: Calculate the parent population p of generation t and the nth crossover. i t,n The number of times each movie appears in the g chromosomes is used to sort all the movies in the g chromosomes in descending order according to their frequency of appearance, resulting in the movie list Q of the i-th user after the nth sort at the t-th round of evolution. i t,n ={Q i,1 t,n Q i,2 t,n ,...,Q i,h t,n ,...,Q i,H t,n}, where Q i,h t,n This represents the h-th movie recommended by the i-th user after the n-th sort in the t-th round of evolution, where H is the number of movies; H ≤ g × E;
[0033] Step 5.5, calculate the probability of gene inheritance:
[0034] If Q i,h t,n If the number of occurrences is k, then keep the movie Q. i,h t,n The probability p i t,n,h = (k-1) / g;
[0035] Randomly generate a number r between 0 and 1. If r <p i t,n,h Then get the movie Q i,h t,n Let pos∈[1,E] be the position of the first occurrence of a movie in the g movie recommendation schemes; determine whether the pos-th position in the sub-movie list contains a movie. If it does, then set Q... i,h t,n Store in the alternative movie library; otherwise, store in Q. i,h t,n Store it at position pos in the sub-movie list; if r ≥ p i t,n,h Then directly Q i,h t,n Store in the alternative movie library;
[0036] Step 5.6, follow the process in step 5.5 to process Q. it,n All movies are judged and stored until the number of genes in the sub-movie list reaches E. If the number of genes does not reach E, genes are randomly selected from the candidate movie library to fill the gap until the number reaches E. Thus, a sub-movie list is obtained and used as the nth chromosome in the tth generation subpopulation of the i-th user.
[0037] Step 5.7 is performed N-1 times following the process of steps 5.2-5.6, thus obtaining the t-th generation subpopulation P of the i-th user. i t,o ={p i,1 t,o ,p i,2 t,o ,...,p i,n t,o ,...,p i,N t,o}, where p i,n t,o This represents the nth subchromosome in the t-th generation subpopulation of the i-th user; and p i,n t,o ={p i,n,1 t0 ,p i,n,2 t0 ,...,p i,n,e t0 ,...,p i,n,E t0}, p i,n,e t0 This represents the e-th movie gene in the n-th sub-chromosome obtained by user i through crossover;
[0038] Step 6: Set up three mutation operators with different mutation degrees, and use the q-learning algorithm of reinforcement learning to adaptively select a mutation operator for P. i t,o Mutation operations are performed on each subchromosome in the i-th cell to obtain the t-th generation offspring population P' after the i-th user's mutation. i t,o ;
[0039] Step 7, Elite Strategy Operation:
[0040] Step 7.1, P i t With P' i t,o The population merges to form the merged population P in generation t. i t,o,y According to P i t,o,y The two objective function values for each chromosome, for P it,o,y Perform a fast non-dominated sort and select several chromosomes with high stratified rankings to form a population P'. i t,o,y And P i t,o,y+1 The number of chromosomes in the sample is not less than N;
[0041] Step 7.2, if P' i t,o,y If the number of chromosomes in the population is N, then the parent population P of the t-th generation, which is the i-th user, is directly used. i t+1 If P i t,o,y+1 If the number of chromosomes in the matrix is greater than N, then calculate P'. i t,o,y The crowding distance of each chromosome is calculated, and the top N chromosomes with the largest crowding distance are selected as the parent population P of the t-th generation of the i-th user. i t+1 ;
[0042] Step 8: After assigning t+1 to t, if t>t max Then the t-th max Parental population P i tmax A list of movies corresponding to each chromosome in the chromosome, recommended to the i-th user. i .
[0043] The improved genetic algorithm-based multi-objective movie recommendation method of this invention is characterized in that step 5.3 includes:
[0044] Step 5.3.1: Initialize the reward for the i-th user during the (t-1)-th round of evolution. i t-1 =0, the state of the i-th user in the (t-1)-th round of evolution. i t-1 ={0,0,0};
[0045] Step 5.3.2, based on reward i t-1 and state i t-1 Choose one of the three different crossover operators to form the parent population p of the nth crossover in the tth generation. i t,n :
[0046] Crossover operator 1: Prioritize the recommended solution p i,acc t And from P i t Randomly select g-1 elements that are related to pi,acc t Different movie recommendation schemes;
[0047] Crossover operator 2: Prioritize the recommended solution p i,div t And from P i t Randomly select g-1 elements that are related to p i,div t Different movie recommendation schemes;
[0048] Crossover operator 2: Prioritize the recommended solution p i,fair t And from P i t Randomly select g-1 elements that are related to p i,fair t Different movie recommendation schemes.
[0049] The reward value for the i-th user in the t-th round of evolution is calculated using equation (8). i t :
[0050]
[0051] In equation (1), ω1 and ω2 are two parameters between 0 and 1, and the sum of ω1 and ω2 is less than 1; This represents the center point value of the accuracy objective function for the (t-1)th generation; This represents the center point of the accuracy diversity objective function for the (t-1)th generation; Let represent the center point value of the fairness objective function in the (t-1)th generation; when t=1, let
[0052] f (acc,center)i t p i t The accuracy of the objective function value's center point value, f (div,center)i t p i t The center point value of the diversity objective function value, f (fair,center)i t p i t The center point value of the fairness objective function, and we have:
[0053]
[0054]
[0055]
[0056] The state of the i-th user in the t-th round of evolution is calculated using equations (9)-(11). i t ={state i t,acc ,state i t,div ,state i t,fair}:
[0057]
[0058]
[0059]
[0060] In equations (9)-(11), state i t,acc The state represents the accuracy state value of the i-th user in the t-th round of evolution. i t,div The state represents the diversity state value of the i-th user in the t-th round of evolution. i t,fair This represents the fairness state value of the i-th user in the t-th round of evolution.
[0061] The present invention provides an electronic device, comprising a memory and a processor, wherein the memory is used to store a program that supports the processor in executing the multi-target movie recommendation method, and the processor is configured to execute the program stored in the memory.
[0062] The present invention discloses a computer-readable storage medium on which a computer program is stored, wherein the computer program, when executed by a processor, performs the steps of the multi-target movie recommendation method.
[0063] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0064] 1. This invention can select an appropriate amount of data from massive amounts of data and effectively improve the movie recommendation effect by optimizing three objectives: accuracy, diversity, and fairness of movie exposure.
[0065] 2. This invention initially constructs three movie gene libraries. Traditional movie recommendation methods randomize the initial movie parent population. This invention, by constructing movie gene libraries, generates the initial parent population in a targeted manner from the movie gene libraries, which can increase the convergence speed of the genetic algorithm and improve the movie recommendation effect.
[0066] 3. This invention designs three crossover operators when performing multi-parent crossover operations. Through reinforcement learning, the operators can be adaptively selected, accelerating the convergence of the genetic algorithm and controlling the direction of its evolution. Traditional movie recommendation methods can only recommend movies with high user preferences based on the user's browsing behavior, often ignoring movie diversity and failing to effectively recommend movies with low click-through rates, which is unfair. Existing multi-objective recommendation methods only achieve multiple objectives through weighted summaries, without controlling the direction of evolution. This invention, combining reinforcement learning, not only achieves recommendations with accuracy, diversity, and fairness, but also controls the direction of evolution, enabling personalized recommendations and improving the user experience.
[0067] 4. In this invention, reinforcement learning is used during the mutation operation, which can adaptively select mutation operators, thus accelerating the convergence of the genetic algorithm. Traditional genetic algorithms select only one mutation operator, resulting in slow convergence. This invention combines reinforcement learning with adaptive mutation operator selection, effectively improving the convergence speed of the genetic algorithm and enhancing the movie recommendation effect. Attached Figure Description
[0068] Figure 1 This is a schematic diagram of the main process structure of the present invention. Detailed Implementation
[0069] In this embodiment, an improved genetic algorithm-based multi-objective movie recommendation method is described, such as... Figure 1 As shown, it includes the following steps:
[0070] Step 1: Obtain a list of movies viewed by M users from the movie website, U = {u1, u2, ..., u...} i ,...,u M}, u i Let u represent the list of movies viewed by the i-th user, and u i ={u i1 ,u i2 ,...,u is ,...,u iS}, where u is This represents the s-th movie viewed by the i-th user; S represents the total number of movies viewed by the user.
[0071] Obtain a movie list D = {d1, d2, ..., d...} consisting of J movies from a movie website. j ,...,d J}, d j This represents the j-th movie;
[0072] Step 2, according to u iThe accuracy of the gene pool b for the i-th user is calculated using the lightGCN method. i Thus, an accuracy gene pool {b1,b2,...,b} is obtained for M users. i ,...,b M};
[0073] Step 3, for D = {d1, d2, ..., d...} j ,...,d J By statistically analyzing the genres included in each film in the list, a genre list F = {f1, f2, ..., f...} is obtained. j ,...,f J}, where f j d represents the j-th movie j The number of types included is determined, and based on F, the C movies with the largest number of types are selected to construct a diversity gene pool F. C ;
[0074] For D = {d1, d2, ..., d...} j ,...,d J The number of times each movie in the list is viewed is counted to obtain the movie exposure list V = {v1, v2, ..., v}. j ,...,v J}, where v j d represents the j-th movie j Number of views;
[0075] Based on V, select C movies with the fewest views to construct a movie exposure fairness gene pool V. C ;
[0076] Sort D in ascending order of page views, and select the top Δ movies to build a low-exposure movie list V. (low) The remaining films constitute the list of highly explicit films. (high) ;
[0077] Steps 2 and 3 construct the three required movie gene libraries to initialize the parent population.
[0078] Step 4: Define the current iteration number as t and initialize t = 1; define the maximum number of evolutions as t. max ;
[0079] Define the N movie recommendation schemes of the i-th user as the t-th generation parent population of the i-th user, denoted as .
[0080] P i t ={p i,1 t ,p i,2 t,...,p i,n t ,...,p i,N t}, where p i,n t P represents the parent population of generation t. i t The nth chromosome represents the nth movie recommendation for the i-th user; N represents the population size; and p i,n t ={p i,n,1 t ,p i,n,2 t ,...,p i,n,e t ,...,p i,n,E t}, p i,n,e t p represents the nth chromosome i,n t The e-th gene in the chromosome represents the e-th recommended movie in the n-th movie recommendation scheme for the i-th user, where E represents the gene length of the chromosome.
[0081] Initialize P i t The chromosomes of each of the N / 3 populations in the data are derived from the accuracy gene pool b. i In addition, the chromosomes of each of the N / 3 populations come from the diverse gene pool F. C The remaining N / 3 populations come from the movie exposure fair gene pool W. C Thus completing P i t Initialization;
[0082] Step 4 is to initialize the parent population. The chromosomes in the parent population come from the three movie gene libraries constructed in the early stage. This operation can speed up the convergence speed of the genetic algorithm and improve the movie recommendation effect.
[0083] Step 5, cross-operation of multiple parent classes:
[0084] Step 5.1 Construct three objective functions for accuracy, diversity, and fairness:
[0085] Step 5.1.1 Construct the accuracy objective function for the i-th user in the t-th round of evolution using equation (1).
[0086]
[0087] In equation (1), It is p i,n tThe number of movies accurately recommended in the w (fp)i t It is p i,n t The number of movies not accurately recommended in the report;
[0088] Step 5.1.2 Construct the diversity objective function for the i-th user in the t-th round of evolution using equation (2).
[0089]
[0090] In equation (2), p i,n t The e'th recommended movie in the middle, S represents the difference index, which is obtained by equation (3), and R is p i,n t The number of times the difference index was calculated between each pair of films in the Chinese film database, L (div) It is p i,n t The ratio of the total number of all film categories included in D to the total number of all film categories in D;
[0091]
[0092] In equation (3), and The movies and The types included; || indicates the number of elements in the set;
[0093] Step 5.1.3 Construct the movie fairness objective function for the i-th user in the t-th round of evolution using equation (4).
[0094]
[0095] In equation (4), It is p i,n t V is a low-exposure film list (low) Number of movies, V (high)i t It is p i,n t V is a list of highly explicit films. (high) The number of movies.
[0096] Step 5.2, calculate P i t The accuracy, diversity, and fairness objective function values of each movie recommendation scheme were calculated, and P was obtained. i tThe movie recommendation scheme p that maximizes the objective function value with moderate accuracy i,acc t The movie recommendation scheme p that maximizes the diversity objective function value i,div t The movie recommendation scheme p that maximizes the objective function value of movie exposure fairness. i,fair t .
[0097] Step 5.3: Adaptively obtain the parent population p of the nth crossover in the tth generation using the q-learning algorithm of reinforcement learning. i t,n :
[0098] Step 5.3.1: Initialize the reward for the i-th user during the (t-1)-th round of evolution. i t-1 =0, the state of the i-th user in the (t-1)-th round of evolution. i t-1 ={0,0,0};
[0099] Step 5.3.2, based on reward i t-1 and state i t-1 Choose one of the three different crossover operators to form the parent population p of the nth crossover in the tth generation. i t,n :
[0100] Crossover operator 1: Prioritize the recommended solution p i,acc t And from P i t Randomly select g-1 elements that are related to p i,acc t Different movie recommendation schemes;
[0101] Crossover operator 2: Prioritize the recommended solution p i,div t And from P i t Randomly select g-1 elements that are related to p i,div t Different movie recommendation schemes;
[0102] Crossover operator 2: Prioritize the recommended solution p i,fair t And from P i t Randomly select g-1 elements that are related to p i,fair t Different movie recommendation schemes;
[0103] Step 5.4: Calculate the parent population p of generation t and the nth crossover. i t,n The number of times each movie appears in the g chromosomes is used to sort all the movies in the g chromosomes in descending order according to their frequency of appearance, resulting in the movie list Q of the i-th user after the nth sort at the t-th round of evolution. i t,n ={Q i,1 t,n Q i,2 t,n ,...,Q i,h t,n ,...,Q i,H t,n}, where Q i,h t,n Let H represent the h-th movie recommended by the i-th user after the n-th sort in the t-th round of evolution, where H is the number of movies; H≤g×E.
[0104] Step 5.5, calculate the probability of gene inheritance:
[0105] If Q i,h t,n If the number of occurrences is k, then keep the movie Q. i,h t,n The probability p i t,n,h = (k-1) / g;
[0106] Randomly generate a number r between 0 and 1. If r <p i t,n,h Then get the movie Q i,h t,n Let pos∈[1,E] be the position of the first occurrence of a movie in the g movie recommendation schemes; determine whether the pos-th position in the sub-movie list contains a movie. If it does, then set Q... i,h t,n Store in the alternative movie library; otherwise, store in Q. i,h t,n Store it at position pos in the sub-movie list; if r ≥ p i t,n,h Then directly Q i,h t,n Store in the alternative movie library;
[0107] Step 5.6, follow the process in step 5.5 to process Q. i t,nAll movies are judged and stored until the number of genes in the sub-movie list reaches E. If the number of genes does not reach E, genes are randomly selected from the candidate movie library to fill the gap until the number reaches E. Thus, a sub-movie list is obtained and used as the nth chromosome in the tth generation subpopulation of the i-th user.
[0108] Step 5.7 is performed N-1 times following the process of steps 5.2-5.6, thus obtaining the t-th generation subpopulation P of the i-th user. i t,o ={p i,1 t,o ,p i,2 t,o ,...,p i,n t,o ,...,p i,N t,o}, where p i,n t,o This represents the nth subchromosome in the t-th generation subpopulation of the i-th user; and p i,n t,o ={p i,n,1 t0 ,p i,n,2 t0 ,...,p i,n,e t0 ,...,p i,n,E t0}, p i,n,e t0 This represents the e-th movie gene in the n-th sub-chromosome obtained by user i through crossover.
[0109] Step 5.8 Calculate p using equations (5)-(7) respectively. i t The accuracy of the objective function value's center point value f (acc,center)i t The central point value f of the objective function for diversity (div,center)i t The center point value f of the fairness objective function (fair,center)i t ;
[0110]
[0111]
[0112]
[0113] Step 5.9 Calculate the reward value for the i-th user in the t-th round of evolution using equation (8). i t :
[0114]
[0115] In equation (1), ω1 and ω2 are two parameters between 0 and 1, and the sum of ω1 and ω2 is less than 1; This represents the center point value of the accuracy objective function for the (t-1)th generation; This represents the center point of the accuracy diversity objective function for the (t-1)th generation; Let represent the center point value of the fairness objective function in the (t-1)th generation; when t=1, let
[0116] Step 5.10 Calculate the state of the i-th user in the t-th round of evolution using equations (9)-(11).
[0117] state i t ={state i t,acc ,state i t,div ,state i t,fair}:
[0118]
[0119]
[0120]
[0121] In equations (9)-(11), state i t,acc The state represents the accuracy state value of the i-th user in the t-th round of evolution. i t,div The state represents the diversity state value of the i-th user in the t-th round of evolution. i t,fair This represents the fairness state value of the i-th user in the t-th round of evolution.
[0122] Step 5 involves adaptive multi-parent crossover operations using reinforcement learning. This step initially designs three crossover operators based on seed columns. The three seed columns are the movie recommendation lists with the highest accuracy, the highest diversity, and the highest fairness in each generation. Reinforcement learning adaptively selects the crossover operator, and two hyperparameters, ω1 and ω2, are designed into the reinforcement learning activation function to control the direction of evolution. Traditional movie recommendation genetic algorithms use a single operator in the crossover stage, which cannot adaptively select the most suitable crossover operator for each generation, resulting in slow convergence and no control over the direction of evolution. This invention combines reinforcement learning, selecting the crossover action for each step through activation function values and state values, accelerating convergence. Furthermore, the hyperparameters ω1 and ω2 control the direction of evolution, ultimately achieving personalized movie recommendations and improving the overall movie recommendation effect.
[0123] Step 6: Set up three mutation operators with different mutation degrees, and use the q-learning algorithm of reinforcement learning to adaptively select a mutation operator for P. i t,o Mutation operations are performed on each subchromosome in the i-th cell to obtain the t-th generation offspring population P' after the i-th user's mutation. i t,o ;
[0124] Step 6 involves adaptive mutation operations using reinforcement learning. This step designs different mutation operators based on the degree of mutation, and the adaptive selection of mutation operators using reinforcement learning accelerates the algorithm's convergence. Traditional movie recommendation genetic algorithms use a single mutation operator in the mutation stage. This invention designs multiple mutation operators with varying degrees of mutation, ensuring that the mutation degree of the movie list is not unique for each generation. During each generation's mutation evolution, the mutation operator can be adaptively selected to improve the movie recommendation effect.
[0125] Step 7, Elite Strategy Operation:
[0126] Step 7.1, P i t With P' i t,o The population merges to form the merged population P in generation t. i t,o,y According to P i t,o,y The two objective function values for each chromosome, for P i t,o,y Perform a fast non-dominated sort and select several chromosomes with high stratified rankings to form a population P'. i t,o,y And P i t,o,y+1 The number of chromosomes in the sample is not less than N;
[0127] Step 7.2, if P' i t,o,y If the number of chromosomes in the population is N, then the parent population P of the t-th generation, which is the i-th user, is directly used. i t+1 If P i t,o,y+1 If the number of chromosomes in the matrix is greater than N, then calculate P'. i t,o,y The crowding distance of each chromosome is calculated, and the top N chromosomes with the largest crowding distance are selected as the parent population P of the t-th generation of the i-th user. i t+1 ;
[0128] Step 8: After assigning t+1 to t, if t>t max Then the t-th max Parental population P i tmax A list of movies corresponding to each chromosome in the chromosome, recommended to the i-th user. i .
[0129] Step 7 is the elite strategy phase, where a movie recommendation list for the current generation is selected based on fast non-dominated sorting and crowding distance calculations. This continues until the pre-designed number of evolution iterations t is completed. max Then, a final list of recommended movies is generated.
[0130] In this embodiment, an electronic device includes a memory and a processor. The memory stores a program that supports the processor in executing the above-described method, and the processor is configured to execute the program stored in the memory.
[0131] In this embodiment, a computer-readable storage medium stores a computer program, which is executed by a processor to perform the steps of the above method.
Claims
1. An improved genetic algorithm for multi-objective movie recommendation, characterized in that, Includes the following steps: Step 1: Obtain a list of movies viewed by M users from the movie website, U = {u1, u2, ..., u...} i ,...,u M }, u i Let u represent the list of movies viewed by the i-th user, and u i ={u i1 ,u i2 ,...,u is ,...,u iS }, where u is This represents the s-th movie viewed by the i-th user; S represents the total number of movies viewed by the user. Obtain a movie list D = {d1, d2, ..., d...} consisting of J movies from a movie website. j ,...,d J }, d j This represents the j-th movie; Step 2, according to u i The accuracy of the gene pool b for the i-th user is calculated using the lightGCN method. i Thus, an accuracy gene pool {b1,b2,...,b} is obtained for M users. i ,...,b M }; Step 3, for D = {d1, d2, ..., d...} j ,...,d J By statistically analyzing the genres included in each film in the list, we obtain a genre list F = {f1, f2, ..., f...} j ,...,f J }, where f j d represents the j-th movie j The number of types included is determined, and based on F, the C movies with the largest number of types are selected to construct a diversity gene pool F. C ; For D = {d1, d2, ..., d...} j ,...,d J The number of times each movie in the list is viewed is counted to obtain the movie exposure list V = {v1, v2, ..., v}. j ,...,v J }, where v j d represents the j-th movie j Number of views; Based on V, select C movies with the fewest views to construct a movie exposure fairness gene pool V. C ; Sort D in ascending order of page views, and select the top Δ movies to build a low-exposure movie list V. (low) The remaining films constitute the list of highly explicit films. (high) ; Step 4: Define the current iteration number as t and initialize t = 1; define the maximum number of evolutions as t. max ; Define the N movie recommendation schemes of the i-th user as the t-th generation parent population of the i-th user, denoted as P. i t ={p i,1 t ,p i,2 t ,...,p i,n t ,...,p i,N t }, where p i,n t P represents the parent population of generation t. i t The nth chromosome represents the nth movie recommendation for the i-th user, where N represents the population size; and p i,n t ={p i,n,1 t ,p i,n,2 t ,...,p i,n,e t ,...,p i,n,E t }, p i,n,e t p represents the nth chromosome i,n t The e-th gene in the chromosome represents the e-th recommended movie in the n-th movie recommendation scheme for the i-th user, where E represents the gene length of the chromosome. Initialize P i t The chromosomes of each of the N / 3 populations in the data are derived from the accuracy gene pool b. i In addition, the chromosomes of each of the N / 3 populations come from the diverse gene pool F. C The remaining N / 3 populations come from the movie exposure fair gene pool W. C Thus completing P i t Initialization; Step 5, cross-operation of multiple parent classes: Step 5.1 Construct three objective functions for accuracy, diversity, and fairness: Step 5.1.1 Construct the accuracy objective function for the i-th user in the t-th round of evolution using equation (1). In equation (1), It is p i,n t The number of movies accurately recommended in the w (fp)i t It is p i,n t The number of movies not accurately recommended in the report; Step 5.1.2 Construct the diversity objective function for the i-th user in the t-th round of evolution using equation (2). In equation (2), p i,n t The e'th recommended movie in the middle, S represents the difference index, which is obtained by equation (3), and R is p i,n t The number of times the difference index was calculated between each pair of films in the Chinese film database, L (div) It is p i,n t The ratio of the total number of all film categories included in D to the total number of all film categories in D; In equation (3), and The movies and The types included; || indicates the number of elements in the set; Step 5.1.3 Construct the movie fairness objective function for the i-th user in the t-th round of evolution using equation (4). In equation (4), It is p i,n t V is a low-exposure film list (low) Number of movies, V (high)i t It is p i,n t V is a list of highly explicit films. (high) The number of movies; Step 5.2, calculate P i t The accuracy, diversity, and fairness objective function values of each movie recommendation scheme were calculated, and P was obtained. i t The movie recommendation scheme p that maximizes the objective function value with moderate accuracy i,acc t The movie recommendation scheme p that maximizes the diversity objective function value i,div t The movie recommendation scheme p that maximizes the objective function value of movie exposure fairness. i,fair t ; Step 5.3: Adaptively obtain the parent population p of the nth crossover in the tth generation using the q-learning algorithm of reinforcement learning. i t,n : Step 5.4: Calculate the parent population p of generation t and the nth crossover. i t,n The number of times each movie appears in the g chromosomes is used to sort all the movies in the g chromosomes in descending order according to their frequency of appearance, resulting in the movie list Q of the i-th user after the nth sort at the t-th round of evolution. i t,n ={Q i,1 t,n Q i,2 t,n ,...,Q i,h t,n ,...,Q i,H t,n }, where Q i,h t,n This represents the h-th movie recommended by the i-th user after the n-th sort in the t-th round of evolution, where H is the number of movies; H ≤ g × E; Step 5.5, calculate the probability of gene inheritance: If Q i,h t,n If the number of occurrences is k, then keep the movie Q. i,h t,n The probability p i t,n,h = (k-1) / g; Randomly generate a number r between 0 and 1. If r <p i t,n,h Then get the movie Q i,h t,n Let pos∈[1,E] be the position of the first occurrence of a movie in the g movie recommendation schemes; determine whether the pos-th position in the sub-movie list contains a movie. If it does, then set Q... i,h t,n Store in the alternative movie library; otherwise, store in Q. i,h t,n Store it at position pos in the sub-movie list; if r ≥ p i t,n,h Then directly Q i,h t,n Store in the alternative movie library; Step 5.6, follow the process in step 5.5 to process Q. i t,n All movies are judged and stored until the number of genes in the sub-movie list reaches E. If the number of genes does not reach E, genes are randomly selected from the candidate movie library to fill the gap until the number reaches E. Thus, a sub-movie list is obtained and used as the nth chromosome in the tth generation subpopulation of the i-th user. Step 5.7 is performed N-1 times following the process of steps 5.2-5.6, thus obtaining the t-th generation subpopulation P of the i-th user. i t,o ={p i,1 t,o ,p i,2 t,o ,...,p i,n t,o ,...,p i,N t,o }, where p i,n t,o This represents the nth subchromosome in the tth generation subpopulation of the i-th user; and p i,n t,o ={p i,n,1 t0 ,p i,n,2 t0 ,...,p i,n,e t0 ,...,p i,n,E t0 }, p i,n,e t0 This represents the e-th movie gene in the n-th sub-chromosome obtained by user i through crossover; Step 6: Set up three mutation operators with different mutation degrees, and use the q-learning algorithm of reinforcement learning to adaptively select a mutation operator for P. i t,o Mutation operations are performed on each subchromosome in the i-th cell to obtain the t-th generation offspring population P' after the i-th user's mutation. i t,o ; Step 7, Elite Strategy Operation: Step 7.1, P i t With P' i t,o The population merges to form the merged population P in generation t. i t,o,y According to P i t,o,y The two objective function values for each chromosome, for P i t,o,y Perform a fast non-dominated sort and select several chromosomes with high stratified rankings to form a population P'. i t,o,y And P i t,o,y+1 The number of chromosomes in the sample is not less than N; Step 7.2, if P' i t,o,y If the number of chromosomes in the population is N, then the parent population P of the t-th generation, which is the i-th user, is directly used. i t +1 If P i t,o,y+1 If the number of chromosomes in the matrix is greater than N, then calculate P'. i t,o,y The crowding distance of each chromosome is calculated, and the top N chromosomes with the largest crowding distance are selected as the parent population P of the t-th generation of the i-th user. i t+1 ; Step 8: After assigning t+1 to t, if t>t max Then the t-th max Parental population P i tmax A list of movies corresponding to each chromosome in the chromosome, recommended to the i-th user. i .
2. The multi-objective movie recommendation method based on an improved genetic algorithm according to claim 1, characterized in that, Step 5.3 includes: Step 5.3.1: Initialize the reward for the i-th user during the (t-1)-th round of evolution. i t-1 =0, the state of the i-th user in the (t-1)-th round of evolution. i t-1 ={0,0,0}; Step 5.3.2, based on reward i t-1 and state i t-1 Choose one of the three different crossover operators to form the parent population p of the nth crossover in the tth generation. i t,n : Crossover operator 1: Prioritize the recommended solution p i,acc t And from P i t Randomly select g-1 elements that are related to p i,acc t Different movie recommendation schemes; Crossover operator 2: Prioritize the recommended solution p i,div t And from P i t Randomly select g-1 elements that are related to p i,div t Different movie recommendation schemes; Crossover operator 2: Prioritize the recommended solution p i,fair t And from P i t Randomly select g-1 elements that are related to p i,fair t Different movie recommendation schemes.
3. The multi-objective movie recommendation method based on an improved genetic algorithm according to claim 2, characterized in that, The reward value for the i-th user in the t-th round of evolution is calculated using equation (8). i t : In equation (1), ω1 and ω2 are two parameters between 0 and 1, and the sum of ω1 and ω2 is less than 1; This represents the center point value of the accuracy objective function for the (t-1)th generation; This represents the center point of the accuracy diversity objective function for the (t-1)th generation; Let represent the center point value of the fairness objective function in the (t-1)th generation; when t=1, let f (acc,center)i t p i t The accuracy of the objective function value is the center point value, f (div,center)i t p i t The center point value of the diversity objective function value, f (fair,center)i t p i t The center point value of the fairness objective function, and we have:
4. The multi-objective movie recommendation method based on an improved genetic algorithm according to claim 3, characterized in that, The state of the i-th user in the t-th round of evolution is calculated using equations (9)-(11). i t ={state i t,acc ,state i t,div ,state i t,fair }: In equations (9)-(11), state i t,acc The state represents the accuracy state value of the i-th user in the t-th round of evolution. i t ,div The state represents the diversity state value of the i-th user in the t-th round of evolution. i t,fair This represents the fairness state value of the i-th user in the t-th round of evolution.
5. An electronic device, comprising a memory and a processor, characterized in that, The memory is used to store a program that supports the processor in executing any of the multi-target movie recommendation methods of claims 1-4, the processor being configured to execute the program stored in the memory.
6. A computer-readable storage medium storing a computer program thereon, characterized in that, The computer program, when run by a processor, performs the steps of any of the multi-objective movie recommendation methods described in claims 1-4.
