Sequence recommendation method, system and storage medium based on residual error network

文档序号:7821 发布日期:2021-09-17 浏览:28次 中文

1. A sequence recommendation method based on a residual error network is characterized by comprising the following steps:

step S1, acquiring original consumption data of a user through a network, dividing the original consumption data into sequences to obtain sequence segments, and initializing the sequence segments to obtain sequence data for GRU neural network identification;

step S2, based on GRU neural network of residual error structure, carrying out output processing to the sequence data, and taking the output hidden state as the global interest of the user;

step S3, according to a commercial grade attention mechanism, calculating the sequence data and the hidden state to obtain the local interest of the user;

step S4, splicing the global interest and the local interest to obtain a final interest;

and step S5, calculating the probability distribution of the next interactive commodity of the user according to the final interest, carrying out model training according to the probability distribution to obtain a training model, predicting the next interactive behavior of the user according to the training model, and recommending commodity information to the user.

2. The residual error network-based sequence recommendation method according to claim 1, wherein said original consumption data comprises a time attribute; the step S1 includes:

dividing the original consumption data into a sequence according to a preset period to obtain a plurality of sequence segments, initializing each sequence segment to obtain sequence data, and expanding the sequence data according to a GRU neural network, wherein the sequence data can be expressed as x ═ k1,k2,...kn) And n represents the size of the time step.

3. The residual error network-based sequence recommendation method according to claim 2, wherein the step S2 comprises:

s21, according to the formula (1), carrying out GRU neural network output processing on the sequence data for the first time, and obtaining a plurality of hidden states h corresponding to the sequence data sequencen', the formula (1) is hn' -gru (x), x is sequence data;

s22, combining the sequence data and the hidden states h according to the formula (2)n'the last hidden state of the' is merged to obtain the updated gate output hnAnd the update gate output comprises the original consumption data and the current consumption characteristics of the user, and the formula (2) is as follows:

where σ is the activation function, W1、W2Is a weight matrix, b is a bias vector,is a Hadamard product, x is sequence data, hkIs hn' last hidden state;

s23, outputting h by the updating gate according to the formula (3)nSplicing with the sequence data, calculating a second GRU neural network output based on a residual error structure to obtain a plurality of hidden states corresponding to the sequence data sequenceThe formula (3) is:wherein x is sequence data, hnTo update the gate output;

s24, hiding the plurality of hidden statesSplicing with the sequence data, calculating the third GRU neural network output based on a residual error structure to obtain a plurality of hidden states h corresponding to the sequence data sequencen″;

S25, mixing the hn"as a global interest of the user.

4. The residual error network-based sequence recommendation method according to claim 3, wherein said step S3 comprises:

s31, calculating the weights of different commodities according to an equation (4), wherein the equation (4) is as follows:

in the formula, W5、W6Is a weight matrix, σ is an activation function, vTWhich represents a linear transformation, is shown,update door registerLast hidden state value, hqGRU neural network output for consuming the qth commodity for the user;

s32, calculating the weights of the different commodities according to a commodity-level attention mechanism function formula (5) to obtain the local interest of the user, wherein the commodity-level attention mechanism function formula (5) is as follows:

in the formula, atqAs weights of different commodities, hqAnd outputting the GRU neural network for consuming the q-th commodity for the user.

5. The residual error network-based sequence recommendation method according to claim 4, wherein the step S5 comprises:

s51, converting the commodity data in the original consumption data, wherein the converted commodity data can be expressed as z ═ (z)1,z2,...zI);

S52, calculating the final interest and the converted commodity data according to a Softmax functional formula (6) to obtain the probability of commodity interaction of the user next time, wherein the Softmax functional formula (6) is as follows:

wherein I is the total number of commodities, zyIs the y-th commodity, T is the transpose, q is any commodity, hlIs the final interest;

s53, performing model training according to a cross entropy loss function formula (7), and obtaining a training model when an output loss value tends to be stable, wherein the cross entropy loss function formula (7) is as follows:

in formula (II) p'qPredicted probability value, p, for the next interactive commodity of the userqThe actual probability value of the next interactive commodity for the user;

and S54, predicting the next interactive behavior of the user according to the training model, and recommending commodity information to the user.

6. A residual network-based sequence recommendation system, comprising:

