Recommendation method and system based on music user position context dynamics
By constructing music user location context module and dynamic graph structure model in graph neural network, combining time and geographical features, the problem of ignoring time and geographical changes in the existing technology is solved, and personalized and dynamic music recommendation effects are achieved.
Patent Information
- Application Number
- CN202411627079.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-02-18
AI Technical Summary
When processing dynamic graph neural networks, the existing graph neural network ignores the changes in the relationship between users and items under the timestamp, and does not fully utilize the time characteristics and geographical location information.
By constructing a music user location context module, a dynamic graph structure model and an optimized graph convolution neural network recommendation module, the time features and geographical features are input into the graph neural network as attribute features of the nodes, and the weight of the graph structure is dynamically adjusted to reflect the time and space. Changes in context.
It realizes more accurate and personalized music recommendations, improves the performance and user satisfaction of the recommendation system, and can dynamically adapt to the user's preference changes at different times and geographical locations.
Smart Images

Figure CN119474987A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of information recommendation systems, and in particular, relates to a recommendation method and system based on the dynamics of music user location context. Background Art
[0002] Traditional neural networks are mainly applicable to regular data structures, such as vectors or sequences, while there are complex relationships between nodes and edges in graph data structures, which are difficult for traditional neural networks to handle effectively. The emergence of graph neural networks fills this gap, allowing neural networks to operate and learn directly on graph structures.
[0003] In the field of recommendation systems, the interaction between users and items can be represented as a graph structure, where users and items are nodes of the graph, and the interactions between users and items constitute the edges of the graph. Traditional recommendation methods often only consider the historical behavior of users and the attribute characteristics of items, while ignoring the complex relationship between users and items. Graph neural network technology can effectively capture the interactive relationship between users and items and use the information in the graph structure to perform recommendation tasks. By learning the representation of users and items in the graph structure, graph neural networks can achieve more accurate and personalized recommendations, thereby improving the performance of the recommendation system and user satisfaction.
[0004] Through the above analysis, the problems and defects of the prior art are as follows:
[0005] (1) When processing dynamic graphs, traditional graph neural networks usually use a static graph method to fuse the graph information of all timestamps into a static graph for processing, while ignoring the changes in the relationship between users and items at different timestamps.
[0006] (2) Temporal information plays an important role in the dynamic modeling of user behavior, but existing methods have shortcomings in processing temporal features.
[0007] (3) Although the user's geographic location information is taken into consideration, it is not fully utilized in existing methods. Summary of the invention
[0008] In view of the problems existing in the prior art, the present invention provides a recommendation method and system based on the dynamics of music user location context.
[0009] The present invention is implemented as follows: a recommendation method and system based on the dynamics of music user location context comprises:
[0010] S1, used to collect the user's music listening records, location information, and time information data from the data set;
[0011] S2, preprocessing the music data, including removing outliers and normalizing;
[0012] S3, building a music user location context module;
[0013] S4, constructing a dynamic graph structure model, and constructing a dynamic graph structure based on the user's music geographic location context;
[0014] S5, build an optimized graph convolutional neural network recommendation module, input time features and geographic features into the graph neural network as attribute features of the node, and learn them together with other features of the node;
[0015] S6, then outputs the final recommendation result through the loss function.
[0016] Further, the data is preprocessed:
[0017] Process the time information and convert the time into a format suitable for model processing through Unix timestamp; the function for converting time into timestamp is as follows:
[0018] month=datetime.fromtimestamp(T).month
[0019] {datetime.fromtimestamp}(T) means converting the timestamp T into a datetime object, and then getting the month value by taking its month attribute;
[0020] season=seasons[month_to_season[month]]
[0021] where {month_to_season} is a dictionary mapping months to seasons, and {seasons} is a list containing season strings; where T is the given timestamp, {month} is the extracted month, and {season} is the extracted season;
[0022] In the graph neural network based on the dynamic context of music users’ geographic location, the geographic location information is processed and geocoded as feature embedding; Geocoding: converting geographic location information into a code with semantic meaning;
[0023] Location encoding =geocode(User location)
[0024] Here {geocode} is a geocoding function that converts the user's geographic location into a geocoded representation; the geocoded geographic location information is embedded into the model as a node feature;
[0025] Convert the geocode to a low-dimensional vector representation. Assuming there are N geocodes, the low-dimensional vector representation of the i-th geocode is {Location}_{{embedding}}^{(i)}$, then:
[0026] Location (i) embedding =[lat(i),lon(i)]
[0027] where {lat}^{(i)} and {lon}^{(i)} represent the latitude and longitude of the i-th geolocation code, respectively.
[0028] Further, the dynamic graph structure is constructed based on the user's music geographic location context:
[0029] Suppose there is a set of users U, a set of music M, and a set of geographic locations L. Each user-music pair (u,m)$ has multiple listening records at different geographic locations and times. A dynamic graph structure needs to be constructed to represent this relationship.
[0030] (1) Node representation
[0031] The node set V includes user nodes and music nodes, which is expressed as V = U\cup M;
[0032] (2) Edge representation
[0033] For each user-music pair (u, m), assuming that there are multiple listening records at geographic location l and time t, multiple edges can be constructed to connect user node u and music node m, expressed as:
[0034] Eu,m={(u,m,l,t1),(u,m,l,t2),...,(u,m,l,tn)}
[0035] Where n represents the number of times a user has listened to music m at geographic location l and time t, (u,m,l,t_i)$ represents an edge, indicating that user u has listened to music m at geographic location l and time t_i;
[0036] (3) Edge weight representation.
[0037] Furthermore, the edge weight represents:
[0038] Assuming there is user u, music m, geographic location l and time t, the weight w of the corresponding edge (u, m, l, t) can be expressed as:
[0039]
[0040] Where n represents the number of times the user has listened to the same music at the same geographical location and time, and w_i represents the weight of each listening record, which can be the number of times or the duration;
[0041] According to the node set V and the edge set E, a dynamic graph G = (V, E) is constructed.
[0042] Furthermore, the optimized graph convolutional neural network recommendation module is constructed, and the time features and geographic features are input into the graph neural network as the attribute features of the node, and are learned together with other features of the node:
[0043] The innovation of the TGConv layer is to dynamically embed temporal and geographic features into the graph structure and dynamically adjust the weight of the graph structure based on these features;
[0044]
[0045] Where: H (l) is the node feature representation matrix of the lth layer, with dimension N×D, where N is the number of nodes and D is the feature dimension;
[0046] It is the adjacency matrix of the lth layer, which dynamically adjusts the edge weights according to the temporal and geographical features; degree matrix on the diagonal;
[0047] W (l) is the weight matrix of the lth layer;
[0048] σ is the activation function, such as the ReLU function; in the TGConv layer, by adjusting The weights of , dynamically perceive the changes in time and geographical context, thus improving the performance of the model;
[0049] By fusing temporal and geographic features into graph convolutional networks, a new feature fusion mechanism is designed, which enables the model to make full use of temporal and geographic information and dynamically adjust the weights of the graph structure, thereby more accurately reflecting user behavior patterns.
[0050] Furthermore, the final recommendation result is output through the loss function:
[0051] Use the cross entropy loss function as the loss function of the model; assume that the task is a classification task, that is, predicting whether the user likes a song;
[0052] The cross entropy loss function is defined as:
[0053]
[0054] Assume that the output of the model is the predicted user's preference for each song, use the softmax function to convert the output into a probability distribution, and then calculate the cross entropy loss; Assume that there are N samples and K types of output, y ij Indicates that the i-th sample belongs to the true label of the j-th category (1 means like, 0 means dislike), p ij Represents the model's predicted probability that the i-th sample belongs to the j-th category;
[0055] p ij It can be calculated by the softmax function:
[0056]
[0057] Z ij It represents the unnormalized prediction value of the model for the i-th sample belonging to the j-th class.
[0058] Another object of the present invention is to provide a recommendation system based on the dynamics of music user location context, comprising:
[0059] The personalized music data acquisition module is used to collect the user's music listening records, location information, time information and other data from the data set;
[0060] Data preprocessing module, used to preprocess the original music data, including removing outliers, normalization, etc.;
[0061] Music user location context building module, used to transform time factors and geographical factors;
[0062] Dynamic graph structure building module: builds dynamic graph structure based on user music geographic location context. The edge weight represents the number of times or duration that a user has listened to a specific piece of music at a specific geographic location and time.
[0063] Build an optimized graph convolutional neural network recommendation module, input time features and geographic features into the graph neural network as attribute features of nodes, and learn them together with other features of nodes;
[0064] The recommendation result acquisition module is used to output the final recommendation result through the loss function.
[0065] Another object of the present invention is to provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the recommendation method based on the dynamics of the music user location context.
[0066] Another object of the present invention is to provide a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to perform the steps of the recommendation method based on the dynamics of the music user location context.
[0067] Another object of the present invention is to provide an information data processing terminal, which is used to implement the recommendation system based on the dynamics of music user location context.
[0068] In combination with the above technical solutions and the technical problems solved, the advantages and positive effects of the technical solutions to be protected by the present invention are as follows:
[0069] First, the accuracy of personalized recommendations is improved: By adopting a dynamic graph structure and combining contextual information such as user location and time, we can more comprehensively understand user behavior and preferences. This helps to improve the personalization of the recommendation system, making the recommendation results more accurate and in line with the actual needs of users.
[0070] Consideration of spatiotemporal context dynamics: This paper fully considers the changes in user preferences at different times and geographical locations. By dynamically adjusting the weights and edge information of the graph structure, it can effectively model the spatiotemporal context dynamics. This helps the recommendation system better adapt to the changing needs of users and improve the timeliness and personalization of recommendations.
[0071] Strong model generalization ability: Due to the use of a dynamic graph structure modeling method, the recommendation system of the present invention has strong generalization ability. Whether it is for new users, new items, or recommendation scenarios at different times and geographical locations, it can effectively adapt and give appropriate recommendation results.
[0072] Second, the present invention solves the problem that existing music recommendation systems cannot dynamically consider changes in user location and time context. Traditional recommendation systems usually lack a comprehensive understanding of user geographic location and time dynamics, so the recommendation effect in different scenarios is poor. For example, there are significant differences in users' music preferences at home, outdoors, or when traveling. It is difficult for traditional models to accurately adjust the recommendation strategy based on these dynamic characteristics, affecting the accuracy of personalized recommendations.
[0073] The present invention systematically solves the above problems by constructing a dynamic graph structure model of user, geographic location, music and time information. The model can dynamically capture the changes in users' music preferences in different geographic locations and time, and embed these dynamic features into the recommendation system through graph neural networks, so that the recommendation system can adaptively identify the changing trends of users. This dynamic graph structure model innovatively solves the problem that traditional static models cannot cope with diverse scenarios, and significantly improves the flexibility of the system in complex application scenarios.
[0074] In industrial applications, the present invention uses an innovative module of graph convolutional neural network (GCN) to dynamically embed the user's time and location features, further optimizing the accuracy and performance of the recommendation model. Compared with traditional methods, this improved GCN model not only enhances the accuracy of recommendations through dynamic adjustment of time and geographical features, but also can adjust edge weights and node features in real time, thereby more accurately reflecting changes in user preferences. This feature is of great significance in industrial applications because it effectively improves the response speed and personalization of the recommendation system.
[0075] The present invention has achieved significant technical progress in the industrial application of music recommendation. By dynamically modeling the user's location information and time information, a flexible recommendation system is constructed, which greatly improves the user experience. The system can adaptively provide personalized recommendations in different location and time scenarios, effectively solving the problem of poor recommendation effects of traditional recommendation systems in changing scenarios, and providing high-precision, dynamically responsive technical support for the music recommendation industry. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] Figure 1 It is a flow chart of a recommendation method based on the dynamics of music user location context provided by an embodiment of the present invention.
[0077] Figure 2 It is a structural block diagram of a recommendation system based on the dynamics of music user location context provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0078] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0079] Example 1: Music recommendation based on commuting scenarios
[0080] In the commuting scenario, users' music preferences often vary depending on their geographical location and time. The system of the present invention collects users' music listening records, location information, and time information, and dynamically embeds these features in the recommendation model of the graph convolutional neural network. Suppose a user prefers relaxing music during the morning commute, but prefers relaxing or mood-soothing tracks on the way home from get off work. By embedding the commuting geographical location (such as bus stops, subway stations, etc.) and time features (such as morning and evening rush hours) as node features into the recommendation model, the system can accurately capture the changes in users' preferences in different commuting time periods and geographical locations, thereby recommending music tracks that are more in line with the commuting mood. This embodiment significantly improves the user's music experience in the commuting scenario and meets the user's dynamic preferences.
[0081] Example 2: Personalized music recommendation based on travel scenarios
[0082] In travel scenarios, users' geographic locations and music preferences change significantly with their itineraries. The recommendation system of the present invention can dynamically identify the user's geographic location and local time period, and provide music recommendations that are more suitable for the environment. Assuming that a user travels from city A to scenic spot B, the system identifies this new location through geocoding when the user enters scenic spot B and dynamically adjusts the recommendation strategy, such as recommending light music or slow-paced tracks suitable for outdoor and natural scenes. The system can also adjust the music style according to the time period (such as morning, afternoon, and night) of the user's stay. Through the dynamic modeling of time and geographic location by graph convolutional neural networks, the system can continuously adjust the recommended content in travel scenarios, so that users can obtain more suitable music recommendations at different travel stages, thereby improving the overall travel experience.
[0083] like Figure 1 As shown, the recommendation method based on the dynamics of music user location context provided by the embodiment of the present invention includes the following steps:
[0084] S1, used to collect the user's music listening records, location information, and time information data from the data set;
[0085] S2, preprocessing the music data, including removing outliers and normalizing;
[0086] S3, building a music user location context module;
[0087] S4, constructing a dynamic graph structure model, and constructing a dynamic graph structure based on the user's music geographic location context;
[0088] S5, build an optimized graph convolutional neural network recommendation module, input time features and geographic features into the graph neural network as attribute features of the node, and learn them together with other features of the node;
[0089] S6, then outputs the final recommendation result through the loss function.
[0090] Here’s how the recommendation method based on the dynamics of the music user’s location context works:
[0091] 1. Data collection and preprocessing
[0092] First, the user's music listening history, location information, and time information are collected from the dataset. These data will be used to describe the user's music preferences and behavior patterns. In the data preprocessing stage, the raw data is cleaned, including removing outliers and normalizing. The time information is converted into a format that the model can process through Unix timestamps, and the timestamps are mapped to month or season features using dictionaries. The geographic location information is converted into a semantically encoded representation through geocoding to more accurately represent the characteristics of the user's location.
[0093] 2. Build a user location context module
[0094] In order to more accurately capture the music preferences of users at specific times and geographic locations, a music user location context module was built. This module embeds the user's geographic location and time features as context information into the user-music interaction data, thereby being able to identify changes in user behavior in different scenarios. The geographic location encoding is further converted into a low-dimensional vector representation, allowing the model to take into account the dynamic changes in geographic location and optimize the accuracy of recommendations.
[0095] 3. Construction of dynamic graph structure
[0096] A dynamic graph structure is constructed using user-music geographic location context data to represent the user's listening behavior at different locations and times. The node set consists of user nodes and music nodes, while the edge set contains the listening records of each user-music pair at a specific geographic location and time. Multiple listenings under the same user, music, location, and time will be represented as multiple edges, thereby capturing the dynamic changes of user behavior through a dynamic graph. Edge weights are represented by the number of listening times or duration to more accurately reflect the strength of user preferences under different contexts.
[0097] 4. Graph Convolutional Neural Network (GCN) Recommendation Module
[0098] An optimized graph convolutional neural network (GCN) recommendation module is built, and time and geographic features are input into GCN as attribute features of nodes for learning. This module uses an innovative time-geo convolution layer (TGConv) to dynamically adjust the edge weights of the graph structure, and can accurately capture the dynamic behavior patterns of users by adaptively adjusting the model's ability to perceive changes in time and geographic context. In each layer of convolution, the weight of the graph structure is adjusted according to time and geographic features, allowing the model to update user preferences in real time.
[0099] 5. Feature Fusion Mechanism
[0100] In the GCN model, a new feature fusion mechanism is designed to embed time and geographic features into the graph convolution structure. The feature representation of each layer is updated through dynamic interaction with the adjacency matrix and degree matrix, and the node features are activated through activation functions (such as ReLU functions), thereby enhancing the model's ability to respond to time and geographic changes. This feature fusion mechanism allows the model to make full use of time and geographic information, dynamically adjust the weight of the graph structure, and more accurately reflect the user's behavior in different situations.
[0101] 6. Output recommendation results
[0102] The final recommendation result is output through the cross entropy loss function. The model combines the user's historical behavior with the current time and geographic information to predict whether the user will like a certain song. The model output is converted into a probability distribution using the softmax function to calculate the probability of the user liking each song. For each sample, the cross entropy loss between its true label and the predicted probability is calculated, so that the model can continuously optimize the recommendation results during the training process. Finally, the model dynamically generates a personalized music recommendation list based on the user's location and time.
[0103] The embodiment of the present invention provides preprocessing of data:
[0104] Process the time information and convert the time into a format suitable for model processing through Unix timestamp; the function for converting time into timestamp is as follows:
[0105] month=datetime.fromtimestamp(T).month
[0106] {datetime.fromtimestamp}(T) means converting the timestamp T into a datetime object, and then getting the month value by taking its month attribute;
[0107] season=seasons[month_to_season[month]]
[0108] where {month_to_season} is a dictionary mapping months to seasons, and {seasons} is a list containing season strings; where T is the given timestamp, {month} is the extracted month, and {season} is the extracted season;
[0109] In the graph neural network based on the dynamic context of music users’ geographic location, the geographic location information is processed and geocoded as feature embedding; Geocoding: converting geographic location information into a code with semantic meaning;
[0110] Locationencoding =geocode(User location)
[0111] Here {geocode} is a geocoding function that converts the user's geographic location into a geocoded representation; the geocoded geographic location information is embedded into the model as a node feature;
[0112] Convert the geocode to a low-dimensional vector representation. Assuming there are N geocodes, the low-dimensional vector representation of the i-th geocode is {Location}_{{embedding}}^{(i)}$, then:
[0113] Location (i) embedding =[lat(i),lon(i)]
[0114] where {lat}^{(i)} and {lon}^{(i)} represent the latitude and longitude of the i-th geolocation code, respectively.
[0115] The embodiment of the present invention provides a dynamic graph structure based on the user's music geographic location context:
[0116] Suppose there is a set of users U, a set of music M, and a set of geographic locations L. Each user-music pair (u,m)$ has multiple listening records at different geographic locations and times. A dynamic graph structure needs to be constructed to represent this relationship.
[0117] (1) Node representation
[0118] The node set V includes user nodes and music nodes, which is expressed as V = U\cup M;
[0119] (2) Edge representation
[0120] For each user-music pair (u, m), assuming that there are multiple listening records at geographic location l and time t, multiple edges can be constructed to connect user node u and music node m, expressed as:
[0121] Eu,m={(u,m,l,t1),(u,m,l,t2),...,(u,m,l,tn)}
[0122] Where n represents the number of times a user has listened to music m at geographic location l and time t, (u,m,l,t_i)$ represents an edge, indicating that user u has listened to music m at geographic location l and time t_i;
[0123] (3) Edge weight representation.
[0124] The edge weight provided in the embodiment of the present invention is represented as follows:
[0125] Assuming there is user u, music m, geographic location l and time t, the weight w of the corresponding edge (u, m, l, t) can be expressed as:
[0126]
[0127] Where n represents the number of times the user has listened to the same music at the same geographical location and time, and w_i represents the weight of each listening record, which can be the number of times or the duration;
[0128] According to the node set V and the edge set E, a dynamic graph G = (V, E) is constructed.
[0129] The optimized graph convolutional neural network recommendation module provided in the embodiment of the present invention inputs the time feature and the geographical feature into the graph neural network as the attribute feature of the node, and learns together with other features of the node:
[0130] The innovation of the TGConv layer is to dynamically embed temporal and geographic features into the graph structure and dynamically adjust the weight of the graph structure based on these features;
[0131]
[0132] Where: H (l) is the node feature representation matrix of the lth layer, with dimension N×D, where N is the number of nodes and D is the feature dimension;
[0133] It is the adjacency matrix of the lth layer, which dynamically adjusts the edge weights according to the temporal and geographical features; degree matrix on the diagonal;
[0134] W (l) is the weight matrix of the lth layer;
[0135] σ is the activation function, such as the ReLU function; in the TGConv layer, by adjusting The weights of , dynamically perceive the changes in time and geographical context, thus improving the performance of the model;
[0136] By fusing temporal and geographic features into graph convolutional networks, a new feature fusion mechanism is designed, which enables the model to make full use of temporal and geographic information and dynamically adjust the weights of the graph structure, thereby more accurately reflecting user behavior patterns.
[0137] The final recommendation result is outputted through the loss function provided by the embodiment of the present invention:
[0138] Use the cross entropy loss function as the loss function of the model; assume that the task is a classification task, that is, predicting whether the user likes a song;
[0139] The cross entropy loss function is defined as:
[0140]
[0141] Assume that the output of the model is the predicted user's preference for each song, use the softmax function to convert the output into a probability distribution, and then calculate the cross entropy loss; Assume that there are N samples and K types of output, y ij Indicates that the i-th sample belongs to the true label of the j-th category (1 means like, 0 means dislike), p ij Represents the model's predicted probability that the i-th sample belongs to the j-th category;
[0142] p ij It can be calculated by the softmax function:
[0143]
[0144] Z ij It represents the unnormalized prediction value of the model for the i-th sample belonging to the j-th class.
[0145] like Figure 2 As shown, a recommendation system based on the dynamics of music user location context provided by an embodiment of the present invention includes:
[0146] The personalized music data acquisition module is used to collect the user's music listening records, location information, time information and other data from the data set;
[0147] Data preprocessing module, used to preprocess the original music data, including removing outliers, normalization, etc.;
[0148] Music user location context building module, used to transform time factors and geographical factors;
[0149] Dynamic graph structure building module: builds dynamic graph structure based on user music geographic location context. The edge weight represents the number of times or duration that a user has listened to a specific piece of music at a specific geographic location and time.
[0150] Build an optimized graph convolutional neural network recommendation module, input time features and geographic features into the graph neural network as attribute features of nodes, and learn them together with other features of nodes;
[0151] The recommendation result acquisition module is used to output the final recommendation result through the loss function.
[0152] Another object of the present invention is to provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the recommendation method based on the dynamics of the music user location context.
[0153] Another object of the present invention is to provide a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to perform the steps of the recommendation method based on the dynamics of the music user location context.
[0154] Another object of the present invention is to provide an information data processing terminal, which is used to implement the recommendation system based on the dynamics of music user location context.
[0155] This paper proposes a recommendation method and system based on the dynamics of user music location context, aiming to improve the accuracy of personalized music recommendation by dynamically modeling the user's location information and time information. The method combines the user's music listening history, location information and time information, and learns the dynamic contextual relationship through a graph convolutional neural network (GCN), so as to more accurately predict the user's music preferences in changing geographical and temporal scenarios.
[0156] First, the system collects the user's music listening records from the data set and obtains the corresponding location information and time information. These data include the user's listening habits at different geographical locations and times, which are used to build the user's personalized preferences. Data preprocessing is an important first step. By cleaning outliers and normalizing, the consistency and applicability of the input data are ensured, providing a high-quality data source for the subsequent graph model construction.
[0157] Next, the system builds a music user location context module to convert the user's geographic location and time factors into feature information that the model can process. Time information is converted into a processable time format such as month and season through timestamps to ensure that the dynamic changes in user preferences are reflected in different time periods. The location information is converted into a low-dimensional feature representation with semantic meaning through geocoding, including the user's latitude and longitude. These encoded geographic features can represent the user's activity location and help the model capture the impact of the user's location on music preferences.
[0158] Based on the geographical location context of user music, a dynamic graph structure model is constructed. This graph structure contains users, music, and geographical locations as nodes, and constructs edge connections through users' listening records at different geographical locations and times. The weight of the edge represents the strength of the user's preference for music at a specific location and time, such as the number of plays or the length of listening time. By constructing this dynamic graph structure, the relationship between users, geographical locations, time, and music can be intuitively represented, and an effective data structure is provided for subsequent graph convolutional network learning.
[0159] In order to make full use of temporal and geographical context information, the present invention designs an optimized graph convolutional neural network (GCN) recommendation module. This module dynamically embeds temporal and geographical features into the graph structure through the innovative TGConv layer, adjusts the edge weights of the graph structure, and enables the graph model to dynamically perceive changes in temporal and geographical context. During the learning process, the TGConv layer integrates other features of the node (such as user attributes and music features) with temporal and geographical features, so that the model can learn the user's temporal and spatial dynamic preferences more accurately.
[0160] The TGConv layer effectively solves the problem that traditional GCN cannot handle dynamic time and geographical contexts through its dynamic weight adjustment mechanism. Specifically, the node feature matrix of the TGConv layer is dynamically adjusted according to the changes in time and geographical features, and combined with the degree matrix and adjacency matrix, it is learned through the weight matrix of the graph convolutional neural network. In this process, each layer of the graph convolution uses activation functions such as ReLU, which enables the model to handle nonlinear features and further improves the ability to capture user behavior patterns.
[0161] During the training process, the present invention uses a cross entropy loss function to output the final recommendation results. The cross entropy loss function can effectively measure the gap between the model prediction results and the actual user preferences, so that the model can continuously optimize its parameters in multiple rounds of iterations. In this loss function, the user preference prediction value output by the model is converted into a probability distribution through the softmax function and compared with the actual label, so that the model can better judge whether the user will like a certain song.
[0162] Finally, the system outputs the final personalized recommendation based on the recommendation result acquisition module. Combined with the user's location and time context information, the recommendation system can provide more accurate music recommendations in a specific geographical location and time period, thereby improving the user experience. For example, more suitable music types can be recommended when the user is traveling or resting. The present invention designs a music recommendation system with good practicality and scalability by dynamically modeling the user's location and time context, thus realizing an efficient and personalized recommendation function.
[0163] The present invention is specifically implemented:
[0164] Example 1
[0165] The graph neural network recommendation method based on the dynamic context of music user location provided by the embodiment of the present invention is applied to the client and includes the following steps:
[0166] Used to collect users' music listening records, location information, time information and other data from the dataset;
[0167] Preprocess the music data, including removing outliers, normalizing, etc.
[0168] Build a music user location context module;
[0169] Build a dynamic graph structure model based on the user's music location context;
[0170] An optimized graph convolutional neural network recommendation module is constructed, and time features and geographic features are input into the graph neural network as attribute features of the nodes, and learned together with other features of the nodes.
[0171] Then the final recommendation result is output through the loss function.
[0172] The present invention combines the modeling method of dynamic graph structure, user geographic location and time and other context information, and has many advantages and positive effects such as improved personalized recommendation accuracy, dynamic consideration of spatiotemporal context, comprehensive consideration of multiple information, strong model generalization ability and improved user experience.
[0173] Through the above technical solution, the recommendation method provided by the embodiment of the present invention can greatly improve the recommendation accuracy and user satisfaction.
[0174] Example 2
[0175] Based on the graph neural network recommendation method based on music user location context dynamics provided in Example 1 of the present invention, further, in step S103, the music user location context dynamics module is constructed as follows:
[0176] Process the time information and convert the time into a format suitable for model processing through Unix timestamp. The function for converting time to timestamp is as follows:
[0177] month=datetime.fromtimestamp(T).month
[0178] Here, {datetime.fromtimestamp}(T) means converting the timestamp T into a datetime object, and then getting the month value by taking its month attribute.
[0179] season=seasons[month_to_season[month]]
[0180] Where {month_to_season} is a dictionary mapping months to seasons, and {seasons} is a list containing season strings. Where T is the given timestamp, {month} is the extracted month, and {season} is the extracted season.
[0181] Example 3
[0182] Based on the graph neural recommendation method based on the dynamic context of the music user's geographical location provided in Example 1 of the present invention, further, in step S103, the geographical conversion function is as follows:
[0183] In the graph neural network based on the dynamics of the music user's geographic location context, the geographic location information is processed and geocoded as feature embedding. Geocoding: converting geographic location information into a code with semantic meaning.
[0184] Location encoding =geocode(User location)
[0185] Here {geocode} is a geocoding function that converts the user’s geographic location into a geocoded representation. The geocoded geographic location information is embedded into the model as a node feature.
[0186] Convert the geocode to a low-dimensional vector representation. Assuming there are N geocodes, the low-dimensional vector representation of the i-th geocode is {Location}_{{embedding}}^{(i)}$, then:
[0187] Location (i) embedding =[lat(i),lon(i)]
[0188] where {lat}^{(i)} and {lon}^{(i)} represent the latitude and longitude of the i-th geolocation code, respectively.
[0189] Example 4
[0190] Based on the graph neural network recommendation method based on the dynamic context of music user geographic location provided in Example 1 of the present invention, further, in step S104, a dynamic graph structure based on the context of user music geographic location is constructed. Assuming there is a group of users U, a group of music M, and a group of geographic locations L, each user-music pair (u, m)$ has multiple listening records at different geographic locations and times, and a dynamic graph structure needs to be constructed to represent this relationship.
[0191] (1) Node representation
[0192] The node set V includes user nodes and music nodes, expressed as V=U\cup M.
[0193] (2) Edge representation
[0194] For each user-music pair (u, m), assuming that there are multiple listening records at geographic location l and time t, multiple edges can be constructed to connect user node u and music node m, expressed as:
[0195] Eu,m={(u,m,l,t1),(u,m,l,t2),...,(u,m,l,tn)}
[0196] Among them, n represents the number of times the user has listened to music m at geographic location l and time t, and (u,m,l,t_i)$ represents an edge, indicating that user u has listened to music m at geographic location l and time t_i.
[0197] (3) Edge weight representation
[0198] Assuming there is user u, music m, geographic location l and time t, the weight w of the corresponding edge (u, m, l, t) can be expressed as:
[0199]
[0200] Where n represents the number of times the user has listened to the same music at the same geographical location and time, and w_i represents the weight of each listening record, which can be the number of times or the duration.
[0201] According to the node set V and edge set E, construct a dynamic graph G = (V, E)
[0202] Example 5
[0203] Based on the graph neural network recommendation method based on the dynamic context of music user geographic location provided by embodiment 1 of the present invention,
[0204] The embodiment of the present invention provides a graph neural network recommendation system based on the dynamic context of music user geographic location, including:
[0205] The personalized music data acquisition module is used to collect the user's music listening records, location information, time information and other data from the data set;
[0206] The data preprocessing module is used to preprocess the original music data, including removing outliers, normalization, etc.
[0207] Music user location context building module, used to transform time factors and geographical factors;
[0208] The dynamic graph structure building module builds the dynamic graph structure based on the user's music geographic location context. The weight of the edge represents the number of times or duration that the user has listened to specific music at a specific geographic location and time.
[0209] An optimized graph convolutional neural network recommendation module is constructed, and time features and geographic features are input into the graph neural network as attribute features of the nodes, and learned together with other features of the nodes.
[0210] The recommendation result acquisition module is used to output the final recommendation result through the loss function.
[0211] Example 6
[0212] Based on the graph neural network recommendation system based on the dynamic context of music user geographic location provided by Embodiment 5 of the present invention, further, the construction module 3 based on the context of music user geographic location further includes:
[0213] The time function building module is used to build the time conversion function as follows:
[0214] month=datetime.fromtimestamp(T).month
[0215] The meanings involved in the above formula are shown in Example 2.
[0216] The geocoding embed module is as follows:
[0217] Location(i)embedding=[lat(i),lon(i)]
[0218] The meanings involved in the above formula are shown in Example 3.
[0219] Dynamic graph structure building module 4 includes:
[0220]
[0221] The meanings involved in the above formula are shown in Example 4.
[0222] Since the embodiment of the method of the present invention is based on the same concept, its specific functions and the technical effects brought about can be found in the embodiment of the method, and will not be described in detail here. Professionals in the technical field can clearly understand that in order to simplify the description, the information interaction, execution process and other contents between the above-mentioned devices / units are only illustrated by functional units and module divisions. In practical applications, functions can be assigned to different units or modules as needed, and the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described. Each functional unit and module can be integrated in a processing unit, or it can exist physically alone, or it can be integrated in a unit. The integrated unit can be implemented in hardware or in the form of a software functional unit. The specific names of each functional unit and module are only used for distinction and do not limit the scope of protection of the present invention. The working process of the unit and module can refer to the corresponding process in the embodiment of the method.
[0223] Application Example 1
[0224] The recommended method provided by the above embodiment of the present invention is applied to a computer device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, and the processor implements the steps in any of the above method embodiments when executing the computer program.
[0225] Application Example 2
[0226] The recommended method provided by the above embodiment of the present invention is applied to a computer-readable storage medium, and the computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps in the above method embodiments can be implemented.
[0227] Application Example 3
[0228] The recommended method provided in the above embodiment of the present invention is applied to an information data processing terminal. When the information data processing terminal is used to be executed on an electronic device, it provides a user input interface to implement the steps in the above method embodiments. The information data processing terminal is not limited to mobile phones, computers, and switches.
[0229] Application Example 4
[0230] The recommended method provided in the above embodiment of the present invention is applied to a server. When the server is used to be implemented and executed on an electronic device, it provides a user input interface to implement the steps in the above method embodiments.
[0231] Application Example 5
[0232] The recommended method provided by the above embodiment of the present invention is applied to a computer program product. When the computer program product runs on an electronic device, the steps in the above method embodiments can be implemented when the electronic device executes the computer program product.
[0233] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera device / terminal device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a disk or an optical disk.
[0234] The graph neural network based on the dynamic context of music users' geographic location has technical advantages and innovative significance. By integrating geographic location information and dynamic graph structure, the network can accurately capture the changes in users' music preferences in different geographic locations and time, and improve the personalization and accuracy of music recommendations. This innovative method breaks through the traditional music recommendation system's reliance on static data, and realizes real-time perception and response to dynamic changes in user behavior, thereby providing users with more accurate and personalized music recommendation services, greatly improving user experience and satisfaction. The evaluation indicators in the recommendation system, namely accuracy and recall rate, are selected to compare with existing technologies to improve the satisfaction of recommendation results.
[0235] It should be noted that the embodiments of the present invention can be implemented by hardware, software, or a combination of software and hardware. The hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated design hardware. It can be understood by a person of ordinary skill in the art that the above-mentioned devices and methods can be implemented using computer executable instructions and / or contained in a processor control code, such as a carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. Such code is provided on the carrier medium. The device and its modules of the present invention can be implemented by hardware circuits such as very large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., can also be implemented by software executed by various types of processors, and can also be implemented by a combination of the above-mentioned hardware circuits and software, such as firmware.
[0236] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any modifications, equivalent substitutions and improvements made by any technician familiar with the technical field within the technical scope disclosed by the present invention and within the spirit and principle of the present invention should be covered by the protection scope of the present invention.
Claims
1. A recommendation method based on the dynamics of music user location context, characterized in that: The following steps are involved: S1, used to collect the user's music listening records, location information, and time information data from the data set; S2, preprocessing the music data, including removing outliers and normalizing; S3, building a music user location context module; S4, constructing a dynamic graph structure model, and constructing a dynamic graph structure based on the user's music geographic location context; S5, build an optimized graph convolutional neural network recommendation module, input time features and geographic features into the graph neural network as attribute features of the node, and learn them together with other features of the node; S6, then outputs the final recommendation result through the loss function.
2. The recommendation method based on the dynamics of music user location context as claimed in claim 1, characterized in that: The data is preprocessed as follows: Process the time information and convert the time into a format suitable for model processing through Unix timestamp; the function for converting time into timestamp is as follows: month=datetime.fromtimestamp(T).month {datetime.fromtimestamp}(T) means converting the timestamp T into a datetime object, and then getting the month value by taking its month attribute; season=seasons[month_to_season[month]] where {month_to_season} is a dictionary mapping months to seasons, and {seasons} is a list containing season strings; where T is the given timestamp, {month} is the extracted month, and {season} is the extracted season; In the graph neural network based on the dynamic context of music users’ geographic location, the geographic location information is processed and geocoded as feature embedding; Geocoding: converting geographic location information into a code with semantic meaning; Location encoding =geocode(User location) Here {geocode} is a geocoding function that converts the user's geographic location into a geocoded representation; the geocoded geographic location information is embedded into the model as a node feature; Convert the geocode to a low-dimensional vector representation. Assuming there are N geocodes, the low-dimensional vector representation of the i-th geocode is {Location}_{{embedding}}^{(i)}$, then: Location (i) embedding =[lat(i),lon(i)] where {lat}^{(i)} and {lon}^{(i)} represent the latitude and longitude of the i-th geolocation code, respectively.
3. The recommendation method based on the dynamics of music user location context as claimed in claim 1, characterized in that: The dynamic graph structure is constructed based on the user's music geographic location context: Suppose there is a set of users U, a set of music M, and a set of geographic locations L. Each user-music pair (u,m)$ has multiple listening records at different geographic locations and times. A dynamic graph structure needs to be constructed to represent this relationship. (1) Node representation The node set V includes user nodes and music nodes, which is expressed as V = U\cup M; (2) Edge representation For each user-music pair (u, m), assuming that there are multiple listening records at geographic location l and time t, multiple edges can be constructed to connect user node u and music node m, expressed as: Eu,m={(u,m,l,t1),(u,m,l,t2),...,(u,m,l,tn)} Where n represents the number of times a user has listened to music m at geographic location l and time t, (u,m,l,t_i)$ represents an edge, indicating that user u has listened to music m at geographic location l and time t_i; (3) Edge weight representation.
4. The recommendation method based on the dynamics of music user location context as claimed in claim 3, characterized in that: The edge weights represent: Assuming there is user u, music m, geographic location l and time t, the weight w of the corresponding edge (u, m, l, t) can be expressed as: Where n represents the number of times the user has listened to the same music at the same geographical location and time, and w_i represents the weight of each listening record, which can be the number of times or the duration; According to the node set V and the edge set E, a dynamic graph G = (V, E) is constructed.
5. The recommendation method based on the dynamics of music user location context as claimed in claim 1, characterized in that: The optimized graph convolutional neural network recommendation module is constructed, and the time features and geographic features are input into the graph neural network as the attribute features of the node, and are learned together with other features of the node: The innovation of the TGConv layer is to dynamically embed temporal and geographic features into the graph structure and dynamically adjust the weight of the graph structure based on these features; Where: H (l) is the node feature representation matrix of the lth layer, with dimension N×D, where N is the number of nodes and D is the feature dimension; It is the adjacency matrix of the lth layer, which dynamically adjusts the edge weights according to the temporal and geographical features; yes degree matrix on the diagonal; W (l) is the weight matrix of the lth layer; σ is the activation function, such as the ReLU function; in the TGConv layer, by adjusting The weights of , dynamically perceive the changes in time and geographical context, thus improving the performance of the model; By fusing temporal and geographic features into graph convolutional networks, a new feature fusion mechanism is designed, which enables the model to make full use of temporal and geographic information and dynamically adjust the weights of the graph structure, thereby more accurately reflecting user behavior patterns.
6. The recommendation method based on the dynamics of music user location context as claimed in claim 1, characterized in that: The final recommendation result is output through the loss function: Use the cross entropy loss function as the loss function of the model; assume that the task is a classification task, that is, predicting whether the user likes a song; The cross entropy loss function is defined as: Assume that the output of the model is the predicted user's preference for each song, use the softmax function to convert the output into a probability distribution, and then calculate the cross entropy loss; Assume that there are N samples and K types of output, y ij Indicates that the i-th sample belongs to the true label of the j-th category (1 means like, 0 means dislike), p ij Represents the model's predicted probability that the i-th sample belongs to the j-th category; p ij It can be calculated by the softmax function: Z ij It represents the unnormalized prediction value of the model for the i-th sample belonging to the j-th class.
7. A recommendation system based on music user location context dynamics implementing the recommendation method based on music user location context dynamics as described in any one of claims 1 to 6, characterized in that: The recommendation system based on the dynamics of music user location context includes: The personalized music data acquisition module is used to collect the user's music listening records, location information, time information and other data from the data set; Data preprocessing module, used to preprocess the original music data, including removing outliers, normalization, etc.; Music user location context building module, used to transform time factors and geographical factors; Dynamic graph structure building module: builds dynamic graph structure based on user music geographic location context. The edge weight represents the number of times or duration that a user has listened to a specific piece of music at a specific geographic location and time. Build an optimized graph convolutional neural network recommendation module, input time features and geographic features into the graph neural network as attribute features of nodes, and learn them together with other features of nodes; The recommendation result acquisition module is used to output the final recommendation result through the loss function.
8. A computer device, characterized in that: The computer device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the recommendation method based on the dynamics of the music user location context as described in any one of claims 1-6.
9. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor executes the steps of the recommendation method based on the dynamics of music user location context as described in any one of claims 1-6.
10. An information data processing terminal, characterized in that: The information data processing terminal is used to implement the recommendation system based on the dynamics of music user location context as described in claim 7.
Citation Information
Cited By
Precise advertisement putting method and system based on artificial intelligence
CN119693066A