CN115309980A - Intelligent collaborative filtering recommendation method based on whale optimized BP neural network - Google Patents

Intelligent collaborative filtering recommendation method based on whale optimized BP neural network Download PDF

Info

Publication number
CN115309980A
CN115309980A CN202210839238.8A CN202210839238A CN115309980A CN 115309980 A CN115309980 A CN 115309980A CN 202210839238 A CN202210839238 A CN 202210839238A CN 115309980 A CN115309980 A CN 115309980A
Authority
CN
China
Prior art keywords
scoring
whale
target user
neural network
users
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210839238.8A
Other languages
Chinese (zh)
Inventor
孙梦觉
田园
范培忠
汤吕
李思阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Information Center of Yunnan Power Grid Co Ltd
Original Assignee
Information Center of Yunnan Power Grid Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Information Center of Yunnan Power Grid Co Ltd filed Critical Information Center of Yunnan Power Grid Co Ltd
Priority to CN202210839238.8A priority Critical patent/CN115309980A/en
Publication of CN115309980A publication Critical patent/CN115309980A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9535Search customisation based on user profiles and personalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9536Search customisation based on social or collaborative filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/004Artificial life, i.e. computing arrangements simulating life
    • G06N3/006Artificial life, i.e. computing arrangements simulating life based on simulated virtual individual or collective life forms, e.g. social simulations or particle swarm optimisation [PSO]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Abstract

The invention relates to a collaborative filtering intelligent recommendation method based on whale BP neural network optimization, and belongs to the technical field of artificial intelligence recommendation. The optimization algorithm of whales is improved, tent chaotic mapping is added on the basis of the original whale algorithm to expand the diversity of populations and increase the possibility of optimizing, and in addition, a Levy flight strategy is added to prevent local convergence and improve the optimizing precision. Secondly, the improved whale algorithm is used for optimizing the weight and threshold of the BP neural network, and the training set is used for training the IWOA-BP scoring prediction model. And then, calculating the scoring errors of the same characteristic items between other users and a random target user according to the model, and selecting a neighbor set of the target user according to an error similarity function. And finally, collecting historical score records of neighbor users in the neighbor set to predict the score of the target user so as to realize recommendation. The method effectively improves the stability and precision of intelligent recommendation.

Description

