Summary of the invention
Because the above-mentioned defect of prior art, technical matters to be solved by this invention is to provide the method for regularized learning algorithm speed in a kind of collaborative filtering recommending model, make accuracy rate and the speed of convergence of recommended models reach a good equilibrium state, the training process of recommended models is optimized.
For achieving the above object, the invention provides the method for regularized learning algorithm speed in a kind of collaborative filtering recommending model, carry out according to the following steps:
Step 1, definition are also calculated the learning rate magnification ratio factor and the scale down factor; Set up learning rate and the hidden proper vector of user corresponding relation, set up the corresponding relation of learning rate and the hidden proper vector of project;
Set the magnification ratio factor-alpha of learning rate; By
sigmoid function definition
0 < η
0< 1; Set the scale down factor-beta of learning rate, β=α
-1;
Setting the hidden proper vector of user is P, the matrix that P is m * f, and m is number of users, the dimension that f is hidden characteristic vector space, P
u, kit is the element that in P, u is capable, k is listed as; For all p
u, k{ 1≤u≤m, 1≤k≤f} sets up learning rate η
u, k, initialization η
u, k=η
0, m, f are positive integer;
The hidden proper vector of setting item is Q, the matrix that Q is n * f, and n is item number, the dimension that f is hidden characteristic vector space, q
i, kit is the element that in Q, i is capable, k is listed as; For all q
i, k{ 1≤i≤n, 1≤k≤f} sets up learning rate η
i, k, initialization η
i, k=η
0, n is positive integer;
Step 2, the calculating hidden proper vector of user are or/and the hidden proper vector of project is being trained the learning direction of t constantly;
For the hidden proper vector P of user
u, kwith the hidden proper vector q of project
i, k, it is r at training data corresponding to training moment t
u, i; P
u, kin the training moment, the learning direction of t is
T is positive integer;
Q
i, kin the training moment, the learning direction of t is
p
uthe state value of the corresponding hidden proper vector of user after the training moment, t-1 finished;
q
ithe state value of the corresponding hidden proper vector of project after the training moment, t-1 finished;
with
p
u, kand q
i, krespectively at the state value of training after moment t-1 finishes; λ is the stipulations factor, by the parameter P of λ and current training
u, kstate value
substitution learning direction, thus the overfitting in training process reduced, after the training moment, t finished, right respectively
with
carry out buffer memory;
Step 3, use determinacy step by step modulating method regularized learning algorithm speed;
The hidden proper vector P of user
u, klearning direction when training moment t+1 is
the hidden proper vector q of project
i, klearning direction when training moment t+1 is
Judgement
or/and
product signs;
When
time, use learning rate magnification ratio factor-alpha to η
u, kamplify:
When
time, use learning rate scale down factor-beta to η
u, kdwindle:
η
u, kat the state value of training moment t,
η
u, kstate value at training moment t+1;
When
time, use learning rate magnification ratio factor-alpha to η
i, kamplify:
When
time, use learning rate scale down factor-beta to η
i, kdwindle:
η
i,kat the state value of training moment t,
η
i,kstate value at training moment t+1.
Preferably, also comprise the step that the hidden proper vector of user or the hidden proper vector of project are upgraded;
The hidden proper vector of user is when training moment t+1
The hidden proper vector of project is when training moment t+1
The invention has the beneficial effects as follows: the present invention, by dynamic regularized learning algorithm speed, can make the accuracy rate of recommended models and speed of convergence reach a good equilibrium state, and the training process of recommended models is optimized.
Embodiment
Below in conjunction with drawings and Examples, the invention will be further described:
Embodiment mono-: as shown in Figure 1, a kind of method of regularized learning algorithm speed in collaborative filtering recommending model, carry out according to the following steps:
A1, definition are also calculated the learning rate magnification ratio factor and the scale down factor;
Set the magnification ratio factor-alpha of learning rate; By
sigmoid function definition
0 < η
0< 1; Set the scale down factor-beta of learning rate, β=α
-1;
A2, set up learning rate and the hidden proper vector of user corresponding relation, set up the corresponding relation of learning rate and the hidden proper vector of project;
Setting the hidden proper vector of user is P, the matrix that P is m * f, and m is number of users, the dimension that f is hidden characteristic vector space, P
u, kit is the element that in P, u is capable, k is listed as; For all p
u, k{ 1≤u≤m, 1≤k≤f} sets up learning rate η
u, k, initialization η
u, k=η
0, m, f are positive integer;
The hidden proper vector of setting item is Q, the matrix that Q is n * f, and n is item number, the dimension that f is hidden characteristic vector space, q
i, kit is the element that in Q, i is capable, k is listed as; For all q
i, k{ 1≤i≤n, 1≤k≤f} sets up learning rate η
i, k, initialization η
i, k=η
0, n is positive integer;
A3, the hidden proper vector of calculating user are being trained the learning direction of t constantly;
For the hidden proper vector P of user
u, kwith the hidden proper vector q of project
i, k, it is r at training data corresponding to training moment t
u, i; P
u, kin the training moment, the learning direction of t is
T is positive integer;
p
uthe state value of the corresponding hidden proper vector of user after the training moment, t-1 finished;
q
ithe state value of the corresponding hidden proper vector of project after the training moment, t-1 finished;
with
p
u, kand q
i, krespectively at the state value of training after moment t-1 finishes; λ is the stipulations factor; After the training moment, t finished, right respectively
with
carry out buffer memory;
A4, calculate in training constantly during t+1 the hidden proper vector P of user
u, klearning direction
A5, judgement
product signs;
When
time, use learning rate magnification ratio factor-alpha to η
u, kamplify:
When
time, use learning rate scale down factor-beta to η
u, kdwindle:
η
u, kat the state value of training moment t,
η
u, kstate value at training moment t+1.
The hidden proper vector of user is at two continuous training learning direction jack per line constantly, be illustrated in two continuous training constantly, the direction of search of the hidden proper vector of user in search volume do not change, illustrate that current learning direction possesses higher reliability, can suitably increase learning rate corresponding to this hidden proper vector, thereby improve speed of convergence.
The hidden proper vector of user is at two continuous training learning direction contrary sign constantly, represent that it in two continuous training constantly, there is concussion in the direction of search in search volume, illustrate that current learning direction reliability is lower, can suitably dwindle learning rate corresponding to this hidden proper vector, thereby improve, recommend accuracy rate.
Embodiment bis-: as shown in Figure 2, a kind of method of regularized learning algorithm speed in collaborative filtering recommending model, carry out according to the following steps:
A1, definition are also calculated the learning rate magnification ratio factor and the scale down factor;
Set the magnification ratio factor-alpha of learning rate; By
sigmoid function definition
0 < η
0< 1; Set the scale down factor-beta of learning rate, β=α
-1;
A2, set up learning rate and the hidden proper vector of user corresponding relation, set up the corresponding relation of learning rate and the hidden proper vector of project;
Setting the hidden proper vector of user is P, the matrix that P is m * f, and m is number of users, the dimension that f is hidden characteristic vector space, P
u, kit is the element that in P, u is capable, k is listed as; For all p
u, k{ 1≤u≤m, 1≤k≤f} sets up learning rate η
u, k, initialization η
u, k=η
0, m, f are positive integer;
The hidden proper vector of setting item is Q, the matrix that Q is n * f, and n is item number, the dimension that f is hidden characteristic vector space, q
i, kit is the element that in Q, i is capable, k is listed as; For all q
i, k{ 1≤i≤n, 1≤k≤f} sets up learning rate η
i, k, initialization η
i, k=η
0, n is positive integer;
A3, the hidden proper vector of computational item are being trained the learning direction of t constantly;
For the hidden proper vector P of user
u, kwith the hidden proper vector q of project
i, k, it is r at training data corresponding to training moment t
u, i; q
i, kin the training moment, the learning direction of t is
Q
i, klearning direction at training moment t
be expressed as:
p
uthe state value of the corresponding hidden proper vector of user after the training moment, t-1 finished;
q
ithe state value of the corresponding hidden proper vector of project after the training moment, t-1 finished;
with
p
u, kand q
i, krespectively at the state value of training after moment t-1 finishes; λ is the stipulations factor; After the training moment, t finished, right respectively
with
carry out buffer memory;
A4, the calculating hidden proper vector q of project when training moment t+1
i, klearning direction
A5, judgement
product signs;
When
time, use learning rate magnification ratio factor-alpha to η
i, kamplify:
When
time, use learning rate scale down factor-beta to η
i, kdwindle:
η
i,kat the state value of training moment t,
η
i,kstate value at training moment t+1.
The hidden proper vector of project is at two continuous training learning direction jack per line constantly, be illustrated in two continuous training constantly, the direction of search of the hidden proper vector of project in search volume do not change, illustrate that current learning direction possesses higher reliability, can suitably increase learning rate corresponding to this hidden proper vector, thereby improve speed of convergence.
The hidden proper vector of project is at two continuous training learning direction contrary sign constantly, represent that it in two continuous training constantly, there is concussion in the direction of search in search volume, illustrate that current learning direction reliability is lower, can suitably dwindle learning rate corresponding to this hidden proper vector, thereby improve, recommend accuracy rate.
Embodiment tri-: as shown in Figure 3, the flow process of the present embodiment and embodiment mono-are basic identical, difference is: first set up learning rate and the hidden proper vector of user corresponding relation, set up the corresponding relation of learning rate and the hidden proper vector of project, and then definition and calculate the learning rate magnification ratio factor and the scale down factor.
Embodiment tetra-: as shown in Figure 4, the flow process of the present embodiment and embodiment bis-are basic identical, difference is: first set up learning rate and the hidden proper vector of user corresponding relation, set up the corresponding relation of learning rate and the hidden proper vector of project, and then definition and calculate the learning rate magnification ratio factor and the scale down factor.
Embodiment five: as shown in Figure 5, the flow process of the present embodiment and embodiment mono-are basic identical, and difference is: after regularized learning algorithm speed, also comprise the step that the hidden proper vector of user is upgraded;
The hidden proper vector of user is when training moment t+1
By use the learning rate of adjusting by determinacy step by step modulating method in training process, thereby make the hidden proper vector of user comprise it in continuous two training training information constantly at each training pace of learning constantly, thereby reach the object of optimizing training process.
Embodiment six: as shown in Figure 6, the flow process of the present embodiment and embodiment bis-are basic identical, and difference is: after regularized learning algorithm speed, also comprise the step that the hidden proper vector of project is upgraded;
The hidden proper vector of project is when training moment t+1
By use the learning rate of adjusting by determinacy step by step modulating method in training process, thereby make the hidden proper vector of project comprise it in continuous two training training information constantly at each training pace of learning constantly, thereby reach the object of optimizing training process.
Embodiment seven: as shown in Figure 7, the flow process of the present embodiment and embodiment tri-are basic identical, and difference is: after regularized learning algorithm speed, also comprise the step that the hidden proper vector of user is upgraded;
The hidden proper vector of user is when training moment t+1
By use the learning rate of adjusting by determinacy step by step modulating method in training process, thereby make the hidden proper vector of user comprise it in continuous two training training information constantly at each training pace of learning constantly, thereby reach the object of optimizing training process.
Embodiment eight: as shown in Figure 8, the flow process of the present embodiment and embodiment tetra-are basic identical, and difference is: after regularized learning algorithm speed, also comprise the step that the hidden proper vector of project is upgraded;
The hidden proper vector of project is when training moment t+1
By use the learning rate of adjusting by determinacy step by step modulating method in training process, thereby make the hidden proper vector of project comprise it in continuous two training training information constantly at each training pace of learning constantly, thereby reach the object of optimizing training process.
Embodiment nine: as shown in Figure 9, a kind of method of regularized learning algorithm speed in collaborative filtering recommending model, carry out according to the following steps:
Step 1, definition are also calculated the learning rate magnification ratio factor and the scale down factor; Set up learning rate and the hidden proper vector of user corresponding relation, set up the corresponding relation of learning rate and the hidden proper vector of project;
Set the magnification ratio factor-alpha of learning rate; By
sigmoid function definition
0 < η
0< 1; Set the scale down factor-beta of learning rate, β=α
-1;
Setting the hidden proper vector of user is P, the matrix that P is m * f, and m is number of users, the dimension that f is hidden characteristic vector space, P
u, kit is the element that in P, u is capable, k is listed as; For all p
u, k{ 1≤u≤m, 1≤k≤f} sets up learning rate η
u, k, initialization η
u, k=η
0, m, f are positive integer;
The hidden proper vector of setting item is Q, the matrix that Q is n * f, and n is item number, the dimension that f is hidden characteristic vector space, q
i, kit is the element that in Q, i is capable, k is listed as; For all q
i, k{ 1≤i≤n, 1≤k≤f} sets up learning rate η
i, k, initialization η
i, k=η
0, n is positive integer;
Step 2, the calculating hidden proper vector of user and the hidden proper vector of project are at the learning direction of training moment t;
For the hidden proper vector P of user
u, kwith the hidden proper vector q of project
i, k, it is r at training data corresponding to training moment t
u, i; P
u, kin the training moment, the learning direction of t is
t is positive integer; q
i, kin the training moment, the learning direction of t is
p
uthe state value of the corresponding hidden proper vector of user after the training moment, t-1 finished;
q
ithe state value of the corresponding hidden proper vector of project after the training moment, t-1 finished;
with
p
u, kand q
i, krespectively at the state value of training after moment t-1 finishes; λ is the stipulations factor; After the training moment, t finished, right respectively
with
carry out buffer memory;
Step 3, use determinacy step by step modulating method regularized learning algorithm speed;
The hidden proper vector P of user
u, klearning direction when training moment t+1 is
the hidden proper vector q of project
i, klearning direction when training moment t+1 is
calculate
with
Judgement
with
product signs;
When
time, use learning rate magnification ratio factor-alpha to η
u, kamplify:
When
time, use learning rate scale down factor-beta to η
u, kdwindle:
η
u, kat the state value of training moment t,
η
u, kstate value at training moment t+1;
When
time, use learning rate magnification ratio factor-alpha to η
i, kamplify:
When
time, use learning rate scale down factor-beta to η
i, kdwindle:
η
i,kat the state value of training moment t,
η
i,kstate value at training moment t+1.
The hidden proper vector of user or the hidden proper vector of project are at two continuous training learning direction jack per line constantly, be illustrated in two continuous training constantly, the hidden proper vector of user or the direction of search of the hidden proper vector of project in search volume do not change, illustrate that current learning direction possesses higher reliability, can suitably increase learning rate corresponding to this hidden proper vector, thereby improve speed of convergence;
The hidden proper vector of user or the hidden proper vector of project are at two continuous training learning direction contrary sign constantly, represent that it in two continuous training constantly, there is concussion in the direction of search in search volume, illustrate that current learning direction reliability is lower, can suitably dwindle learning rate corresponding to this hidden proper vector, thereby improve, recommend accuracy rate.
Embodiment ten: as shown in figure 10, the flow process of the present embodiment and embodiment nine are basic identical, and difference is: after regularized learning algorithm speed, also comprise the step that the hidden proper vector of user and the hidden proper vector of project are upgraded;
The hidden proper vector of user is when training moment t+1
The hidden proper vector of project is when training moment t+1
By use the learning rate of adjusting by determinacy step by step modulating method in training process, thereby make the hidden proper vector of user or the hidden proper vector of project comprise it in continuous two training training information constantly at each training pace of learning constantly, thereby reach the object of optimizing training process.
As can be seen from the above embodiments, set up learning rate and the hidden proper vector of user corresponding relation, set up learning rate and the hidden proper vector of project corresponding relation step can with definition and calculate the learning rate magnification ratio factor and the step of the scale down factor in no particular order order operate.
For the correctness of method and accuracy are verified, be configured to INTEL i5-760,2.8G processor, has moved emulation experiment on the PC of 8G internal memory and has verified.In experimental verification, used MovieLens 1M data set, MovieLens 1M data set is the authoritative public testing data set in personalized recommendation technical research field, derive from http://www.grouplens.org/node/12, this data set has comprised 6040 users and 3900 projects has been surpassed to the score information of 1,000,000, its user-project rating matrix consistency is respectively 4.25%, all user's scorings are all distributed in interval [0,5], in, the higher representative of consumer of score value is stronger to the interest of respective item.Experiment is used root-mean-square error RMSE as the evaluation index of recommending accuracy rate, uses exercise wheel number as the evaluation index of convergence speed; RMSE is lower, recommends accuracy rate higher; Exercise wheel number is fewer, and convergence speed is faster.
Each parameter in experiment is set to: stipulations factor lambda=0.05, and hidden feature space dimension f=20, m is set to 6040, n according to the number of users of Experiment Training data centralization and is set to 3900 according to the item number of Experiment Training data centralization.
Figure 11 is the recommendation accuracy rate comparison diagram before and after the present invention optimizes, in figure, lines 1 are the recommendation accuracy rate before optimizing, lines 2 are the recommendation accuracy rate after optimizing, as seen from Figure 11, the RMSE value of lines 2 is starkly lower than lines 1, because RMSE value is lower, recommend accuracy rate higher, can find out after the present invention optimizes, for different learning rate initial value η
0, the recommended models based on matrix factorization all can obtain than higher recommendation accuracy before optimizing.
Figure 12 is the speed of convergence comparison diagram before and after the present invention optimizes, and in figure, lines 3 are the speed of convergence after optimizing, and lines 4 are the speed of convergence before optimizing, as seen from Figure 12, and after using the present invention to optimize, as learning rate initial value η
0be less than at 0.015 o'clock, the convergence speed of recommended models is obviously faster than before optimizing; And as learning rate initial value η
0be greater than at 0.015 o'clock, the convergence speed of recommended models is front basically identical with optimization.As can be seen here, after using this method to optimize, can obviously reduce learning rate initial value η
0impact on model speed of convergence; The method that the present invention proposes can make the recommended models based on matrix factorization reach and recommend the well balanced of accuracy rate and convergence speed.
More than describe preferred embodiment of the present invention in detail.Should be appreciated that those of ordinary skill in the art just can design according to the present invention make many modifications and variations without creative work.Therefore, all technician in the art, all should be in the determined protection domain by claims under this invention's idea on the basis of existing technology by the available technical scheme of logical analysis, reasoning, or a limited experiment.