Book recommendation method and system based on time sequence gating network, terminal equipment and medium

By modeling with multi-head attention and long short-term memory networks using temporal gating networks, and dynamically integrating users' early and recent book interests, the problem of ignoring changes in user interests in traditional recommendation systems is solved, thus improving the accuracy and personalization of book recommendations.

CN120832445APending Publication Date: 2025-10-24COMMUNICATION UNIVERSITY OF CHINA
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511326244.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-17
Publication Date
2025-10-24

AI Technical Summary

Technical Problem

Traditional book recommendation systems fail to effectively capture the dynamic characteristics of user interests changing over time, resulting in a mismatch between recommendation results and users' current interests and needs, especially when user interests change, leading to a decrease in accuracy.

Method used

We employ a temporal gating network-based approach, modeling users' early and recent book interests using a multi-head attention mechanism and a long short-term memory network, respectively. By dynamically fusing long and short-term features using gating vectors, we construct a comprehensive user interest feature vector and generate book recommendation results.

Benefits of technology

It effectively captures the dynamic evolution of user interests over time, balances early stable interests with recent abrupt changes in preferences, and improves the adaptability of recommendation models to user interest migration and recommendation accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120832445A_ABST
    Figure CN120832445A_ABST
Patent Text Reader

Abstract

The invention discloses a book recommendation method and system based on a time sequence gating network, terminal equipment and a medium, and relates to the technical field of book recommendation, and the method comprises the steps: constructing user features; constructing a book acquisition sequence based on a user historical book acquisition time record, and segmenting the book acquisition sequence into a first book acquisition sequence and a second book acquisition sequence; constructing book features based on the book topics; modeling book features of the first and second book acquisition sequences by using a multi-head attention mechanism and a long-short-term memory network to obtain first and second feature vectors representing early and recent book interests of the user; and constructing a gating vector to fuse the user features, the first feature vector and the second feature vector to obtain a fused feature vector, predicting the probability that the user obtains the book, and generating a book recommendation result. According to the method, book interest characteristics of the user in different periods are fused through the time sequence gating network, user interest changes are dynamically adapted in combination with a gating mechanism, and the accuracy and individuation degree of book recommendation are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of book recommendation, and in particular to a book recommendation method and system based on a time sequence gating network, a terminal device and a medium. BACKGROUND

[0002] In the field of book recommendation, traditional recommendation systems mostly build models based on static user portraits or historical behavior statistics, generally ignoring the dynamic characteristics of users' interests in books changing over time in the form of reading, purchasing, borrowing, etc. For example, collaborative filtering algorithms only rely on the interaction frequency between users and books, without considering the time sequence of obtaining books. Early deep learning models, such as matrix decomposition, although introduce feature embedding, lack explicit modeling of the time dimension, and cannot capture the evolution of users' interests over time.

[0003] In the prior art, some solutions attempt to divide user behavior sequences by time windows, but do not distinguish between early book interests and recent preferences. For example, models based on recurrent neural networks (RNN) can handle time series data, but it is difficult to balance the stability of early book interests and the mutability of recent book interests. Models that simply rely on attention mechanisms lack deep modeling of time-dependent relationships, resulting in an inability to accurately identify the time decay characteristics of users' interests. In other words, the prior art does not construct an effective time interest modeling mechanism, and cannot dynamically integrate users' book acquisition features at different times, resulting in a mismatch between book recommendation results and users' current interest needs, especially when users' interests change significantly, such as when academic research directions are adjusted or reading preferences are migrated, the accuracy of recommendations decreases significantly.

[0004] Therefore, there is an urgent need for a recommendation method to solve the above problems to fill the gap in the prior art. SUMMARY

[0005] The technical problem to be solved by the present application is that in the field of book recommendation, traditional book recommendation systems ignore the dynamic characteristics of users' interests changing over time, and existing technologies such as collaborative filtering, early deep learning models and some time sequence processing solutions either do not consider the time sequence of obtaining books, or lack explicit modeling of the time dimension, or are difficult to balance the differences between early and recent book interests, and cannot effectively construct a time interest modeling mechanism, dynamically integrate users' book acquisition features at different times, resulting in a mismatch between book recommendation results and users' current interest needs, and a significant decrease in recommendation accuracy when users' interests change.

[0006] To solve the above technical problems, the technical solutions adopted by the present application are as follows: In a first aspect, the present application provides a book recommendation method based on a time sequence gating network, comprising: constructing a user feature based on user attributes; constructing a time-ordered book acquisition sequence based on user historical book acquisition time records, and dividing the book acquisition sequence into a first book acquisition sequence and a second book acquisition sequence at a preset position, wherein the book acquisition time in the first book acquisition sequence is earlier than the book acquisition time in the second book acquisition sequence; constructing a book feature based on book titles in the book acquisition sequence; modeling the book feature of the first book acquisition sequence using a multi-head attention mechanism to obtain a first feature vector representing the user's early book interest; modeling the book feature of the second book acquisition sequence using a long short-term memory network to obtain a second feature vector representing the user's recent book interest; constructing a gating vector based on the user feature, the first feature vector, and the second feature vector, and fusing the first feature vector and the second feature vector through the gating vector to obtain a fusion feature vector representing the user's comprehensive interest; based on the fusion feature vector and the user feature, predicting the probability of the user acquiring a book and generating a book recommendation result.

