## 3 Methodology
### User Affiliation Network
#### 3.3.1 User Preference Combination Framework  
Many user interests may change over time and may be triggered by specific contexts or time requirements. The long-term preference sequence of users is very rich and relatively stable, reflecting the overall trend of user interests, but there is a lot of redundant information. The short-term preference sequence of users can more accurately reflect the changes in user interests in a short period, which plays a major role in the prediction, but it can also be easily affected by a single item. To make the recommender system accurately predict user interests, this paper combines long-term and short-term preferences, which can not only accurately grasp the overall trend of user preferences but also effectively reflect the evolution of user demands. For the item set \(I\) interacting with users, GRUs are used to extract user short-term preferences, and different weights are assigned to user long-term preferences and immediate interests for item attributes through attention. Weighted calculation is used to model the final results of short-term interests and long-term preferences at the same time to obtain the vector representation of user preferences. When a user purchases an item, the system adds corresponding descriptions of category, color, and style to the user preference record according to the text description of the item in the item library and updates the user preference in time. Among all the historical behaviors of users, only a part of historical behaviors can effectively affect the predictive attributes of the current recommended items, and each historical behavior has different impacts and contributions to user preferences. Therefore, attention is adopted to extract the importance of the user historical behaviors to the current recommended, namely the difference in weight. For example, during festivals, people will buy some items in line with the festive atmosphere, but these items are rarely purchased at ordinary times, which may be different from the category, color, and style of the items purchased by users. The attributes of these items will have a negative impact on the accuracy of predicting user preferences. Therefore, when using attention to extract user long-term preferences, in the non-festive period, less attention is paid to items with festive significance; that is, less weight is given. During festive times, increased attention and greater weight are given to items that fit with the times. Similarly, since many products are only used during certain seasons, the attention assigns different weights depending on the season and item information. \(t\) represents festive and season attributes, different users have different purchase preferences in different festival seasons, and each user is personalized to represent whether there is a special purchase preference at a certain time \(t\), such as birthday, etc. Then, the probability \(p\) of user \(u\) buying a certain item \(i\) is a function of time \(t\):  
\[p_{u}=f(i,S,t) \tag{4}\]  
where \(S\) is the quantity of item \(i\) purchased by all users at time \(t\), and the larger \(b\) is, the more likely users are to buy similar items again at time \(t\). Taking the user short-term preference \(h_{t}\) extracted in chronological order as the input of Attention, the influence weight \(\alpha\) of each item on the current recommendations in the historical behavior is a function of time \(t\):  
\[\alpha=sigmoid(f(p)) \tag{5}\]  
The user long-term preference \(L=\{l_{1},l_{2},\ldots,l_{m}\}\) is a function of the user historical behavior of items and short-term preferences:  
\[l=f(\alpha,h) \tag{6}\]  
The user long-term preference \(L=\{l_{1},l_{2},\ldots,l_{m}\}\) and user short-term preference h are combined in a non-linear manner to obtain user long-term and short-term preference fusion \(F\):  
\[F=\sigma(f(h,l)) \tag{7}\]  
where \(\sigma\) is a non-linear function.