Intelligent collaborative filtering recommendation method based on whale optimized BP neural network
Technical Field
The invention relates to a collaborative filtering intelligent recommendation method based on whale BP neural network optimization, and belongs to the technical field of artificial intelligence recommendation.
Background
At present of rapid development of internet economy and artificial intelligence, various services of a modern power supply service system facing users increasingly tend to be intelligent, and in order to provide more intelligent and convenient services for the users, an intelligent recommendation service system taking the users as the center is constructed to become a key ring for development and reform. Numerous APPs in life provide a large number of functions for users to select and use, but the functions of each APP are various, in order to enable the users to use more conveniently, recommendation functions are recommended according to the needs of the users, and an effective method for increasing the satisfaction degree of the users is provided. Selecting an effective recommendation algorithm is the key to improve the user satisfaction and the use experience.
Disclosure of Invention
The invention aims to solve the technical problem of providing a collaborative filtering intelligent recommendation algorithm based on whale optimization BP neural network, which is used for solving the problems of low recommendation precision and poor recommendation quality of the traditional intelligent recommendation algorithm.
The technical scheme of the invention is as follows: a collaborative filtering intelligent recommendation method based on whale optimization BP neural network firstly improves whale optimization algorithm, tent chaotic mapping is added on the basis of original whale algorithm to expand population diversity and increase optimization possibility, and furthermore, levy flight strategy is added to prevent local convergence and improve optimization accuracy. Secondly, the improved whale algorithm is used for optimizing the weight and threshold of the BP neural network, and the training set is used for training the IWOA-BP scoring prediction model. And then, calculating the scoring errors of the same characteristic items between other users and a random target user according to the model, and selecting a neighbor set of the target user according to an error similarity function. And finally, collecting historical score records of neighbor users in the neighbor set to predict the score of the target user so as to realize recommendation.
The method comprises the following specific steps:
step1: firstly, tent chaotic mapping is added into an original whale optimization algorithm, the population diversity of the original algorithm is improved, and the search space is expanded. And then, a Levy flight strategy is added into the improved algorithm, so that local optimum is prevented, and convergence is accelerated. An improved whale optimization algorithm is obtained by adding the above strategy. (Improved white Optimization Algorithm, IWOA). Initializing an improved algorithm and BP neural network parameters, and setting the number n, q, m of neurons corresponding to an input layer, a hidden layer and an output layer and an activation function of each layer. And preparing for optimizing the BP neural network by the improved whale algorithm.
Step2: updating the position vector IWOAX of whale j according to the improved whale algorithm in Step1 j And updating by a BP neural network iterative formula to obtain a new particle position vector BPX j . In preparation for later calculation of the fitness value.
Step3: calculating IWOAX according to the particle position vector obtained in Step2 j And BPX j The position vector having the smaller fitness value is updated to a new position vector. And then, calculating a global fitness value f (Pg) of a new position vector, comparing the global fitness value f (Pg) with the set error precision, if the global fitness value is greater than the error precision, continuing iteration from Step2 until optimal particles are obtained when the global fitness value is less than the error precision, ending iteration updating, and at the moment, optimizing the weight value and the threshold value of the BP neural network.
Step4: collecting a data set from the CSDN, dividing the data set into a training set and a testing set, and according to the following steps of 9: 1. 7:3 or 5: and 5, dividing the training set and the test set according to the proportion, then calculating the matrix sparsity, and selecting the proportion corresponding to the minimum matrix sparsity as the most suitable division proportion. And importing the divided training set data into an IWOA-BP scoring prediction model, and testing the model by using a test set until the scoring model is established.
And training the IWOA-BP scoring prediction model by adopting data in the training set until the scoring model is established.
Step5: according to the model building process of Step1-Step4, an IWOA-BP score prediction model needs to be built for each user in a test set because the project characteristics of different users are not necessarily the same.
Step6: and applying the established scoring prediction model to a collaborative filtering recommendation algorithm based on neighbor users, randomly selecting a target user, collecting a real historical scoring record of the target user and the same project characteristics of other users in a training set and the target user, performing scoring prediction according to the corresponding IWOA-BP scoring prediction model to obtain a predicted score, calculating the scoring error of the target user and other users, calculating the similarity according to an error similarity function, selecting k users with the closest similarity as neighbor sets, and generating a neighbor set Tu.
Step7: collecting historical scoring records of users in a neighbor set, carrying out scoring prediction on a target user through a corresponding IWOA-BP scoring prediction model according to characteristic items of historical scoring of the users in the neighbor set, recommending the item when the predictive scoring is high, not recommending when the predictive scoring is low, and finally visually comparing the performance of the algorithm through average absolute errors.
The Step1 is specifically as follows:
step1.1: adding Tent chaotic mapping into an original whale algorithm, performing population initialization to improve population diversity and expand a search space, and specifically comprising the following steps of:
Figure BDA0003750189070000021
Figure BDA0003750189070000022
wherein i represents the population number, k represents the current iteration number, y i k Is a chaotic sequence from 0 to 1, and further generates a whale individual initial position sequence x in the search area i k ,ub and lb are each the sequence x i k The maximum and minimum values of (c).
Step1.2: on the basis of adding the Ten chaotic mapping, a Levy flight strategy is added into the algorithm, and the algorithm is prevented from falling into local optimum and premature convergence by disturbing in the generation process of a candidate solution through Levy flight. The update iteration process of the original whale algorithm is represented as:
D=|C·X rand -X(t)| (3)
X(t+1)=X rand (t)-A·D (4)
wherein, X rand (t) represents a random position vector, C and A are coefficient vectors for controlling the behavior of whale, D represents the positions of the current solution and the optimal solution, and X (t + 1) represents a position vector of the update candidate solution.
After the Levy flight strategy is added, the new candidate solution position update formula is changed from formula (4) to formula (5):
Figure BDA0003750189070000031
wherein, X l (t) represents the current position of the candidate solution after updating, levy (lambda) refers to a random exploration path, and alpha represents a step control factor.
Step1.3: when setting the parameters of the BP neural network, the number n of neurons in an input layer is consistent with the characteristic number of items in a data set, for example, in a movie data set, the number n of neurons in the input layer is the same as the type of a movie, the number m of neurons in an output layer is 1, the number q of neurons in a hidden layer can change in different data sets, different q are set for experiments under the condition that both n and m in the same data set are determined values, and the number of q in the experiment with the minimum error is the number q of neurons in the hidden layer.
In addition, when information is transmitted into a BP neural network, each layer needs to be activated by an activation function, the activation function of an input and output layer is set to be an identity function f (x) = x, different activation functions are often adopted by a hidden layer in order to process some non-linear problems, the invention adopts a Sigmoid activation function, and the hidden layer activation function of the Sigmoid activation function is set to be an expression (6):
Figure BDA0003750189070000032
the mapping range of the function is between 0 and 1. And the derivation is simpler.
The Step2 specifically comprises the following steps:
step2.1: the improved whale algorithm is updated according to the standard of a greedy strategy, the optimal position vector is reserved, and the next iteration is carried out until the position vector of the optimal whale j is updated, wherein the updating iteration is represented as:
Figure BDA0003750189070000033
wherein, X l (t) represents the current position of the updated candidate solution, X (t) represents the position of the original candidate solution, the fitness value of the candidate solution is calculated, if the fitness value is small, the candidate solution is kept as the position of the original candidate solution to continue iteration until the iteration times are reached, the whole updating iteration process is ended, and the position vector IWOAX of the optimal whale j is generated j
Step2.2: the update iteration mode of the BP neural network can be expressed as:
W jk (r+1)=W jk (r)+αε k z jo (8)
θ k (r+1)=θ k (r)+βε k (9)
V ij (r+1)=V ij (r)+αε j x io (10)
θ j (r+1)=θ j (r)+βε j (11)
wherein r represents the iteration number, alpha represents the gradient descending step length, beta represents the learning factor, and the value ranges of the two are [0,1 ]]ε represents the output error of the neuron, z jo And x jo Then is the input, W, resulting from activation of the two-layer activation function jk (r + 1) represents the updated weight of the jth neuron of the input layer to the kth neuron of the hidden layer, theta k (r + 1) denotes the threshold, V, for the k-th neuron update of the hidden layer ij (r + 1) is expressed as the weight of the jth neuron of the hidden layer to the output layer update, theta i (r + 1) represents the threshold for the jth neuron update of the hidden layer.
And finally obtaining the BP neural network with the optimal weight threshold value through updating iteration of the weight threshold value layer by layer.
The Step3 specifically comprises the following steps of:
Figure BDA0003750189070000041
wherein n is j Representing the number of training samples, X i Is the location of the ith individual whale, θ it Is the ith individual in a sample set n j The final output value, O, of the middle-to-th training sample it Indicating the expected output result.
And comparing the calculated global fitness value with the set error precision of 0.001, obtaining the optimal particle until the global fitness value is smaller than the error precision, and ending the iterative updating, wherein the weight and the threshold of the BP neural network are optimal.
In Step4, the matrix sparsity calculation specifically includes:
Figure BDA0003750189070000042
wherein h represents the number of historical scoring records in the training set, j represents the total number of users in the training set, and k represents the total number of feature items in the training set.
The proportion of the test set in the training set is 9: 1. 7:3 or 5:5, the corresponding matrix sparsity is obtained through proportion division, the smaller the matrix sparsity is, the more data are, and the higher the scoring precision is, so the proportion with the minimum matrix sparsity is selected as the division proportion of the invention, and then the training set is used for training an IWOA-BP scoring prediction model.
The generation mode of the neighbor set in Step6 specifically comprises the following steps:
step6.1: randomly selecting a target user, collecting the real historical scoring record of the target user randomly and the characteristic items of other users in the training set, which are the same as the target user, and expressing the characteristic items as lambda by a set u = (u, p, pointu, p), u is user number, p is item number, point u,p The user u is scored for the item p.
Step6.2: according to the characteristic items of different data sets, such as the types of movies, books and music, a project characteristic vector matrix is written, and is represented as follows:
Figure BDA0003750189070000051
wherein, when m n,j When the number is equal to 1, the nth item has the jth item characteristic, and if the number is 0, the jth item does not have the item characteristic.
Step6.3: carrying out scoring prediction on the same characteristic items of other users and the target user by using an IWOA-BP scoring prediction model, and calculating scoring errors of the target user and the other users, wherein the error calculation mode is expressed as follows:
e w,u =p w,vu,v (15)
Figure BDA0003750189070000052
wherein λ is u,v Represents the actual rating, P, of the target user u for the item v w,v Representing the predicted rating of a user w for a project v, e w,u Then represents P w,v And λ u,v The error of (a), represents the number of elements in the user's history score, E w,u Indicating the total item scoring error.
Step6.4: and (4) obtaining all the item scoring errors according to Step6.3, and calculating the similarity values of the target user and other users, wherein the error similarity function is expressed as:
Figure BDA0003750189070000053
and k is a constant of a positive integer, and as can be known from formula (11), when the value of k is fixed, the larger the historical score error between the neighbor user and the target user is, the smaller the similarity between the target user and the neighbor user is, otherwise, the larger the similarity is, the similarity is sorted in a descending order, and the top k users are taken to generate the neighbor set Tu.
In Step7, the scoring prediction of the target user through the corresponding IWOA-BP scoring prediction model specifically comprises the following steps:
the prediction score of the target user u for the item v is expressed as:
Figure BDA0003750189070000054
wherein, the first and the second end of the pipe are connected with each other,
Figure BDA0003750189070000055
average number, λ, representing the historical score of the target user u,v Representing the value of the credit to item v by the neighbour user w,
Figure BDA0003750189070000056
average value representing the historical score of a neighbour user, S u,w The error similarity value is indicated.
And after the prediction score of the feature item corresponding to the target user is calculated, recommending the feature item by taking 1 to 5 as a standard and exceeding 4 points, or not recommending the feature item. Compared with the traditional intelligent recommendation based on users and projects, the intelligent recommendation based on the neighbor users has higher recommendation precision and stability.
After recommendation is completed, the advantages of the IWOA-BP based collaborative filtering intelligent recommendation method cannot be visually seen only from scoring, a comparison test is carried out on the advantages of the IWOA-BP based collaborative filtering intelligent recommendation method, an intelligent recommendation algorithm based on a BP neural network and an intelligent recommendation algorithm based on a particle swarm optimization BP neural network, the test takes Mean Absolute Error (MAE) as an evaluation index, and the advantages of the algorithms are visually displayed through comparison of the three algorithms, wherein the average absolute error is expressed as:
Figure BDA0003750189070000061
wherein p is ui Representing the actual rating of item i by target user u,
Figure BDA0003750189070000062
representing the predicted score of the target user u for item i, | n | representing the number of test sets.
In the prior art, a score prediction model established by a BP neural network-based collaborative filtering recommendation algorithm and a particle swarm optimization-based BP neural network collaborative filtering recommendation algorithm is poor in stability and low in precision. When recommendation is performed according to the scores, a collaborative filtering algorithm based on the BP neural network and the particle swarm optimization BP neural network adopts a user recommendation-based method, and data sparseness is caused due to the loss of characteristic items of the method, so that prediction deviation occurs.
Therefore, the collaborative filtering intelligent recommendation method based on whale optimization BP neural network improves whale optimization algorithm to optimize weight and threshold of BP neural network, expands diversity of search space and population, and enables scoring of the scoring prediction model to be more accurate and to be better in stability. When recommendation is performed, a method based on neighbor set user recommendation is adopted, and the problem of data sparsity caused by feature item loss is effectively solved.
The beneficial effects of the invention are: according to the method, a meta-heuristic algorithm and a machine learning algorithm are combined, the weight and the threshold of a BP neural network are optimized by fully considering the characteristics of fast convergence and good optimizing effect of a whale optimization algorithm, a neighbor set user scoring record is creatively added on the basis of user scoring, and scoring prediction is carried out on a target user by using the historical scoring of neighbor set users. The algorithm greatly improves the recommendation precision and recommendation quality and increases the satisfaction degree of the user in using various functions of the internet.
Drawings
FIG. 1 is a flow chart of the steps of the present invention;
FIG. 2 is a graph showing the variation of the error of the PSO-BP score in the embodiment of the present invention;
FIG. 3 is a graph showing the variation of the IWOA-BP scoring error in the embodiment of the present invention;
FIG. 4 is a graph of the variation of BP score error in an embodiment of the present invention;
FIG. 5 is a plot of average absolute error contrast for an embodiment of the present invention;
FIG. 6 is a user rating table in an embodiment of the present invention;
FIG. 7 is a table of function information in an embodiment of the present invention;
fig. 8 is a user information table in the embodiment of the present invention.
Detailed Description
The invention is further described with reference to the following drawings and detailed description.
Embodiment 1, as shown in fig. 1, a collaborative filtering intelligent recommendation method based on whale optimization BP neural network includes the following specific steps:
step1: firstly, tent chaotic mapping is added into an original whale optimization algorithm, so that the population diversity of the original algorithm is improved, and the search space is expanded. And then a Levy flight strategy is added into the improved algorithm, so that the situation of falling into local optimum is prevented, and convergence is accelerated. An improved whale optimization algorithm is obtained by adding the above strategy. (Improved white Optimization Algorithm, IWOA). Initializing an improved algorithm and BP neural network parameters, and setting the number n, q, m of neurons corresponding to an input layer, a hidden layer and an output layer and an activation function of each layer. Preparation is made for optimizing the BP neural network by a whale algorithm improved next.
Step2: updating the position vector IWOAX of whale j according to the improved whale algorithm in Step1 j And updating by a BP neural network iterative formula to obtain a new particle position vector BPX j . Provision is made for calculating the fitness value afterwards.
Step3: calculating IWOAX according to the particle position vector obtained in Step2 j And BPX j Updating the position vector with small fitness value to a new bitAnd (5) setting a vector. And then, calculating a global fitness value f (Pg) of a new position vector, comparing the global fitness value f (Pg) with the set error precision, if the global fitness value is greater than the error precision, continuing iteration from Step2 until optimal particles are obtained when the global fitness value is less than the error precision, ending iteration updating, and at the moment, optimizing the weight and the threshold of the BP neural network.
Step4: collecting a data set from the CSDN, dividing the data set into a training set and a testing set, and according to the following steps of 9: 1. 7:3 or 5:5, dividing the training set and the test set according to the proportion, then calculating the matrix sparsity, and selecting the proportion corresponding to the minimum matrix sparsity as the most suitable division proportion. And importing the divided training set data into an IWOA-BP scoring prediction model, and testing the model by using a test set until the scoring model is established.
And training the IWOA-BP scoring prediction model by adopting data in the training set until the scoring model is established.
Step5: according to the model building process of Step1-Step4, since the project characteristics of different users are not necessarily the same, an IWOA-BP score prediction model needs to be built for each user in the test set.
Step6: applying the established scoring prediction model to a collaborative filtering recommendation algorithm based on neighbor users, randomly selecting a target user, collecting the real historical scoring record of the target user and the same project characteristics of other users in a training set and the target user, carrying out scoring prediction according to the corresponding IWOA-BP scoring prediction model to obtain a predicted score, calculating the scoring error of the target user and other users, calculating the similarity according to an error similarity function, selecting k users with the closest similarity as a neighbor set, and generating a neighbor set Tu.
Step7: collecting historical scoring records of users in a neighbor set, carrying out scoring prediction on a target user through a corresponding IWOA-BP scoring prediction model according to characteristic items of historical scoring of the users in the neighbor set, recommending the item when the predictive scoring is high, not recommending when the predictive scoring is low, and finally visually comparing the performance of the algorithm through average absolute errors.
The Step1 is specifically as follows:
step1.1: adding Tent chaotic mapping into an original whale algorithm, performing population initialization to improve population diversity and expand a search space, and specifically comprises the following steps:
Figure BDA0003750189070000081
Figure BDA0003750189070000082
wherein i represents the population number, k represents the current iteration number, y i k Is a chaotic sequence from 0 to 1, and further generates a whale individual initial position sequence x in the search area i k Ub and lb are each the sequence x i k The maximum and minimum values of (c).
Step1.2: on the basis of adding the Ten chaotic mapping, a Levy flight strategy is added into the algorithm, and the algorithm is prevented from falling into local optimum and premature convergence by disturbing in the generation process of a candidate solution through Levy flight. The update iteration process of the original whale algorithm is expressed as:
D=|C·X rand -X(t)| (3)
X(t+1)=X rand (t)-A·D (4)
wherein, X rand (t) represents a random position vector, C and A are coefficient vectors for controlling the behavior of whale, D represents the positions of the current solution and the optimal solution, and X (t + 1) represents a position vector of the update candidate solution.
After the Levy flight strategy is added, the new candidate solution position update formula is changed from formula (4) to formula (5):
Figure BDA0003750189070000083
wherein X l (t) represents the current position of the candidate solution after updating, levy (lambda) refers to the random exploration path,α denotes a step control factor.
Step1.3: when setting the parameters of the BP neural network, the number n of neurons in an input layer is consistent with the characteristic number of items in a data set, for example, in a movie data set, the number n of neurons in the input layer is the same as the type of a movie, the number m of neurons in an output layer is 1, the number q of neurons in a hidden layer can change in different data sets, different q are set for experiments under the condition that both n and m in the same data set are determined values, and the number of q in the experiment with the minimum error is the number q of neurons in the hidden layer.
In addition, when information is transmitted into a BP neural network, each layer needs to be activated by an activation function, the activation function of an input and output layer is set to be an identity function f (x) = x, different activation functions are often adopted by a hidden layer in order to process some non-linear problems, the invention adopts a Sigmoid activation function, and the hidden layer activation function of the Sigmoid activation function is set to be an expression (6):
Figure BDA0003750189070000084
the mapping range of the function is between 0 and 1. And the derivation is simpler.
The Step2 specifically comprises the following steps:
step2.1: the improved whale algorithm is updated according to the standard of a greedy strategy, the optimal position vector is reserved, and the next iteration is carried out until the position vector of the optimal whale j is updated, wherein the updating iteration is represented as:
Figure BDA0003750189070000091
wherein, X l (t) represents the current position of the updated candidate solution, X (t) represents the position of the original candidate solution, the fitness value of the candidate solution is calculated, if the fitness value is small, the candidate solution is kept as the position of the original candidate solution to continue iteration until the iteration times are reached, the whole updating iteration process is ended, and the position vector IWOAX of the optimal whale j is generated j
Step2.2: the update iteration mode of the BP neural network can be expressed as:
W jk (r+1)=W jk (r)+αε k z jo (8)
θ k (r+1)=θ k (r)+βε k (9)
V ij (r+1)=V ij (r)+αε j x io (10)
θ j (r+1)=θ j (r)+βε j (11)
wherein r represents the iteration number, alpha represents the gradient descending step length, beta represents the learning factor, and the value ranges of the two are [0,1 ]]ε represents the output error of the neuron, z jo And x jo Then the input, W, is obtained after activation by the two layers of activation functions jk (r + 1) represents the updated weight of the jth neuron of the input layer to the kth neuron of the hidden layer, theta k (r + 1) denotes the threshold, V, for the k-th neuron update of the hidden layer ij (r + 1) is expressed as the weight of the j-th neuron of the hidden layer to the update of the output layer, theta i (r + 1) represents the threshold for the jth neuron update of the hidden layer.
And finally obtaining the BP neural network with the optimal weight threshold value through updating iteration of the weight threshold value layer by layer.
The Step3 fitness value calculation specifically comprises the following steps:
Figure BDA0003750189070000092
wherein n is j Representing the number of training samples, X i Is the location of the ith individual whale, θ it Is the ith individual in a sample set n j The final output value, O, of the tth training sample it Indicating the expected output result.
And comparing the calculated global fitness value with the set error precision of 0.001, obtaining the optimal particle until the global fitness value is smaller than the error precision, and ending the iterative updating, wherein the weight and the threshold of the BP neural network are optimal.
The improved whale algorithm is faster in convergence and higher in accuracy, more excellent weight and threshold of the BP neural network can be optimized, and the optimized BP neural network is used for a scoring model for the first time.
In Step4, the matrix sparsity calculation specifically includes:
Figure BDA0003750189070000093
wherein h represents the number of historical scoring records in the training set, j represents the total number of users in the training set, and k represents the total number of feature items in the training set.
The proportion of the test set in the training set is 9: 1. 7:3 or 5:5, the corresponding matrix sparsity is obtained through proportion division, the smaller the matrix sparsity is, the more data are, and the higher the scoring precision is, so the proportion with the minimum matrix sparsity is selected as the division proportion of the invention, and then the training set is used for training an IWOA-BP scoring prediction model.
The generation mode of the neighbor set in Step6 specifically comprises the following steps:
step6.1: randomly selecting a target user, collecting the real historical scoring record of the target user randomly and the characteristic items of other users in the training set, which are the same as the target user, and expressing the characteristic items as lambda by a set u = (u, p, pointu, p), u is user number, p is item number, point u,p The user u is scored for item p.
Step6.2: according to the characteristic items of different data sets, such as the types of movies, books and music, a project characteristic vector matrix is written, and is represented as follows:
Figure BDA0003750189070000101
wherein, when m n,j When the number is equal to 1, the nth item has the jth item characteristic, and if the number is 0, the jth item does not have the item characteristic.
Step6.3: carrying out scoring prediction on the same characteristic items of other users and the target user by using an IWOA-BP scoring prediction model, and calculating scoring errors of the target user and the other users, wherein the error calculation mode is expressed as follows:
e w,u =p w,vu,v (15)
Figure BDA0003750189070000102
wherein λ is u,v Represents the actual rating, P, of the target user u for the item v w,v Representing the predicted rating of a user w for a project v, e w,u Then represents P w,v And λ u,v I λ u | represents the number of elements in the user's historical score, E w,u Indicating the total item scoring error.
Step6.4: and (4) obtaining all the item scoring errors according to Step6.3, and calculating the similarity values of the target user and other users, wherein the error similarity function is expressed as:
Figure BDA0003750189070000103
and k is a constant of a positive integer, and as can be known from the formula (11), when the value of k is fixed, the larger the historical score error between the neighbor user and the target user is, the smaller the similarity between the target user and the neighbor user is, otherwise, the larger the similarity is, the similarity is sorted in a descending order, and the top k users are taken to generate the neighbor set Tu.
In Step7, the scoring prediction of the target user through the corresponding IWOA-BP scoring prediction model specifically comprises the following steps:
the predicted score of the target user u for the item v is represented as:
Figure BDA0003750189070000111
wherein the content of the first and second substances,
Figure BDA0003750189070000112
average number, λ, representing the historical score of the target user u,v Representing the value of the credit to item v by the neighbour user w,
Figure BDA0003750189070000113
average value representing the historical score of a neighbour user, S u,w The error similarity value is indicated.
And after the prediction score of the feature item corresponding to the target user is calculated, recommending the feature item by taking 1 to 5 as a standard and exceeding 4 points, or not recommending the feature item. Compared with the traditional user-based and project-based intelligent recommendation, the neighbor user-based intelligent recommendation has higher recommendation accuracy and stability.
After recommendation is completed, the advantages of the IWOA-BP-based collaborative filtering intelligent recommendation method can not be visually seen only from scoring, a comparison test is carried out on the advantages of the IWOA-BP-based collaborative filtering intelligent recommendation method, an intelligent recommendation algorithm based on a BP neural network and an intelligent recommendation algorithm based on a particle swarm optimization BP neural network, the test takes Mean Absolute Error (MAE) as an evaluation index, the advantages of the IWOA-BP-based collaborative filtering intelligent recommendation method are visually shown through comparison of the three algorithms, and the average absolute error is expressed as:
Figure BDA0003750189070000114
wherein p is ui Representing the actual rating of item i by target user u,
Figure BDA0003750189070000115
represents the predicted score of the target user u for item i, and | n | represents the number of test sets.
Compared with the other two algorithms, the stability of the invention is better, and the MAE is reduced by 11.6%.
As shown in fig. 6-8, a ml-100k data set is selected for experiment, the data set includes three tables, namely a user rating table, a function information table and a user information table, data in the data set is divided into a training set and a testing set after being processed, and the proportion of the training set to the testing set is 9:1, matrix sparsity of 0.943. Setting BP neural network parameters according to the function type, wherein an input layer n is 19; according to 9:1, and when the hidden layer q is set to be 6, the prediction error is minimum; since the problem finally discussed belongs to the regression prediction problem, the output layer m is set to 1. In the embodiment, on an Matlab experiment platform, a collaborative filtering algorithm (IWOA-BP algorithm for short) for optimizing BP neural network by utilizing whales in the invention is compared with a PSO-BP algorithm and a PSO algorithm in the aspects of recommendation precision and average absolute error.
As shown in FIGS. 2-4, it can be seen that the error of the BP model ranges from 3.19 to 6.12, the error of the PSO-BP model ranges from 0 to 6.86, and the error of the IWOA-BP model ranges from 0 to 5.73 in 100 iterations. It can be seen that the variation of the error of IWOA-BP is smaller compared to BP and PSO-BP models. Because the data set and the test set are divided differently in each iteration and cannot be used as a reference basis, the stability difference of BP, PSO-BO and IWOA-BP models is difficult to see from FIG. 2, so the method utilizes the average absolute error norm for comparison, and can more intuitively distinguish the advantages and disadvantages of the algorithm.
As shown in FIG. 5, as the number of generations increases, the mean absolute error norm changes of the BP, IWOA-BP and PSO-BP models all show a descending trend, the norms of the BP and PSO-BP models are basically stable at the 70 th iteration, and the IWOA-BP model is stable from the 10 th iteration. The norm of the average absolute error of BP and PSO-BP models is 32.6 in 100 iterations, the average absolute error of IWOA-BP is 29.2, the change is obviously smaller, and the IWOA-BP is reduced by 11.6% in the average absolute error compared with the BP and PSO-BP models in 100 th iteration.
While the present invention has been described in detail with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, and various changes can be made without departing from the spirit and scope of the present invention.