the system comprises an initial module, a GRU neural network identification module and a data processing module, wherein the initial module is used for acquiring original consumption data of a user through a network, dividing the original consumption data into sequences to obtain sequence segments, and initializing the sequence segments to obtain sequence data for GRU neural network identification;

the interest acquisition module is used for outputting the sequence data based on a GRU neural network with a residual error structure, and taking an output hidden state as global interest data of a user; according to a commercial grade attention mechanism, calculating the sequence data and the hidden state to obtain local interest data of the user; splicing the global interest data and the local interest to obtain a final interest;

and the training module is used for calculating the probability distribution of the next interactive commodity of the user according to the final interest, carrying out model training according to the probability distribution to obtain a training model, predicting the next interactive behavior of the user according to the training model, and recommending commodity information to the user.

7. The residual error network-based sequence recommendation system according to claim 6, wherein the initialization module comprises:

the raw consumption data comprises a time attribute;

dividing the original consumption data into a sequence according to a preset period to obtain a plurality of sequence segments, initializing each sequence segment to obtain sequence data, and expanding the sequence data according to a GRU neural network, wherein the sequence data can be expressed as x ═ k1,k2,...kn) And n represents the size of the time step.

8. The residual error network-based sequence recommendation system according to claim 6, wherein the interest obtaining module comprises:

a global interest acquisition unit: performing GRU neural network output processing on the sequence data for the first time according to formula (1), and obtaining a plurality of hidden states h corresponding to the sequence data sequencen' the formula (1) is hn' -gru (x), x is sequence data;

associating the sequence data with the plurality of hidden states h according to equation (2)n'the last hidden state of the' is merged to obtain the updated gate output hnSaid update gate outputs hnThe formula (2) comprises original consumption data and current consumption characteristics of the user:

where σ is the activation function, W1、W2Is a weight matrix, b is a bias vector,is a Hadamard product, x is sequence data, hkIs hn' last hidden state;

outputting the update gate h according to equation (3)nCalculating the splicing of the sequence data, outputting a second GRU neural network based on a residual error structure to obtain a plurality of hidden states corresponding to the sequence data sequenceThe formula (3) is:wherein x is sequence data, hnTo update the gate output;

combining the plurality of hidden statesSplicing with the sequence data, calculating the third GRU neural network output based on a residual error structure to obtain a plurality of hidden states h corresponding to the sequence data sequencen"; h is to ben"the last hidden state as the global interest of the user;

a local interest acquisition unit: calculating the weights of different commodities according to an equation (4), wherein the equation (4) is as follows:

in the formula, W5、W6Is a weight matrix, σ is an activation function, vTWhich represents a linear transformation, is shown,for updating the last hidden state value of the gate output, hqGRU neural network output for consuming the qth commodity for the user;

calculating the weights of the different commodities according to a commodity-level attention mechanism function (5) to obtain the local interest of the user, wherein the commodity-level attention mechanism function (5) is as follows:

in the formula, atqAs weights of different commodities, hqGRU neural network output for consuming the qth commodity for the user;

a final interest acquisition unit: and splicing the global interest of the user and the local interest of the user to obtain the final interest of the user.

9. A residual network based sequence recommendation system comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that when the computer program is executed by the processor, the residual network based sequence recommendation method according to any of claims 1 to 5 is implemented.

10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which when executed by a processor implements the residual network-based sequence recommendation method according to any one of claims 1 to 5.

Background

The recommendation system provides commodity information and suggestions to customers by using an e-commerce website, helps the users decide what products should be purchased, and simulates salesmen to help the customers to complete the purchasing process. The personalized recommendation is to recommend information and commodities which are interested by the user to the user according to the interest characteristics and purchasing behaviors of the user. In recent years, Sequence Recommendation Systems (SRSs), an emerging research topic, have been receiving increasing attention, and unlike traditional Recommendation Systems (RSs) based on collaborative filtering and content, SRSs attempt to understand and model user-item interactions in a user's behavioral sequence, as well as the evolution of user preferences and item popularity over time, to more accurately describe the intent and goal of the user's context, item consumption trends, resulting in more accurate, customized and dynamic recommendations. However, the existing recommendation system has some defects, such as inaccurate interest learning of the user, which results in great discount of recommendation performance.

Disclosure of Invention