[0007] In an implementation manner, the user attributes include several category features, and the constructing a user feature based on user attributes includes: for each category feature in the user attributes, encoding the feature vector of the category feature; mapping the feature vector of the category feature to a low-dimensional dense vector through an embedding matrix; concatenating the low-dimensional dense vectors of all category features to obtain the user feature.

[0008] In an implementation manner, the constructing a book feature based on book titles in the book acquisition sequence includes: for each book in the book acquisition sequence, performing word segmentation on the book title to obtain a word sequence of the book title; selecting the word sequence of the book title using the term frequency-inverse document frequency method to obtain a preset number of attribute words; performing feature conversion and concatenation on the attribute words to obtain the book feature.

[0009] In an implementation manner, the modeling the book feature of the first book acquisition sequence using a multi-head attention mechanism to obtain a first feature vector representing the user's early book interest includes: converting the first book acquisition sequence book feature into a query vector, a key vector, and a value vector through a parameter matrix; a plurality of attention heads are divided, and an output vector of each attention head is calculated based on the query vector, the key vector, and the value vector; The output vectors of all the attention heads are spliced to obtain a first feature vector.

[0010] In an implementation, the modeling of the book features of the second book acquisition sequence using the long short-term memory network to obtain a second feature vector representing the user's recent book interest includes: The book features of the second book acquisition sequence are input into the long short-term memory network, and a hidden vector of a last time step of the long short-term memory network is extracted as a preliminary second feature vector; The attention calculation is performed on all the time step hidden vectors of the long short-term memory network with the user feature as a query vector to obtain an attention weight of each time step; The hidden vectors of all the time steps are weighted and summed based on the attention weight to generate a user personalized feature vector; The preliminary second feature vector and the user personalized feature vector are spliced along a channel dimension, and compressed through a fully connected layer to obtain a second feature vector.

[0011] In an implementation, the constructing of a gating vector based on the user feature, the first feature vector, and the second feature vector, and the fusion of the first feature vector and the second feature vector through the gating vector to obtain a fusion feature vector representing the user's comprehensive interest includes: The gating vector is constructed , and the expression is:

[0012] wherein, represents the user, represents the user feature, represents the first feature vector, represents the second feature vector, is a bias term, , , is a weight matrix; The fusion feature vector is calculated, and the fusion feature vector represents the user's comprehensive interest, and the expression is:

[0013] wherein, represents element-wise multiplication.

[0014] In one implementation, predicting the probability of a user acquiring a book and generating a book recommendation result based on the fused feature vector and the user features includes: Concatenate the fusion feature vector and the user feature along the dimension to obtain a user comprehensive interest vector; Concatenating the user comprehensive interest vector with the book features of each book to obtain a user-book feature pair; The fully connected layer is used to reduce the dimension of each user-book feature pair and calculate the similarity of the user's interest in each book; Normalizing the interest similarity to obtain the probability distribution of users acquiring each book; Sort by probability from high to low, and select a preset number of top-ranked books as book recommendation results.

[0015] In a second aspect, an embodiment of the present invention further provides a book recommendation system based on a temporal gating network, the system comprising: User feature building module, used to build user features based on user attributes; A book acquisition sequence construction module is used to construct a book acquisition sequence sorted by time based on the user's historical book acquisition time records, and to split the book acquisition sequence into a first book acquisition sequence and a second book acquisition sequence at a preset position, wherein the book acquisition time in the first book acquisition sequence is earlier than the book acquisition time in the second book acquisition sequence; A book feature construction module, configured to construct book features based on the book titles in the book acquisition sequence; A first feature vector construction module is configured to use a multi-head attention mechanism to model the book features of the first book acquisition sequence to obtain a first feature vector representing the user's early book interests; a second feature vector construction module, configured to use a long short-term memory network to model the book features of the second book acquisition sequence to obtain a second feature vector representing the user's recent book interests; a fusion feature vector construction module, configured to construct a gating vector based on the user features, the first feature vector, and the second feature vector, and fuse the first feature vector and the second feature vector using the gating vector to obtain a fusion feature vector representing the user's comprehensive interests; The book recommendation result acquisition module is used to predict the probability of the user acquiring the book based on the fused feature vector and the user characteristics and generate a book recommendation result.

[0016] In a third aspect, an embodiment of the present invention further provides a terminal device, comprising a memory, a processor, and a book recommendation program based on a temporal gating network stored in the memory and executable on the processor. When the processor executes the book recommendation program based on a temporal gating network, the steps of the book recommendation method based on a temporal gating network described in any one of the above-mentioned schemes are implemented.

[0017] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a book recommendation program based on a temporal gating network is stored. When the book recommendation program based on a temporal gating network is executed by a processor, the steps of the book recommendation method based on a temporal gating network described in any one of the above-mentioned schemes are implemented.