Claims (7)

1. A collaborative filtering intelligent recommendation method based on whale optimization BP neural network is characterized by comprising the following steps: the method comprises the following specific steps:
step1: firstly, adding Tent chaotic mapping into an original whale optimization algorithm, and then adding a Levy flight strategy to obtain an improved whale optimization algorithm; initializing an improved algorithm and BP neural network parameters, and setting the number n, q, m of neurons corresponding to an input layer, a hidden layer and an output layer and an activation function of each layer;
step2: updating the position vector IWOAX of whale j according to the improved whale algorithm in Step1 j And updating by a BP neural network iterative formula to obtain a new particle position vector BPX j
Step3: according to the particle position vector obtained in Step2, IWOAX is calculated j And BPX j Updating the position vector with small fitness value into a new position vector; then, calculating a global fitness value f (Pg) of a new position vector, comparing the global fitness value f (Pg) with the set error precision, if the global fitness value is greater than the error precision, continuing iteration from Step2 until an optimal particle is obtained when the global fitness value is less than the error precision, ending iteration updating, and at the moment, optimizing the weight and the threshold of the BP neural network;
step4: collecting a data set from the CSDN, dividing the data set into a training set and a testing set, and according to the following steps of 9: 1. 7:3 or 5:5, dividing the training set and the test set according to the proportion, then calculating the matrix sparsity, selecting the proportion corresponding to the minimum matrix sparsity as the most suitable division proportion, importing the divided training set data into an IWOA-BP scoring prediction model, and testing the model by using the test set;
step5: according to the model establishing process of Step1-Step4, establishing an IWOA-BP scoring prediction model for each user in the test set;
step6: applying the established scoring prediction model to a collaborative filtering recommendation algorithm based on neighbor users, randomly selecting a target user, collecting a real historical scoring record of the target user and the same project characteristics of other users in a training set and the target user, performing scoring prediction according to the corresponding IWOA-BP scoring prediction model to obtain a predicted score, calculating the scoring error of the target user and other users, calculating the similarity according to an error similarity function, selecting k users with the closest similarity as neighbor sets, and generating a neighbor set Tu;
step7: collecting historical scoring records of users in a neighbor set, carrying out scoring prediction on a target user through a corresponding IWOA-BP scoring prediction model according to characteristic items of historical scoring of the users in the neighbor set, recommending the item when the predictive scoring is high, not recommending when the predictive scoring is low, and finally comparing the algorithm performance through average absolute errors.
2. The collaborative filtering intelligent recommendation method based on whale optimized BP neural network as claimed in claim 1, wherein Step1 specifically comprises:
step1.1: adding Tent chaotic mapping into an original whale algorithm to perform population initialization, wherein the method specifically comprises the following steps:
Figure FDA0003750189060000011
Figure FDA0003750189060000021
wherein i represents the number of populations, k represents the current number of iterations,
Figure FDA0003750189060000022
is a chaotic sequence from 0 to 1, and further generates a sequence x of the initial positions of whale individuals in the search area i k Ub and lb are each the sequence x i k Maximum and minimum values of;
step1.2: on the basis of adding the Ten chaotic mapping, a Levy flight strategy is added into the algorithm, and the updating iteration process of the original whale algorithm is represented as follows:
D=|C·X rand -X(t)| (3)
X(t+1)=X rand (t)-A·D (4)
wherein, X rand (t) represents a random position vector, C and A are coefficient vectors for controlling whale action modes, D represents the positions of the current solution and the optimal solution, and X (t + 1) represents a position vector of an update candidate solution;
after the Levy flight strategy is added, the new candidate solution position update formula is changed from formula (4) to formula (5):
Figure FDA0003750189060000023
wherein, X l (t) represents the current position of the candidate solution after updating, levy (lambda) refers to a random exploration path, and alpha represents a step size control factor;
step1.3: when setting BP neural network parameters, the number n of neurons in an input layer is consistent with the characteristic number of items in a data set, the number m of neurons in an output layer is 1, the number q of neurons in a hidden layer can be changed in different data sets, different q are set for experiments under the condition that both n and m in the same data set are determined values, and the number of q in the experiment with the minimum error is the number q of neurons in the hidden layer;
when information is transmitted into a BP neural network, each layer needs an activation function to be activated, the activation function of an input and output layer is set to be an identity function f (x) = x, and the activation function of an implicit layer of the activation function is set to be an expression (6) by adopting a Sigmoid activation function:
Figure FDA0003750189060000024
the mapping range of the function is between 0 and 1.
3. The whale optimized BP neural network-based collaborative filtering intelligent recommendation method according to claim 1, wherein: the Step2 is specifically as follows:
step2.1: the improved whale algorithm is updated according to the standard of a greedy strategy, the optimal position vector is reserved, and next iteration is carried out until the position vector of the optimal whale j is updated, wherein the updating iteration is represented as:
Figure FDA0003750189060000025
wherein X l (t) represents the current position of the updated candidate solution, X (t) represents the position of the original candidate solution, the fitness value of the candidate solution is calculated, if the fitness value is small, the candidate solution is kept as the position of the original candidate solution to continue iteration until the iteration times are reached, the whole updating iteration process is ended, and the position vector IWOAX of the optimal whale j is generated j
Step2.2: the update iteration mode of the BP neural network can be expressed as:
W jk (r+1)=W jk (r)+αε k z jo (8)
θ k (r+1)=θ k (r)+βε k (9)
V ij (r+1)=V ij (r)+αε j x io (10)
θ j (r+1)=θ j (r)+βε j (11)
wherein r represents the iteration number, alpha represents the gradient descending step length, beta represents the learning factor, and the value ranges of the two are [0,1 ]]ε represents the output error of the neuron, z jo And x jo Then is the input, W, resulting from activation of the two-layer activation function jk (r + 1) represents the updated weight of the jth neuron of the input layer to the kth neuron of the hidden layer, theta k (r + 1) denotes the threshold, V, for the k-th neuron update of the hidden layer ij (r + 1) is expressed as the weight of the jth neuron of the hidden layer to the output layer update, theta i (r + 1) represents the threshold for the jth neuron update of the hidden layer;
and finally obtaining the BP neural network with the optimal weight threshold value through updating iteration of the weight threshold value layer by layer.
4. The intelligent recommendation method based on whale optimization BP neural network as claimed in claim 1, wherein the fitness value calculation in Step3 is specifically:
Figure FDA0003750189060000031
wherein n is j Representing the number of training samples, X i Is the location of the ith individual whale, θ it Is the ith individual in a sample set n j The final output value, O, of the tth training sample it Indicating the expected output result.
5. The cooperative filtering intelligent recommendation method based on whale optimization BP neural network as claimed in claim 1, wherein in Step4, the calculation matrix sparsity is specifically as follows:
Figure FDA0003750189060000032
wherein h represents the number of historical scoring records in the training set, j represents the total number of users in the training set, and k represents the total number of feature items in the training set.
6. The collaborative filtering intelligent recommendation method based on whale optimization BP neural network as claimed in claim 1, wherein the neighbor set generation manner in Step6 is specifically:
step6.1: randomly selecting a target user, collecting the real historical scoring record of the target user randomly and the characteristic items of other users in the training set, which are the same as the target user, and expressing the characteristic items as lambda by a set u = (u, p, pointu, p), u is user number, p is item number, point u,p Scoring item p for user u;
step6.2: according to the feature items of different data sets, compiling a project feature vector matrix, which is expressed as:
Figure FDA0003750189060000041
wherein, when m n,j When the number is equal to 1, the nth item has the jth item characteristic, and if the number is 0, the item characteristic is not present;
step6.3: and (3) carrying out scoring prediction on the same characteristic items of other users and the target user by using an IWOA-BP scoring prediction model, and calculating the scoring errors of the target user and the other users, wherein the error calculation mode is represented as:
e w,u =p w,vu,v (15)
Figure FDA0003750189060000042
wherein λ is u,v Represents the actual rating, P, of the target user u on the item v w,v Representing the predicted rating of a user w for a project v, e w,u Then represents P w,v And λ u,v The error of (a), represents the number of elements in the user's history score, E w,u Representing the total item scoring error;
step6.4: and calculating similarity values of the target user and other users according to all the item scoring errors obtained in Step6.3, wherein the error similarity function is expressed as:
Figure FDA0003750189060000043
and k is a constant of a positive integer, when the k value is fixed, the larger the historical scoring error between the neighbor user and the target user is, the smaller the similarity between the target user and the neighbor user is, otherwise, the larger the similarity is, the similarity is sorted in a descending order, and the top k users are taken to generate a neighbor set Tu.
7. The whale optimized BP neural network-based collaborative filtering intelligent recommendation method according to claim 1, wherein in Step7, the scoring prediction of a target user through a corresponding IWOA-BP scoring prediction model is specifically as follows:
the predicted score of the target user u for the item v is represented as:
Figure FDA0003750189060000044
wherein, the first and the second end of the pipe are connected with each other,
Figure FDA0003750189060000045
average number, λ, representing the historical score of the target user u,v Representing the value of the credit to item v by the neighbor user w,
Figure FDA0003750189060000046
average value representing the historical score of a neighbour user, S u,w Representing an error similarity value;
the mean absolute error is expressed as:
Figure FDA0003750189060000051
wherein p is ui Representing the actual rating of item i by target user u,
Figure FDA0003750189060000052
represents the predicted score of the target user u for item i, and | n | represents the number of test sets.
CN202210839238.8A 2022-07-18 2022-07-18 Intelligent collaborative filtering recommendation method based on whale optimized BP neural network Pending CN115309980A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210839238.8A CN115309980A (en) 2022-07-18 2022-07-18 Intelligent collaborative filtering recommendation method based on whale optimized BP neural network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210839238.8A CN115309980A (en) 2022-07-18 2022-07-18 Intelligent collaborative filtering recommendation method based on whale optimized BP neural network