The invention aims to solve the technical problem of the prior art and provides a sequence recommendation method, a sequence recommendation system and a storage medium based on a residual error network. A plurality of GRU neural networks with residual error structures are designed, the output obtained after the processing of the GRU neural networks is spliced with the original input to be used as the input of the next GRU neural network, an updating gate is also introduced in the processing process, the final interest of the user is obtained finally, the real interest of the user can be expressed according to the final interest of the user, and the recommendation performance is further improved.

The technical scheme for solving the technical problems is as follows: a sequence recommendation method based on a residual error network comprises the following steps:

step S1, acquiring original consumption data of a user through a network, dividing the original consumption data into sequences to obtain sequence segments, and initializing the sequence segments to obtain sequence data for GRU neural network identification;

step S2, based on GRU neural network of residual error structure, carrying out output processing to the sequence data, and taking the output hidden state as the global interest of the user;

step S3, according to a commercial grade attention mechanism, calculating the sequence data and the hidden state to obtain the local interest of the user;

step S4, splicing the global interest and the local interest to obtain a final interest;

and step S5, calculating the probability distribution of the next interactive commodity of the user according to the final interest, carrying out model training according to the probability distribution to obtain a training model, predicting the next interactive behavior of the user according to the training model, and recommending commodity information to the user.

The invention has the beneficial effects that: the GRU neural network with the residual error structure is used for inputting the sequence data, so that the characteristic information input by the GRU neural network is enriched, the characteristic information comprises the original data of the user and the characteristic information processed by the neural network, the consumption characteristic information of the user is extracted, the consumption behavior of the user can be accurately learned, and the accurate recommendation effect is realized.

On the basis of the technical scheme, the invention can be further improved as follows:

further, the raw consumption data includes a time attribute; the step S1 includes:

dividing the original consumption data into a sequence according to a preset period to obtain a plurality of sequence segments, initializing each sequence segment to obtain sequence data, and expanding the sequence data according to a GRU neural network, wherein the sequence data can be expressed as x ═ k1,k2,...kn) And n represents the size of the time step.

Further, the step S2 specifically includes:

s21, according to the formula (1), carrying out GRU neural network output processing on the sequence data for the first time, and obtaining a plurality of hidden states h corresponding to the sequence data sequencen', the formula (1) is hn' -gru (x), x is sequence data;

s22, combining the sequence data and the hidden states h according to the formula (2)n'the last hidden state of the' is merged to obtain the updated gate output hnSaid update gate outputs hnThe formula (2) comprises original consumption data and current consumption characteristics of the user:

where σ is the activation function, W1、W2Is a weight matrix, b is a bias vector,is a Hadamard product, x is sequence data, hkIs hn' last hidden state;

s23, outputting h by the updating gate according to the formula (3)nSplicing with the sequence data, calculating a second GRU neural network output based on a residual error structure to obtain a plurality of hidden states corresponding to the sequence data sequenceThe formula (3) is:wherein x is sequence data, hnTo update the gate output;

s24, hiding the plurality of hidden statesSplicing with the sequence data, calculating the third GRU neural network output based on a residual error structure to obtain a plurality of hidden states h corresponding to the sequence data sequencen″;

S25, mixing the hn"as a global interest of the user.

The beneficial effect of adopting the further scheme is that: because the quantity of the commodities consumed by different sequences of the user is different, the output of the GRU neural network is spliced with the sequence data to be used as the input of the next GRU neural network, wherein hkThe method comprises the current consumption characteristics of a user, and through three times of GRU neural network integration and filtration, the consumption data of the user is effectively increased, the consumption characteristic information of the user is enriched, and the consumption characteristic information of the user is increasedThe accuracy of learning the consumption behaviors of the user is improved.

Further, step S3 specifically includes:

s31, calculating the weights of different commodities according to an equation (4), wherein the equation (4) is as follows:

in the formula, W5、W6Is a weight matrix, σ is an activation function, vTWhich represents a linear transformation, is shown,for updating the last hidden state value of the gate output, hqGRU neural network output for consuming the qth commodity for the user;

s32, calculating the weights of the different commodities according to a commodity-level attention mechanism function formula (5) to obtain the local interest of the user, wherein the commodity-level attention mechanism function formula (5) is as follows:

in the formula, atqAs weights of different commodities, hqAnd outputting the GRU neural network for consuming the q-th commodity for the user.