[0018] Beneficial effect: The present invention discloses a book recommendation method, system, terminal device and medium based on a temporal gating network, which relates to the field of book recommendation technology. The method constructs user features based on user attributes; constructs a time-sorted book acquisition sequence based on the user's historical book acquisition time records, and divides the book acquisition sequence into a first book acquisition sequence and a second book acquisition sequence at a preset position, wherein the book acquisition time in the first book acquisition sequence is earlier than the book acquisition time in the second book acquisition sequence; constructs book features based on the book titles in the book acquisition sequence; uses a multi-head attention mechanism to model the book features of the first book acquisition sequence to obtain a first feature vector representing the user's early book interest; uses a long short-term memory network to model the book features of the second book acquisition sequence to obtain a second feature vector representing the user's recent book interest; constructs a gating vector based on the user features, the first feature vector and the second feature vector, and fuses the first feature vector and the second feature vector through the gating vector to obtain a fused feature vector representing the user's comprehensive interest; based on the fused feature vector and the user features, predicts the probability of the user acquiring a book and generates a book recommendation result. This paper constructs a temporal gating network, dividing the book acquisition sequence into early and recent sequences. It then utilizes a multi-head attention mechanism and a long-short-term memory network to model a user's early and recent book interests, respectively. This approach dynamically fuses long-term and short-term features with user characteristics through gating vectors. This paper effectively addresses the problem of traditional recommendation systems ignoring changes in user interests over time. It can capture the temporal dynamics of user interests, balance early stable interests with recent preference mutations, and improve the recommendation model's adaptability to user interest shifts. By fusing feature vectors with user characteristics to generate book recommendations, it can accurately match users' current interests and needs, improving the accuracy and personalization of book recommendations. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1The flow chart of the specific implementation of the book recommendation method based on the time sequence gating network provided by the embodiment of the present application is shown.

[0020] Figure 2 The schematic diagram of the time sequence gating network structure provided by the embodiment of the present application is shown.

[0021] Figure 3 The principle block diagram of the book recommendation device based on the time sequence gating network provided by the embodiment of the present application is shown.

[0022] Figure 4 The internal structure principle block diagram of the terminal device provided by the embodiment of the present application is shown. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical scheme and effect of the present application more clear and explicit, the present application is further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and do not limit the present application.

[0024] The flow chart shown in the drawings is only an example and does not necessarily include all the contents and operations or steps, nor does it necessarily execute in the order described. For example, some operations or steps can be further divided, combined or partially combined, so the actual execution order may be changed according to the actual situation.

[0025] It should be understood that the terms used in this application description are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in the present application description and the appended claims, the singular forms "a", "an" and "the" are intended to include the plural forms unless the context clearly indicates otherwise.

[0026] It should be understood that in order to facilitate the clear description of the technical scheme of the embodiments of the present application, in the embodiments of the present application, the same items or similar items with basically the same function and role are distinguished by using "first", "second" and the like. For example, the first control information and the second control information are only used to distinguish different control information and do not limit the order.

[0027] Those skilled in the art can understand that the terms "first", "second" and the like do not limit the quantity and execution order, and the terms "first", "second" and the like do not necessarily mean different.

[0028] It should also be understood that the term "and / or" used in the present application description and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.

[0029] In the field of book recommendation, traditional recommendation systems are mostly based on static user portraits or historical behavior statistics to construct models, generally ignoring the dynamic change of users' interest in books over time in the form of reading, purchasing, borrowing, etc. For example, the collaborative filtering algorithm only relies on the interaction frequency between users and books, without considering the time sequence of obtaining books. Early deep learning models, such as matrix decomposition, although introduce feature embedding, lack explicit modeling of the time dimension, and cannot capture the evolution of users' interest over time.

[0030] In the prior art, some solutions attempt to divide user behavior sequences by time windows, but do not distinguish between early book interest and recent book interest. For example, models based on recurrent neural networks can handle time series data, but it is difficult to balance the stability of early book interest and the mutability of recent book interest. Models that simply rely on attention mechanisms lack deep modeling of time-dependent relationships, resulting in an inability to accurately identify the time decay characteristics of user interest. In other words, the prior art does not construct an effective time interest modeling mechanism, and cannot dynamically integrate users' book acquisition features at different times, resulting in a mismatch between book recommendation results and users' current interest needs, especially when users' interest changes significantly, such as academic research direction adjustment, reading preference migration, etc. The accuracy of recommendations is greatly reduced.

[0031] Figure 2 A schematic diagram of the time sequence gating network structure proposed by the present application is shown. In the time sequence gating network structure, first, it can be seen that the user feature is derived from the dense feature generation of user attributes. The first feature vector representing the user's early book interest is derived from the user's first book acquisition sequence, i.e. the early book acquisition sequence. The second feature vector representing the user's recent book interest is derived from the user's second book acquisition sequence, i.e. the recent book acquisition sequence. The fusion feature vector representing the user's comprehensive interest is derived from the gating fusion of the above three features. The book recommendation result is derived from the fusion of the fusion feature vector and the book feature. The time sequence gating network structure designed by the present application effectively solves the problem of traditional recommendation systems ignoring the change of users' interest over time.

[0032] The book recommendation method based on the time sequence gating network provided in this embodiment, as shown in Figure 1 includes the following steps: Step S100, constructing user features based on user attributes.

[0033] In this embodiment, the library lending and returning records are used as the time records of readers obtaining books, and the reader information in the library lending and returning records is used as the user attributes to construct the corresponding user features. The represents the library borrowing user, represents the library collection, User attributes of the jth user. Optionally, the purchase records of the user at book sources such as Internet stores, physical bookstores, etc. can also be used as the book acquisition time records, and the user information at the time of purchase can be used as the user attributes. The book can be a paper book or an electronic book, etc. In addition to borrowing, purchasing, etc., other records of the user's interest in the book such as the user's clicking on the book summary can also be used to obtain the user attributes and the book acquisition records.

[0034] In an implementation manner, the user attributes include a plurality of category features, and the user feature is constructed based on the user attributes, specifically including the following steps: In step S110, for each category feature in the user attributes, a feature vector of the category feature is encoded and constructed; In step S120, the feature vector of the category feature is mapped to a low-dimensional dense vector by an embedding matrix; In step S130, the low-dimensional dense vectors of all category features are spliced to obtain the user feature.

[0035] In this embodiment, the library borrowing records are used as the user attribute data source, and a plurality of attributes such as the reader code, gender, reader type, reader unit, certificate status, certificate duration, and whether to open interlibrary borrowing are selected from the reader borrowing data to construct the user feature. Each attribute of the user belongs to a category feature, and the embedding technology is used to convert it into a low-dimensional dense vector.

[0036] For any attribute with a value number of , a feature vector is constructed by one-hot encoding, and then an embedding matrix is constructed, where represents a real set, is a pre-defined hyperparameter, and one-hot encoding means that for a category feature with multiple discrete values, one-hot encoding assigns a separate binary bit to each possible value. When a feature takes this value, the corresponding binary bit is 1, and the remaining bits are 0. In addition, the values in the embedding matrix can be optimized by training. Finally, the embedding matrix and the feature vector are multiplied to obtain a dense vector . By controlling the value of C, a suitable low-dimensional dense vector is obtained. All attribute features are spliced along the feature dimension to obtain the final user feature , and the expression is:

[0037] wherein, represents a set of attribute features of the user u, represents a dense vector of the attribute . for a certain specific attribute in the attribute with the value number .

[0038] Step S200, based on the user historical book acquisition time record, a time-ordered book acquisition sequence is constructed, and the book acquisition sequence is cut into a first book acquisition sequence and a second book acquisition sequence at a preset position, wherein the book acquisition time in the first book acquisition sequence is earlier than the book acquisition time in the second book acquisition sequence.

[0039] In this embodiment, as shown in Figure 2 , the historical book acquisition time record, i.e. the borrowing history record, of each reader user is sorted by acquisition time to obtain a book acquisition sequence . Among them, represents the book identification, which specifically represents a certain specific book borrowed by the reader, represents the borrowing history of the reader . On this basis, the most recent book acquisition record of each user is regarded as the recent borrowing distance, and the book acquisition sequence is cut into the first book acquisition sequence and the second book acquisition sequence. The first book acquisition sequence represents the early book acquisition record, and the second book acquisition sequence represents the recent book acquisition record.

[0040] Step S300, constructing a book feature based on the book title in the book acquisition sequence.

[0041] In this embodiment, unlike the traditional e-commerce recommendation system which identifies goods with a simple serial number, information is mined from the title of the book to construct a book feature vector to represent each book.

[0042] In one implementation, the constructing a book feature based on the book title in the book acquisition sequence specifically includes the following steps: Step S310, for each book in the book acquisition sequence, the book title is segmented to obtain a word sequence of the book title; Step S320, using the term frequency-inverse document frequency method to select the word sequence of the book title to obtain a preset number of attribute words; Step S330, performing feature conversion and splicing on the attribute words to obtain a book feature.

[0043] In this embodiment, first, the book title is divided into a word sequence by using the N-gram language model-based segmentation method, and then the term frequency-inverse document frequency (TF-IDF, Term Frequency-Inverse Document Frequency) method is used to select keywords as attributes of the book.

[0044] TF-IDF is a statistical method used to evaluate the importance of words in a corpus. It first calculates the normalized frequency of words in the text using the following formula:

[0045] in, Representing words In the documentation The number of times it appears in Representing words In the documentation The frequency of occurrence in Indicates traversal of documents All words in the document The sum of the number of occurrences of all words in .

[0046] Some common words appear frequently but are irrelevant to the document topic, while some words that appear in only a small number of documents have a significant impact on document attributes. Therefore, we further use the Inverse Document Frequency (IDF) method in the TF-IDF method to represent the prevalence of keywords. The calculation formula is as follows:

[0047] in, Indicates the number of all documents, Indicates that it contains words The number of documents containing the word . The fewer the number of documents, The larger the value of , the more significant the word's document distinguishing ability.

[0048] The TF-IDF method uses and The importance of a word is expressed by the product of:

[0049] Select each book The three words with the highest values ​​are used as book attributes. For example, when constructing book features for a book titled "Study Guide for X-Technology and X-Technology," the three attribute words are "X-Technology," "X-Technology," and "Guidance." When constructing book features for a book titled "Study Guide and Explanations for X-Technology and X-Technology," the three attribute words are "X-Technology," "X-Technology," and "Explanations."

[0050] Finally, the Word2Vec method is used to convert the attribute words into feature vectors, and they are concatenated along the feature dimension as the final feature z of the book.

[0051] Step S400: Use a multi-head attention mechanism to model the book features of the first book acquisition sequence to obtain a first feature vector representing the user's early book interests.

[0052] In this embodiment, the attention mechanism can be used to aggregate different vectors of the sequence into a vector feature by assigning different weight parameters to them. Self-attention is a special form of attention mechanism that uses the sequence itself as 、 and vector to perform calculations. 、 and Represent the query vector, key vector, and value vector in the self-attention mechanism, respectively. Readers have multiple interests during the borrowing process. For example, when borrowing a reference book of exercises, key factors such as the subject, edition, and whether it contains exercise solutions may be key factors in their decision-making. A single attention network is unlikely to capture these multiple dimensions of interest. A multi-head attention network allows the model to simultaneously focus on information from different representation subspaces at different locations, enabling it to model user preferences from multiple interest perspectives and obtain a more comprehensive representation. Multi-head attention can be introduced into the temporal modeling of early book acquisition interests. A multi-head attention network is used to model the feature sequence as a feature vector of a user's early book acquisition interests.

[0053] In one implementation, the method of using a multi-head attention mechanism to model the book features of the first book acquisition sequence to obtain a first feature vector representing the user's early book interests specifically includes the following steps: Step S410: converting the book features of the first book acquisition sequence into a query vector, a key vector, and a value vector through a parameter matrix; Step S420: Divide the attention heads into a plurality of attention heads, and calculate the output vector of each attention head based on the query vector, the key vector, and the value vector; Step S430: Concatenate the output vectors of all attention heads to obtain the first eigenvector.

[0054] In this embodiment, given the reader Early borrowing sequence ,The multi-head attention network is expressed as:

[0055] in, is a set hyperparameter used to define the number of recent book acquisition records of users. Indicates readers the number of elements contained in the early borrowing sequence of the user, represents the first feature vector, i.e., the user's early book acquisition interest feature, is a learnable parameter matrix, is a set hyperparameter, representing the dimension of the final output vector of the multi-head attention network, i.e., the size of the feature space after the model encodes the user's interest, represents the number of attention heads, represents the feature dimension output by each attention head. Each represents a single intrinsic interest of the reader, which can be represented as:

[0056] wherein, , is a learnable transformation parameter matrix of the query , key , and value vectors. Let , , , the attention score matrix is defined as follows:

[0057] The attention weight matrix is obtained by softmax:

[0058] The output of the attention head is obtained by weighted summation: .

[0059] Step S500, using a long short-term memory network to model the book features of the second book acquisition sequence, to obtain a second feature vector representing the user's recent book interest.

[0060] In an implementation manner, the using a long short-term memory network to model the book features of the second book acquisition sequence, to obtain a second feature vector representing the user's recent book interest, specifically includes the following steps: Step S510, inputting the book features of the second book acquisition sequence into the long short-term memory network, and extracting the hidden vector of the last time step of the long short-term memory network as a preliminary second feature vector; Step S520, taking the user feature as a query vector, performing attention calculation on all time step hidden vectors of the long short-term memory network to obtain an attention weight of each time step; Step S530, performing weighted summation on the hidden vectors of all time steps based on the attention weight, to generate a user personalized feature vector; Step S540: Concatenate the preliminary second feature vector and the user personalized feature vector along the channel dimension, and compress them through a fully connected layer to obtain a second feature vector.

[0061] In this embodiment, given the reader Recent book acquisition sequence ,Long Short-Term Memory (LSTM) can be expressed as:

[0062]

[0063]

[0064]

[0065]

[0066] in, , and denote input, forget and output gating units respectively, represents the activation function, 、 、 、 All are bias terms. Represents the unit state vector, used to carry The information transmitted flows between each time step. Represents the hidden output vector. The layered long short-term memory network models the reader's recent book acquisition sequence, using the hidden vector of the last time step of the last layer. To indicate readers The preliminary second eigenvector of .

[0067] Considering that different readers have different preferences for the books they have borrowed, a user attention module is introduced based on the user's recent book acquisition features to mine more fine-grained personalized information. The long short-term memory network is used to process the user's recent borrowing records, and the hidden vector of the last time step is used. To indicate readers Based on this, the hidden vector of each time step is taken out to form a feature sequence , and use the user's embedding vector Use the query vector to focus on the feature sequence The attention weight is calculated as follows:

[0068] The final user personalized feature vector is obtained by weighted summation of all hidden feature vectors:

[0069] The preliminary second feature vector is obtained by: The user personalized feature vector is obtained by: The second feature vector for representing the user's recent book interest is obtained by concatenating along the channel dimension, using a fully connected layer to compress the vector:

[0070] wherein, represents a concatenation operation, .

[0071] Step S600, constructing a gating vector based on the user feature, the first feature vector and the second feature vector, and fusing the first feature vector and the second feature vector through the gating vector to obtain a fusion feature vector representing the user's comprehensive interest.

[0072] In this embodiment, after obtaining the first feature vector and the second feature vector of the reader user, a gating mechanism is used to fuse the two. The reason for designing to fuse by using the gating mechanism is that in actual application, the borrowing needs of readers are various and the long-term behavior is very complex and rich. Simply concatenating the early book interest and the recent book interest or adding and fusing through the weighted attention mechanism cannot effectively integrate the information of the two.

[0073] In one implementation, the constructing a gating vector based on the user feature, the first feature vector and the second feature vector, and fusing the first feature vector and the second feature vector through the gating vector to obtain a fusion feature vector representing the user's comprehensive interest, specifically includes the following steps: Step S610, constructing a gating vector , and the expression is:

[0074] wherein, represents a user, represents a user feature, represents a first feature vector, represents a second feature vector, is a bias term, , , is a weight matrix; Step S620, calculating a fusion feature vector ​The fusion feature vector represents the comprehensive interest of the user, and the expression is:

[0075] wherein, represents element-wise multiplication.

[0076] In this embodiment, by adjusting the weight of the gating vector , the dynamic weighting fusion of the user's recent book interest and early book interest is realized, the change characteristics of the interest over time are adapted, and the timing evolution law of the user's interest can be captured, especially in the interest mutation scenario, the contribution proportion of long-term and short-term interest can be dynamically adjusted. By function, the gating value between 0 and 1 is output, and the fusion proportion of long-term and short-term interest is flexibly controlled, avoiding the over-reliance of the traditional model on the interest of a single period.

[0077] Step S700, based on the fusion feature vector and the user feature, predicting the probability of the user obtaining the book and generating a book recommendation result.

[0078] In this embodiment, by fusing the feature vector and the user feature, the combination of the user's timing interest feature and the user's attribute feature is realized, so that the recommendation model can capture the time dynamic change and personalized preference of the user's interest, and effectively improve the matching degree of the book recommendation result and the user's current demand.

[0079] In one implementation mode, the step of predicting the probability of the user obtaining the book based on the fusion feature vector and the user feature and generating a book recommendation result specifically includes the following steps: Step S710, concatenating the fusion feature vector and the user feature along the dimension to obtain a user comprehensive interest vector; Step S720, concatenating the user comprehensive interest vector and the book feature of each book respectively to obtain a user-book feature pair; Step S730, reducing the dimension of each user-book feature pair through a fully connected layer to calculate the interest similarity of the user to each book; Step S740, normalizing the interest similarity to obtain the probability distribution of the user obtaining each book; Step S750, sorting by probability from high to low, and selecting a preset number of top-ranked books as the book recommendation result.

[0080] In this embodiment, the fused feature vector and the user feature are first spliced ​​along the feature dimension to form a user comprehensive interest vector that includes temporal dynamic interests and inherent attributes. Preferably, the features are standardized before splicing to ensure that the numerical ranges of features in different dimensions are consistent, thereby improving the model convergence efficiency. Then, the feature vector of each book is extracted from the library library, and the extraction method is the same as the aforementioned book feature extraction method. The extracted feature vector of each book is spliced ​​element by element with the user comprehensive interest vector to generate a multi-dimensional user-book feature pair. For scenarios with a large number of books, the scope can be narrowed down by pre-screening or other methods. Next, the user-book feature pair is reduced in dimensionality through a multi-layer fully connected network, and the high-dimensional features are mapped to a low-dimensional semantic space. After dimensionality reduction, the cosine similarity or dot product operation is used to calculate the user's interest similarity in the books, and the similarity result is normalized using the softmax function to convert it into a probability distribution of the user's acquisition of each book. Preferably, cosine similarity is used to calculate interest similarity because it can measure the directional consistency of feature vectors and is suitable for capturing semantic associations of user interests. Finally, sort the books by probability from high to low, and select the top N books as the book recommendation results. The expression is:

[0081] in, Indicates readers Recommended books that interest you most.

[0082] In this way, the reader Borrowing history and its own properties To predict its borrowing Any book The probability of N books with the highest probability As a reader A method for recommending books that interest you the most.

[0083] In summary, under the technical solution of the above embodiment, by constructing a temporal gating network, the book acquisition sequence is divided into early and recent sequences, and the multi-head attention mechanism and long-short-term memory network are used to model the user's early and recent book interests respectively. The long-term and short-term features are dynamically fused with user characteristics through the gating vector. The present invention effectively solves the problem that traditional recommendation systems ignore the changes in user interests over time. It can capture the temporal dynamic evolution of user interests, balance early stable interests with recent preference mutations, and improve the adaptability of the recommendation model to user interest migration. By fusing feature vectors with user characteristics to generate book recommendation results, it can accurately match the user's current interests and needs, and improve the accuracy and personalization of book recommendations.

[0084] like Figure 3As shown in the above embodiment, the embodiment of the present application provides a book recommendation system based on a timing gating network, which comprises a user feature modeling module 10, a book acquisition sequence construction module 20, a book feature construction module 30, a first feature vector construction module 40, a second feature vector construction module 50, a fusion feature vector construction module 60, and a book recommendation result acquisition module 70.

[0085] Specifically, the user feature modeling module 10 is configured to construct user features based on user attributes; the book acquisition sequence construction module 20 is configured to construct a time-ordered book acquisition sequence based on user historical book acquisition time records, and divide the book acquisition sequence into a first book acquisition sequence and a second book acquisition sequence at a preset position, wherein the book acquisition time in the first book acquisition sequence is earlier than the book acquisition time in the second book acquisition sequence; the book feature construction module 30 is configured to construct book features based on book titles in the book acquisition sequence; the first feature vector construction module 40 is configured to model the book features of the first book acquisition sequence using a multi-head attention mechanism to obtain a first feature vector representing the user's early book interest; the second feature vector construction module 50 is configured to model the book features of the second book acquisition sequence using a long short-term memory network to obtain a second feature vector representing the user's recent book interest; the fusion feature vector construction module 60 is configured to construct a gating vector based on the user features, the first feature vector, and the second feature vector, fuse the first feature vector and the second feature vector through the gating vector, and obtain a fusion feature vector representing the user's comprehensive interest; and the book recommendation result acquisition module 70 is configured to predict the probability of the user acquiring a book and generate a book recommendation result based on the fusion feature vector and the user features.

[0086] Based on the above embodiment, the present application further provides a terminal device, the principle block diagram of which can be as shown in the figure. Figure 4 The terminal device comprises a processor, a memory, a network interface, a display screen, and a temperature sensor connected through a system bus. The processor of the terminal device is configured to provide computing and control capabilities. The memory of the terminal device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The network interface of the terminal device is configured to communicate with external terminals through network connection. The computer program is executed by the processor to implement a book recommendation method based on a timing gating network. The display screen of the terminal device can be a liquid crystal display screen or an electronic ink display screen. The temperature sensor of the terminal device is pre-set in the terminal device to detect the running temperature of the internal device.

[0087] Those skilled in the art can understand that Figure 4 The principle block diagram shown in the figure is only a block diagram of part of the structure related to the present application, and does not constitute a limitation on the terminal device to which the present application is applied. The specific terminal device can include more or less components than those shown in the figure, or combine certain components, or have a different component arrangement.

[0088] In one embodiment, a terminal device is provided, including a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors, the one or more programs containing instructions for performing the following operations: constructing a user feature based on a user attribute; constructing a time-ordered book acquisition sequence based on a user historical book acquisition time record, and cutting the book acquisition sequence into a first book acquisition sequence and a second book acquisition sequence at a preset position, wherein the book acquisition time in the first book acquisition sequence is earlier than the book acquisition time in the second book acquisition sequence; constructing a book feature based on the book titles in the book acquisition sequence; modeling the book feature of the first book acquisition sequence using a multi-head attention mechanism to obtain a first feature vector representing the user's early book interest; modeling the book feature of the second book acquisition sequence using a long short-term memory network to obtain a second feature vector representing the user's recent book interest; constructing a gating vector based on the user feature, the first feature vector and the second feature vector, and fusing the first feature vector and the second feature vector through the gating vector to obtain a fusion feature vector representing the user's comprehensive interest; predicting the probability of the user acquiring a book and generating a book recommendation result based on the fusion feature vector and the user feature.

[0089] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, storage, database or other medium used in the embodiments provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0090] In summary, the present application discloses a book recommendation method and system based on a timing gating network, a terminal device and a medium, which relates to the technical field of book recommendation. The method cuts the book acquisition sequence into early and recent sequences by constructing a timing gating network, models the user's early and recent book interest by using multi-head attention mechanism and long short-term memory network respectively, and dynamically fuses long-term and short-term features and user features through a gating vector. The present application effectively solves the problem that the traditional recommendation system ignores the change of user interest over time, can capture the timing dynamic evolution rule of user interest, balance the early stable interest and recent preference mutation, and improve the adaptability of the recommendation model to user interest migration. By fusing the feature vector and the user feature to generate a book recommendation result, the current interest demand of the user can be accurately matched, and the accuracy and individuality of book recommendation can be improved.

[0091] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, all possible combinations of the technical features in the above embodiments are not described, but as long as the combinations of the technical features do not exist contradictions, they should be considered as the scope of the present application.

[0092] The above-described embodiments are merely illustrative of several embodiments of the present application, and the description is relatively specific and detailed, but should not be understood as a limitation on the scope of the patent. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of protection of the present application should be subject to the appended claims.

Claims

1. A book recommendation method based on a timing-gated network, characterized by, The method comprises: constructing a user feature based on a user attribute; constructing a time-ordered book acquisition sequence based on a user history book acquisition time record, and cutting the book acquisition sequence into a first book acquisition sequence and a second book acquisition sequence at a preset position, wherein the book acquisition time in the first book acquisition sequence is earlier than the book acquisition time in the second book acquisition sequence; constructing a book feature based on the book titles in the book acquisition sequence; modeling the book feature of the first book acquisition sequence using a multi-head attention mechanism to obtain a first feature vector representing the user's early book interest; modeling the book feature of the second book acquisition sequence using a long short-term memory network to obtain a second feature vector representing the user's recent book interest; constructing a gating vector based on the user feature, the first feature vector and the second feature vector, fusing the first feature vector and the second feature vector through the gating vector to obtain a fusion feature vector representing the user's comprehensive interest; predicting the probability of the user acquiring a book and generating a book recommendation result based on the fusion feature vector and the user feature. 2.The method of claim 1, wherein, The user attribute includes several category features, and the construction of the user feature based on the user attribute comprises: for each category feature in the user attribute, encode the feature vector of the category feature; map the feature vector of the category feature to a low-dimensional dense vector through an embedding matrix; concatenate the low-dimensional dense vectors of all category features to obtain the user feature. 3.The method of claim 1, wherein, The construction of the book feature based on the book titles in the book acquisition sequence comprises: for each book in the book acquisition sequence, perform word segmentation on the book title to obtain a word sequence of the book title; select a preset number of attribute words from the word sequence of the book title using the term frequency-inverse document frequency method; perform feature conversion and concatenation on the attribute words to obtain the book feature. 4.The method of claim 1, wherein, The modeling of the book feature of the first book acquisition sequence using a multi-head attention mechanism to obtain a first feature vector representing the user's early book interest comprises: convert the first book acquisition sequence book feature into a query vector, a key vector and a value vector through a parameter matrix; divide a plurality of attention heads, and calculate the output vector of each attention head based on the query vector, the key vector and the value vector; concatenate the output vectors of all attention heads to obtain the first feature vector. 5.The method of claim 1, wherein, The modeling of the book feature of the second book acquisition sequence using a long short-term memory network to obtain a second feature vector representing the user's recent book interest comprises: input the book feature of the second book acquisition sequence into the long short-term memory network, and extract the hidden vector of the last time step of the long short-term memory network as a preliminary second feature vector; perform attention calculation on all time step hidden vectors of the long short-term memory network using the user feature as a query vector to obtain an attention weight of each time step; generate a user personalized feature vector by weighted summation of all time step hidden vectors based on the attention weight. The preliminary second feature vector and the user personalized feature vector are spliced along a channel dimension, and compressed through a fully connected layer to obtain a second feature vector. 6.The method of recommending books based on a timing-gated network according to claim 1, wherein, The gate vector is constructed based on the user feature, the first feature vector and the second feature vector, and the first feature vector and the second feature vector are fused through the gate vector to obtain a fusion feature vector representing the comprehensive interest of the user, including: Constructing a gating vector The expression is: wherein, represents a user, represents a user feature, represents a first feature vector, represents a second feature vector, is a bias term, , , is a weight matrix; The fusion feature vector is calculated , wherein the fusion feature vector represents the comprehensive interest of the user, and the expression is: in, Represents element-wise multiplication. 7.The method of claim 1, wherein, The probability of the user obtaining a book is predicted and a book recommendation result is generated based on the fusion feature vector and the user feature, including: The fusion feature vector and the user feature are spliced along a dimension to obtain a user comprehensive interest vector; The user comprehensive interest vector and the book feature of each book are spliced respectively to obtain a user-book feature pair; Each user-book feature pair is reduced in dimension through a fully connected layer to calculate the interest similarity of the user to each book; The interest similarity is normalized to obtain a probability distribution of the user obtaining each book; The books are sorted from high to low in probability, and a preset number of top-ranked books are selected as the book recommendation result.

8. A book recommendation system based on a timing-gated network, characterized by, The system comprises: A user feature modeling module configured to construct a user feature based on user attributes; A book acquisition sequence construction module configured to construct a time-ordered book acquisition sequence based on user historical book acquisition time records, and divide the book acquisition sequence into a first book acquisition sequence and a second book acquisition sequence at a preset position, wherein the book acquisition time in the first book acquisition sequence is earlier than the book acquisition time in the second book acquisition sequence; A book feature construction module configured to construct a book feature based on the book titles in the book acquisition sequence; A first feature vector construction module configured to model the book features of the first book acquisition sequence using a multi-head attention mechanism to obtain a first feature vector representing the early book interest of the user; A second feature vector construction module configured to model the book features of the second book acquisition sequence using a long short-term memory network to obtain a second feature vector representing the recent book interest of the user; A fusion feature vector construction module configured to construct a gate vector based on the user feature, the first feature vector and the second feature vector, and fuse the first feature vector and the second feature vector through the gate vector to obtain a fusion feature vector representing the comprehensive interest of the user; A book recommendation result acquisition module configured to predict the probability of the user obtaining a book and generate a book recommendation result based on the fusion feature vector and the user feature.

9. A terminal device, comprising: The terminal device comprises a memory, a processor, and a book recommendation program based on a timing gating network stored in the memory and executable on the processor. When the processor executes the book recommendation program based on the timing gating network, the steps of the book recommendation method based on the timing gating network are implemented.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a time-gated network-based book recommendation program, and the time-gated network-based book recommendation program, when executed by the processor, implements the steps of the time-gated network-based book recommendation method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Sequence recommendation method based on long-term and short-term preferences of user

    CN114969533A

  • Personalized music recommendation method based on long-term and short-term interests of user

    CN116932892A

  • Cross-domain book recommendation method and system based on neural network

    CN120030153A

  • Travel package recommendation method based on multi-view attention mechanism

    WO2022007526A1