Publications (1)

Publication Number Publication Date
CN115309980A true CN115309980A (en) 2022-11-08

Family

ID=83857565

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210839238.8A Pending CN115309980A (en) 2022-07-18 2022-07-18 Intelligent collaborative filtering recommendation method based on whale optimized BP neural network

Country Status (1)

Country Link
CN (1) CN115309980A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116401458A (en) * 2023-04-17 2023-07-07 南京工业大学 Recommendation method based on Lorenz chaos self-adaption
CN116886398A (en) * 2023-08-03 2023-10-13 中国石油大学(华东) Internet of things intrusion detection method based on feature selection and integrated learning
CN117130283A (en) * 2023-10-26 2023-11-28 吉林大学 Corn on-demand fertilization control system and soil nitrogen content soft measurement method
CN117241376A (en) * 2023-09-14 2023-12-15 兰州理工大学 WSN node positioning method for multi-strategy improved BP neural network

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116401458A (en) * 2023-04-17 2023-07-07 南京工业大学 Recommendation method based on Lorenz chaos self-adaption
CN116401458B (en) * 2023-04-17 2024-01-09 南京工业大学 Recommendation method based on Lorenz chaos self-adaption
CN116886398A (en) * 2023-08-03 2023-10-13 中国石油大学(华东) Internet of things intrusion detection method based on feature selection and integrated learning
CN116886398B (en) * 2023-08-03 2024-03-29 中国石油大学(华东) Internet of things intrusion detection method based on feature selection and integrated learning
CN117241376A (en) * 2023-09-14 2023-12-15 兰州理工大学 WSN node positioning method for multi-strategy improved BP neural network
CN117241376B (en) * 2023-09-14 2024-04-19 兰州理工大学 WSN node positioning method for multi-strategy improved BP neural network
CN117130283A (en) * 2023-10-26 2023-11-28 吉林大学 Corn on-demand fertilization control system and soil nitrogen content soft measurement method
CN117130283B (en) * 2023-10-26 2024-01-05 吉林大学 Corn on-demand fertilization control system and soil nitrogen content soft measurement method