The beneficial effect of adopting the further scheme is that: because the user consumes the commodities under the influence of global interest, the output weights of consuming different commodities are calculated by utilizing the attention mechanism of commodity grade, the more relevant to all interests, the larger the weight is, and the smaller the weight is otherwise. The updating gate contains a large amount of consumption characteristic information of the user, local interest of the user is obtained through the updating gate, more consumption information related to all interest of the user can be concerned, less consumption characteristic information unrelated to the global interest of the user can be concerned, and model providing accuracy can be improved.

Further, the step S5 includes:

s51, converting the commodity data in the original consumption data, wherein the converted commodity data can be expressed as z ═ c (c)z1,z2,...zI);

S52, calculating the final interest and the converted commodity data according to a Softmax functional formula (6) to obtain the probability of commodity interaction of the user next time, wherein the Softmax functional formula (6) is as follows:

wherein I is the total number of commodities, zyIs the y-th commodity, T is the transpose, q is any commodity, hlIs the final interest;

s53, performing model training according to a cross entropy loss function formula (7), and obtaining a training model when an output loss value tends to be stable, wherein the cross entropy loss function formula (7) is as follows:

in formula (II) p'qPredicted probability value, p, for the next interactive commodity of the userqThe actual probability value of the next interactive commodity for the user;

and S54, predicting the next interactive behavior of the user according to the training model, and recommending commodity information to the user.

The beneficial effect of adopting the further scheme is that: the method has the advantages that the probability of the next commodity interaction of the user is calculated, then the cross entropy loss function is adopted for model training, the accuracy of the model learning of the next commodity interaction of the user can be improved, when the output loss value tends to be stable, the model composition is completed, the next interaction behavior of the user is predicted according to the model, and commodity information is recommended to the user.

In order to solve the above technical problem, the present invention further provides a sequence recommendation system based on a residual error network, including: the system comprises an initial module, an interest acquisition module and a training module;

the system comprises an initial module, a GRU neural network identification module and a data processing module, wherein the initial module is used for acquiring original consumption data of a user through a network, dividing the original consumption data into sequences to obtain sequence segments, and initializing the sequence segments to obtain sequence data for GRU neural network identification;

the interest acquisition module is used for outputting the sequence data based on a GRU neural network with a residual error structure, and taking an output hidden state as global interest data of a user; according to a commercial grade attention mechanism, calculating the sequence data and the hidden state to obtain local interest data of the user; splicing the global interest data and the local interest to obtain a final interest;

and the training module is used for calculating the probability distribution of the next interactive commodity of the user according to the final interest, carrying out model training according to the probability distribution to obtain a training model, predicting the next interactive behavior of the user according to the training model, and recommending commodity information to the user.

Further, the initial module comprises:

the raw consumption data comprises a time attribute;

dividing the original consumption data into a sequence according to a preset period to obtain a plurality of sequence segments, initializing each sequence segment to obtain sequence data, and expanding the sequence data according to a GRU neural network, wherein the sequence data can be expressed as x ═ k1,k2,...kn) And n represents the size of the time step.

Further, the interest obtaining module includes:

a global interest acquisition unit: performing GRU neural network output processing on the sequence data for the first time according to formula (1), and obtaining a plurality of hidden states h corresponding to the sequence data sequencen' the formula (1) is hn' -gru (x), x is sequence data;

associating the sequence data with the plurality of hidden states h according to equation (2)n'the last hidden state of the' is merged to obtain the updated gate output hnSaid update gate outputs hnThe formula (2) comprises original consumption data and current consumption characteristics of the user:

where σ is the activation function, W1、W2Is a weight matrix, b is a bias vector,is a Hadamard product, x is sequence data, hkIs hn' last hidden state;

outputting the update gate h according to equation (3)nSplicing with the sequence data, calculating a second GRU neural network output based on a residual error structure to obtain a plurality of hidden states corresponding to the sequence data sequenceThe formula (3) is:wherein x is sequence data, hnTo update the gate output;

combining the plurality of hidden statesSplicing with the sequence data, calculating the third GRU neural network output based on a residual error structure to obtain a plurality of hidden states h corresponding to the sequence data sequencen"; h is to ben"the last hidden state as the global interest of the user;

a local interest acquisition unit: calculating the weights of different commodities according to an equation (4), wherein the equation (4) is as follows:

in the formula, W5、W6Is a weight matrix, σ is an activation function, vTWhich represents a linear transformation, is shown,to update the last hidden state value output by the gate,hqGRU neural network output for consuming the qth commodity for the user;

calculating the weights of the different commodities according to a commodity-level attention mechanism function (5) to obtain the local interest of the user, wherein the commodity-level attention mechanism function (5) is as follows:

in the formula, atqAs weights of different commodities, hqGRU neural network output for consuming the qth commodity for the user;

a final interest acquisition unit: and splicing the global interest of the user and the local interest of the user to obtain the final interest of the user.

Drawings

Fig. 1 is a flowchart of a sequence recommendation method based on a residual error network according to an embodiment of the present invention;

fig. 2 is a schematic diagram of a last hidden state output by a GRU neural network of a sequence recommendation method based on a residual error network according to an embodiment of the present invention;

fig. 3 is a schematic overall framework diagram of a sequence recommendation method based on a residual error network according to an embodiment of the present invention;

fig. 4 is a schematic structural diagram of a sequence recommendation system based on a residual error network according to an embodiment of the present invention.

Detailed Description

The principles and features of this invention are described below in conjunction with the following drawings, which are set forth by way of illustration only and are not intended to limit the scope of the invention.

Example one

As shown in fig. 1, a sequence recommendation method based on a residual error network includes the following steps:

step S1, acquiring original consumption data of a user through a network, dividing the original consumption data into sequences to obtain sequence segments, and initializing the sequence segments to obtain sequence data for GRU neural network identification;

step S2, based on GRU neural network of residual error structure, carrying out output processing to the sequence data, and taking the output hidden state as the global interest of the user;

step S3, according to a commercial grade attention mechanism, calculating the sequence data and the hidden state to obtain the local interest of the user;

step S4, splicing the global interest and the local interest to obtain a final interest;

and step S5, calculating the probability distribution of the next interactive commodity of the user according to the final interest, carrying out model training according to the probability distribution to obtain a training model, predicting the next interactive behavior of the user according to the training model, and recommending commodity information to the user.

In this embodiment, the sequence data is input to the GRU neural network based on the residual error structure, so that the feature information input by the GRU neural network is enriched, the feature information includes both the original data of the user and the feature information processed by the neural network, the consumption feature information of the user is extracted, the consumption behavior of the user can be accurately learned, and the accurate recommendation effect is realized.

Preferably, as an embodiment of the present invention, the original consumption data includes a time attribute, and the step S1 includes:

dividing the original consumption data into a sequence according to a preset period to obtain a plurality of sequence segments, initializing each sequence segment to obtain sequence data, and expanding the sequence data according to a GRU neural network, wherein the sequence data can be expressed as x ═ k1,k2,...kn) And n represents the size of the time step.

Wherein, the preset period is recommended to be a period of 7 days.

Wherein, the original consumption data comprises all commodity information sets consumed by the user; wherein the time step represents the length of the GRU neural network after deployment.

Preferably, as an embodiment of the present invention, the step S2 specifically includes:

s21, according to formula(1) Carrying out GRU neural network output processing on the sequence data for the first time, and obtaining a plurality of hidden states h corresponding to the sequence data sequencen', as shown in FIG. 2, the sequence data x is given by (k)1,k2,...kn) Inputting the hidden state into a GRU neural network, and correspondingly outputting a plurality of hidden states; the formula (1) is hn' -gru (x), x is sequence data;

s22, combining the sequence data and the hidden states h according to the formula (2)n'the last hidden state of the' is merged to obtain the updated gate output hnSaid update gate outputs hnIncluding the original consumption data and the current consumption characteristics of the user, and the formula (2) is:

where σ is the activation function, W1、W2Is a weight matrix, b is a bias vector,is a Hadamard product, x is sequence data, hkIs hn' last hidden state;

s23, outputting h by the updating gate according to the formula (3)nSplicing with the sequence data, calculating a second GRU neural network output based on a residual error structure to obtain a plurality of hidden states corresponding to the sequence data sequenceThe formula (3) is:wherein x is sequence data, hnTo update the gate output;

s24, hiding the plurality of hidden statesComputing residual structure-based data concatenation with said sequence dataOutputting by GRU neural network for the third time to obtain multiple hidden states h corresponding to the sequence data sequencen″;

S25, mixing the hn"as a global interest of the user.

Wherein, according to the formula:combining the plurality of hidden statesSplicing with the sequence data to obtain a plurality of hidden states h corresponding to the sequence data sequencen″。

In this embodiment, since the number of commodities consumed by different sequences of the user is different, the output of the GRU neural network and the sequence data are spliced as the input of the next GRU neural network, where h iskThe current consumption characteristics of the user are included, after the three times of GRU neural network integration filtering, the consumption data of the user are effectively increased, the consumption characteristic information of the user is enriched, and the accuracy of learning the consumption behavior of the user is improved.

Preferably, as an embodiment of the present invention, the step S3 specifically includes:

s31, calculating the weights of different commodities according to an equation (4), wherein the equation (4) is as follows:

in the formula, W5、W6Is a weight matrix, σ is an activation function, vTWhich represents a linear transformation, is shown,for updating the last hidden state value of the gate output, hqGRU neural network output for consuming the qth commodity for the user;

s32, calculating the weights of the different commodities according to a commodity-level attention mechanism function formula (5) to obtain the local interest of the user, wherein the commodity-level attention mechanism function formula (5) is as follows:

in the formula, atqAs weights of different commodities, hqAnd outputting the GRU neural network for consuming the q-th commodity for the user.

Wherein, according to the formula:get updated gate outputTo update the gate outputOf the last hidden state value of, whereinIs hn"the last hidden state, i.e., the user's global interests;

wherein, according to the formula: h isq=GRU(xq) Obtaining GRU neural network output h of the q-th commodity consumed by the userq

In this embodiment, since the user consumes the commodity under the influence of the global interest, the output weights of consuming different commodities are calculated by using the attention mechanism of the commodity level, and the more relevant to all interests, the larger the weight is, and the smaller the weight is otherwise. WhileContaining a large amount of consumption characteristic information of usersThe local interest of the user is obtained, more consumption information related to the whole interest of the user can be concerned, less consumption characteristic information unrelated to the global interest of the user can be concerned, and the accuracy of the recommendation system can be improved.

Preferably, as an embodiment of the present invention, the step S5 specifically includes:

s51, converting the commodity data in the original consumption data, wherein the converted commodity data can be expressed as z ═ (z)1,z2,...zI);

S52, calculating the final interest and the converted commodity data according to a Softmax functional formula (6) to obtain the probability of commodity interaction of the user next time, wherein the Softmax functional formula (6) is as follows:

wherein I is the total number of commodities, zyIs the y-th commodity, T is the transpose, q is any commodity, hlIs the final interest;

s53, performing model training according to a cross entropy loss function formula (7), and obtaining a training model when an output loss value tends to be stable, wherein the cross entropy loss function formula (7) is as follows:

in formula (II) p'qPredicted probability value, p, for the next interactive commodity of the userqThe actual probability value of the next interactive commodity for the user;

and S54, predicting the next interactive behavior of the user according to the training model, and recommending commodity information to the user.

Splicing the global interest of the user and the local interest of the user to obtain the final interest h of the userl

The commodity information is recommended to the user in an information flow mode.

In the embodiment, after the probability of the next commodity interaction of the user is calculated, the cross entropy loss function is adopted for model training, so that the accuracy of the model for learning the next commodity interaction of the user can be improved, when the output loss value tends to be stable, the model composition is completed, the next interaction behavior of the user is predicted according to the model, and the commodity information is recommended to the user.

Example two

For convenience of understanding, the present embodiment describes a sequence recommendation method based on a residual error network with a more specific example, as shown in fig. 3, the sequence recommendation method based on the residual error network includes:

s1, inputting the user sequence data x into GRU neural network for the first time, and outputting the hidden state sequence h through the update gaten

S2, the hidden state sequence hnAfter being spliced with the user sequence data x, the hidden state sequence is output for the second time through a GRU neural network to obtain a hidden state sequenceThe hidden state sequenceObtaining global interest through GRU neural network output for the third time after being spliced with the xAnd a last hidden state

S3, the last hidden state by attention mechanismGRU neural network output h with q-th commodityqGet local interest hj

S4, applying the global interestAnd local interest hjSplicing to obtain the final interest hl

S5, according to the Softmax function, regarding the final interest hlAnd originalCalculating commodity data converted from the consumption data to obtain the probability of the next interaction of the corresponding commodity by the user;

and S6, performing model training according to the probability distribution to complete the recommendation of the user.

The original consumption data comprises all commodity information sets consumed by the user; and expanding the original consumption data to obtain user sequence data.

EXAMPLE III

The present embodiment provides a sequence recommendation system for a residual error network, as shown in fig. 4, including: the system comprises an initial module, an interest acquisition module and a training module;

the system comprises an initial module, a GRU neural network identification module and a data processing module, wherein the initial module is used for acquiring original consumption data of a user through a network, dividing the original consumption data into sequences to obtain sequence segments, and initializing the sequence segments to obtain sequence data for GRU neural network identification;

the interest acquisition module is used for outputting the sequence data based on a GRU neural network with a residual error structure, and taking an output hidden state as global interest data of a user; according to a commercial grade attention mechanism, calculating the sequence data and the hidden state to obtain local interest data of the user; splicing the global interest data and the local interest to obtain a final interest;

and the training module is used for calculating the probability distribution of the next interactive commodity of the user according to the final interest, carrying out model training according to the probability distribution to obtain a training model, predicting the next interactive behavior of the user according to the training model, and recommending commodity information to the user.

Preferably, as an embodiment of the present invention, the initial module includes:

the raw consumption data comprises a time attribute;

dividing the original consumption data into a sequence according to a preset period to obtain a plurality of sequence segments, initializing each sequence segment to obtain sequence data, and expanding the sequence data according to a GRU neural network, wherein the sequence data can be expressed as x ═ k1,k2,...kn) And n represents the size of the time step.

Preferably, as an embodiment of the present invention, the interest obtaining module includes:

a global interest acquisition unit: performing GRU neural network output processing on the sequence data for the first time according to formula (1), and obtaining a plurality of hidden states h corresponding to the sequence data sequencen' the formula (1) is hn' -gru (x), x is sequence data;

associating the sequence data with the plurality of hidden states h according to equation (2)n'the last hidden state of the' is merged to obtain the updated gate output hnSaid update gate outputs hnThe formula (2) comprises original consumption data and current consumption characteristics of the user:

where σ is the activation function, W1、W2Is a weight matrix, b is a bias vector,is a Hadamard product, x is sequence data, hkIs hn' last hidden state;

outputting the update gate h according to equation (3)nSplicing with the sequence data, calculating a second GRU neural network output based on a residual error structure to obtain a plurality of hidden states corresponding to the sequence data sequenceThe formula (3) is:wherein x is sequence data, hnTo update the gate output;

combining the plurality of hidden statesSplicing with the sequence data, calculatingOutputting a GRU neural network for the third time based on a residual error structure to obtain a plurality of hidden states h corresponding to the sequence data sequencen"; h is to ben"the last hidden state as the global interest of the user;

a local interest acquisition unit: calculating the weights of different commodities according to an equation (4), wherein the equation (4) is as follows:

in the formula, W5、W6Is a weight matrix, σ is an activation function, vTWhich represents a linear transformation, is shown,for updating the last hidden state value of the gate output, hqGRU neural network output for consuming the qth commodity for the user;

calculating the weights of the different commodities according to a commodity-level attention mechanism function (5) to obtain the local interest of the user, wherein the commodity-level attention mechanism function (5) is as follows:

in the formula, atqAs weights of different commodities, hqGRU neural network output for consuming the qth commodity for the user;

a final interest acquisition unit: and splicing the global interest of the user and the local interest of the user to obtain the final interest of the user.

The present embodiment further provides a sequence recommendation system based on a residual error network, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the steps of the sequence recommendation method based on a residual error network are implemented when the computer program is executed by the processor, and are not described herein again.

The present embodiment also provides a storage medium, where the storage medium includes one or more computer programs stored therein, and the one or more computer programs may be executed by one or more processors to implement the steps of the sequence recommendation method based on the residual error network in the foregoing embodiments, which are not described herein again.

The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.

In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.

Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present invention.

In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.

The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.

The technical solutions provided by the embodiments of the present invention are described in detail above, and the principles and embodiments of the present invention are explained in this patent by applying specific examples, and the descriptions of the embodiments above are only used to help understanding the principles of the embodiments of the present invention; the present invention is not limited to the above preferred embodiments, and any modifications, equivalent replacements, improvements, etc. within the spirit and principle of the present invention should be included in the protection scope of the present invention.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:模型训练方法及相关系统、存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!