Similar Documents

Publication Publication Date Title
CN115309980A (en) Intelligent collaborative filtering recommendation method based on whale optimized BP neural network
US20210383041A1 (en) In-situ thermodynamic model training
Peng et al. Accelerating minibatch stochastic gradient descent using typicality sampling
CN109086900B (en) Electric power material guarantee and allocation platform based on multi-target particle swarm optimization algorithm
CN108509573A (en) Book recommendation method based on matrix decomposition collaborative filtering and system
CN115186097A (en) Knowledge graph and reinforcement learning based interactive recommendation method
CN113241122A (en) Gene data variable selection and classification method based on fusion of adaptive elastic network and deep neural network
CN109299776A (en) One seed nucleus incremental transfinites learning machine, difference grey wolf method for mixing and optimizing on multiple populations
CN113255873A (en) Clustering longicorn herd optimization method, system, computer equipment and storage medium
CN114692310A (en) Virtual-real integration-two-stage separation model parameter optimization method based on Dueling DQN
Han et al. A hybrid gene selection method based on gene scoring strategy and improved particle swarm optimization
CN112256971A (en) Sequence recommendation method and computer-readable storage medium
Li et al. LC-NAS: Latency constrained neural architecture search for point cloud networks
Li et al. Transferable discriminant linear regression for cross-corpus speech emotion recognition
Kihel et al. Firefly Optimization Using Artificial Immune System for Feature Subset Selection.
CN113762370A (en) Depth network set generation method combined with Gaussian random field
Lu et al. Personalized federated learning on long-tailed data via adversarial feature augmentation
CN114048386B (en) Deep learning-based personalized and diversified search method
CN116415177A (en) Classifier parameter identification method based on extreme learning machine
Yi et al. A fault diagnosis method of oil-immersed transformer based on improved harris hawks optimized random forest
Deng et al. Label propagation on k-partite graphs with heterophily
CN114881106A (en) Transformer fault diagnosis method and device based on MPA-SVM
CN115269861A (en) Reinforced learning knowledge graph reasoning method based on generative confrontation and imitation learning
CN115345303A (en) Convolutional neural network weight tuning method, device, storage medium and electronic equipment
CN113362911A (en) IPSO-HKELM-based blast furnace molten iron silicon content prediction method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination