Song recommendation method, device, medium and electronic device
By segmenting and encoding the song playback set, the similarity is calculated to recommend the target song, and the problem of unpopular songs being filtered and recommendations in the prior art is solved, and music recommendations with high accuracy and low latency are achieved.
Patent Information
- Application Number
- CN202011099242.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-14
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2040-10-14
AI Technical Summary
Among the existing music recommendation methods, the collaborative filtering algorithm and the extended seed song method can easily filter out unpopular songs, resulting in low recommendation accuracy, unable to effectively output unrecorded songs, and there is online delay problem.
By obtaining the song playback set for slicing, data features are generated, mapped and encoded, the embedding vector is determined, the similarity is calculated to recommend the target song, ensuring that the recommended vector is the same order of magnitude as the embedding vector, and improving the recommendation accuracy and real-timeness.
It solves the problems of low recommendation accuracy and online delay, and can effectively output unrecorded songs to meet the song recommendation needs in scenarios such as home speakers.
Smart Images

Figure CN114372170B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a song recommendation method, a song recommendation device, a computer-readable medium, and an electronic device. Background Art
[0002] In the music recommendation scenario, the music application will recommend songs to the terminal to optimize the user's experience in using the music application.
[0003] Generally, the recommended songs can be determined by using collaborative filtering algorithms or by expanding seed songs. However, since unpopular songs will be filtered out, the accuracy of the recommended music is low.
[0004] In view of this, there is an urgent need in the art to develop a new song recommendation method and device.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the technical background of the present application, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the invention
[0006] The purpose of the present disclosure is to provide a song recommendation method, a song recommendation device, a computer-readable medium and an electronic device, thereby overcoming the technical problem of low accuracy of music recommendation at least to a certain extent.
[0007] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0008] According to one aspect of an embodiment of the present disclosure, a song recommendation method is provided, the method comprising: obtaining a song play set, and segmenting the song play set to obtain data features; mapping the data features to obtain feature vectors, and encoding the feature vectors to obtain embedding vectors; determining a recommendation vector corresponding to the embedding vector, and calculating the similarity between the embedding vector and the recommendation vector to obtain a target song for recommendation.
[0009] According to one aspect of an embodiment of the present disclosure, a song recommendation device is provided, which includes: a segmentation processing module, configured to obtain a song playback set, and segment the song playback set to obtain data features; a vector encoding module, configured to map the data features to obtain feature vectors, and encode the feature vectors to obtain embedded vectors; a song recommendation module, configured to determine a recommendation vector corresponding to the embedded vector, and calculate the similarity between the embedded vector and the recommendation vector to obtain a target song for recommendation.
[0010] In some embodiments of the present disclosure, based on the above technical solution, the vector encoding module includes: an encoding model unit, configured to input the feature vector into the encoding model so that the encoding model encodes the feature vector to obtain an embedded vector.
[0011] In some embodiments of the present disclosure, based on the above technical solution, the segmentation processing module includes: a processing result unit, configured to segment the song playback set to obtain a historical playback set and a predicted playback set; a song determination unit, configured to obtain the song listening completion data in the predicted playback set, and determine candidate songs in the predicted playback set based on the song listening completion data; a song adding unit, configured to add the candidate songs to the historical playback set to obtain data features corresponding to the historical playback set.
[0012] In some embodiments of the present disclosure, based on the above technical solution, the song adding unit includes: a set updating subunit, configured to add the candidate songs to the historical playback set to obtain an updated playback set; a feature generating subunit, configured to obtain data features in the updated playback set corresponding to the song listening completion data.
[0013] In some embodiments of the present disclosure, based on the above technical solution, the song recommendation device also includes: a distribution calculation module, configured to calculate the probability distribution of the embedded vector on the recommendation vector using a normalization function; and a distribution determination module, configured to determine the target song for recommendation based on the probability distribution.
[0014] In some embodiments of the present disclosure, based on the above technical solution, the song recommendation module includes: a music library acquisition unit, configured to acquire a song library corresponding to the song playback set, and segment the song library to obtain song features; a music library processing unit, configured to map the song features to obtain song vectors, and encode the song vectors to obtain recommendation vectors.
[0015] In some embodiments of the present disclosure, based on the above technical solution, the song recommendation module includes: a distance calculation unit, configured to, if there are multiple recommendation vectors, perform vector distance calculation on the embedded vector and each of the recommendation vectors to obtain multiple similarity distances; a distance recommendation unit, configured to compare the multiple similarity distances, and determine the target song in the song library for recommendation based on the comparison results.
[0016] According to one aspect of an embodiment of the present disclosure, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the song recommendation method in the above technical solution is implemented.
[0017] According to one aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the song recommendation method in the above technical solution by executing the executable instructions.
[0018] In the technical solution provided by the embodiments of the present disclosure, on the one hand, a recommendation vector corresponding to the embedded vector is determined so that the recommendation vector is of the same order of magnitude as the embedded vector, thereby solving the problem that unrecorded songs cannot be output due to the low order of magnitude of the recommendation vector; on the other hand, the target song is determined for recommendation based on the similarity calculation result, thereby improving the accuracy and real-time performance of song recommendations, solving the online delay problem, and meeting the song recommendation needs in scenarios such as home speakers.
[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0021] Figure 1 The schematic diagram schematically shows an exemplary system architecture to which the technical solution of the present disclosure is applied;
[0022] Figure 2 A flowchart schematically shows a method for recommending songs in some embodiments of the present disclosure;
[0023] Figure 3 A flowchart schematically shows the steps of a method for segmentation processing in some embodiments of the present disclosure;
[0024] Figure 4 A flowchart schematically shows the steps of a method for obtaining data features in some embodiments of the present disclosure;
[0025] Figure 5 A flowchart schematically shows the steps of a method for determining a recommendation vector in some embodiments of the present disclosure;
[0026] Figure 6 A flowchart schematically shows the steps of a method for calculating a similarity distance in some embodiments of the present disclosure;
[0027] Figure 7A flowchart schematically shows the steps of a method for calculating a probability distribution in some embodiments of the present disclosure;
[0028] Figure 8 The following is a flowchart schematically showing a method for obtaining data features in an application scenario according to an embodiment of the present disclosure;
[0029] Fig. 9 The flowchart schematically shows the steps of the method for calculating the probability distribution to determine the target song in the application scenario according to the embodiment of the present disclosure;
[0030] Fig.10 The structure block diagram of a song recommendation device in some embodiments of the present disclosure is schematically shown;
[0031] Fig.11 The structure diagram of a computer system suitable for implementing the electronic device of the embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0032] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more comprehensive and complete and will fully convey the concept of the example embodiments to those skilled in the art.
[0033] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.
[0034] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0035] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0036] In the related art in this field, a collaborative filtering (CF) algorithm and a method of expanding seed songs are used to determine recommended songs.
[0037] Specifically, the data source of this determination method includes two parts, namely, the user's behavioral data and the user's non-behavioral data.
[0038] Among them, the user's behavioral data may include data generated by the user's collection of songs, downloading songs, sharing songs or actively playing songs; the user's non-behavioral data may include the user's geographic location, model used, operating system, age and gender and other data.
[0039] Furthermore, the acquired data can be processed using a collaborative filtering algorithm.
[0040] Collaborative filtering methods include item based CF, user based CF, and matrix decomposition. Item based CF can recommend songs similar to songs played by the user before, and user based CF can recommend songs liked by other users who have the same interests as the user.
[0041] Generally, the candidate set of songs can be obtained by processing the acquired data using item based CF. The process of obtaining the candidate set can be regarded as building a candidate set from the seed song S i To a collection of similar or related songs R i 's mapping.
[0042] In order to obtain the set R i , each pair of seed songs and candidate songs (S i ,S j ) is collected at the same time, and the number of times the common collection is marked as C i,j .
[0043] The candidate song S j For seed songs S i The relevance score is defined as formula (1):
[0044] R(S i ,C j )=C i,j / f(C i ,C j ) (1)
[0045] Among them, C i and C j Represents the seed song S i and candidate songs S jThe number of times they appear in the favorites list, f(C i ,C j ) is the calculation of the seed song S i and candidate songs S j The normalization function of the global heat value.
[0046] Specifically, the normalization function can be a simple process of converting the seed song S i and candidate songs S j Multiply the global heat value of , refer to formula (2):
[0047] f(C i ,C j )=sqrt(C i *C j ) (2)
[0048] Candidate Songs j For seed songs S i The relevance score of formula (1) can be used to downgrade the popular songs, otherwise the candidate set will be filled with a large number of popular songs. The higher the popularity value of a song, the lower the personalized preference value it reflects.
[0049] For seed songs S i , you can select the candidate songs S j The corresponding relevance score R(S i ,S j ) sorting to select multiple candidate songs as set R i At the same time, for the set R i You can also set a score threshold to filter out some songs that are too unpopular.
[0050] For each pair of seed song and candidate song (S i ,S j ) has an edge E in the directed graph between songs ij . If and only if S j Belongs to the set R i When the edge E ij The weight of can be determined by the relevance score of formula (1).
[0051] For a seed song set S, it can be expanded according to a directed graph. That is, for each seed song S in the seed song set S i Consider the corresponding set R i and label the union of these sets as C 1 , as shown in formula (3):
[0052]
[0053] C1 The songs included in the collection are mainly songs that are highly similar to the seed song collection. In order to balance the freshness, a collection of songs that is newer to the user can be obtained.
[0054] In order to expand the recommended span, the candidate set can be expanded by using finite transition closure on the directed graph.
[0055] Specifically, define C n is a set whose distance from any song in the seed song set is n, as shown in formula (4):
[0056]
[0057] And C 0 = S is the seed song set, C 1 is the set in formula (3).
[0058] The final candidate set C final The definition of is shown in formula (5):
[0059]
[0060] Therefore, by recursively obtaining recommended songs, it is possible to achieve the effect that even for a user who has a very small seed song collection, a small distance expansion can be used to obtain a broad and diverse recommended song collection.
[0061] However, this method will filter out unpopular songs, resulting in insufficient accuracy in song recommendations; and the recommended songs obtained are a collection of songs, and it is impossible to determine a song for recommendation in the music recommendation scenario.
[0062] Based on the problems existing in the above solutions, the present disclosure provides a song recommendation method, a song recommendation device, a computer-readable medium and an electronic device.
[0063] Figure 1 A schematic diagram of an exemplary system architecture applying the technical solution of the present disclosure is shown.
[0064] like Figure 1As shown, the system architecture 100 may include a terminal 110, a network 120, and a server 130. The terminal 110 and the server 130 are connected via the network 120. The terminal 110 may be a desktop terminal or a mobile terminal, and the mobile terminal may be at least one of a mobile phone, a tablet computer, a laptop computer, etc. The network 120 may be a communication medium of various connection types that can provide a communication link between the user terminal 110 and the server 130, such as a wired communication link, a wireless communication link, or an optical fiber cable, etc. The server 130 may be implemented by an independent server or a server cluster consisting of multiple servers.
[0065] Specifically, the server 130 obtains the user's song play set, and segments the song play set to obtain data features; then, the data features are mapped to obtain feature vectors, and the feature vectors are encoded to obtain embedded vectors; further, a recommendation vector corresponding to the embedded vector is determined, and the similarity between the embedded vector and the recommendation vector is calculated to obtain a target song, which is recommended to the user.
[0066] In addition, the song recommendation method in the embodiment of the present disclosure can be applied to a terminal or a server, and the present disclosure does not make any special limitation on this. The embodiment of the present disclosure mainly uses the song recommendation method applied to the server 130 as an example for explanation.
[0067] The song recommendation method, song recommendation device, computer-readable medium and electronic device provided by the present disclosure are described in detail below in conjunction with specific implementation methods.
[0068] Figure 2 The following schematically shows a flowchart of the steps of the song recommendation method in some embodiments of the present disclosure. Figure 2 As shown, the song recommendation method may mainly include the following steps:
[0069] Step S210: Obtain a song play set, and segment the song play set to obtain data features.
[0070] Step S220: Map the data features to obtain a feature vector, and encode the feature vector to obtain an embedding vector.
[0071] Step S230: Determine a recommendation vector corresponding to the embedded vector, and calculate the similarity between the embedded vector and the recommendation vector to obtain a target song for recommendation.
[0072] In an exemplary embodiment of the present disclosure, on the one hand, determining a recommendation vector corresponding to an embedded vector may be to determine a recommendation vector that is on the same order of magnitude as the embedded vector, so that the recommendation vector is on the same order of magnitude as the embedded vector, thereby solving the problem of being unable to output unrecorded songs due to the low order of magnitude of the recommendation vector; on the other hand, determining a target song for recommendation based on a similarity calculation result improves the accuracy and real-time performance of song recommendations, solves the problem of online delays, and also meets the needs of song recommendations in scenarios such as home speakers.
[0073] The following is a detailed description of each step of the song recommendation method.
[0074] In step S210, a song play set is obtained, and the song play set is segmented to obtain data features.
[0075] In an exemplary embodiment of the present disclosure, the song play set may be a set of historical songs played by a user on a platform such as a song application, a speaker, or a mini program. Therefore, the song play set may be {m 1 ,m 2 ,m 3 ,…,m N}. Among them, m 1 ,m 2 ,m 3 ,…,m N They represent the first song, the second song, the third song, ..., the Nth song played by the user most recently. Of course, they can also represent the first song, the second song, the third song, ..., the Nth song played by the user earliest, or they can be the first song, the second song, the third song, ..., the Nth song in other ways, which is not particularly limited in this exemplary embodiment.
[0076] In addition, each song in the song play set contains three parts of the song, namely the song name, the singer and the song listening completion. Among them, the song listening completion indicates the length of time the user listens to the song. When the user listens to the entire song, the corresponding song listening completion is 1; when the user listens to a 4-minute song, but only listens to 2 minutes, the corresponding song listening completion is 0.5.
[0077] It is worth mentioning that the song playback collection is transparent to user information, that is, there is no need to obtain user information, which to a certain extent guarantees the security and privacy of user information.
[0078] Furthermore, the song play set may be segmented.
[0079] In an alternative embodiment, Figure 3 A flow chart showing the steps of the segmentation process is shown in FIG. Figure 3 As shown, the method includes at least the following steps: In step S310, the song play set is segmented to obtain a historical play set and a predicted play set.
[0080] The segmentation process of the song playing set can be realized by using a sliding window, wherein the window length and the sliding step length of the sliding window are both constant values.
[0081] For example, for a song play set containing 100 songs, the window length of the sliding window can be set to 32, and the sliding step size can be set to 1. Therefore, the song play set can be divided into {m 1 ,m 2 ,m 3 ,…,m 32},{m 2 ,m 3 ,m 4 ,…,m 33},{m 3 ,m 4 ,m 5 ,…,m 34},……,{m 68 ,m 69 ,m 70 ,…,m 100} and other sub-collections.
[0082] In each subset, the segmentation process may be continued in a 1:1 manner to obtain a historical play set and a predicted play set of each subset.
[0083] For example, in the subset {m 1 ,m 2 ,m 3 ,…,m 32}, the historical playback set corresponding to the subset can be obtained as {m 1 ,m 2 ,m 3 ,…,m 16}, and the predicted play set is {m 17 ,m 18 ,m 19 ,…,m 32}.
[0084] In addition, the song play set may be segmented in other ways or the historical play set and the predicted play set may be determined in other proportions, and this exemplary embodiment does not specifically limit this.
[0085] Furthermore, when the last divided subset does not satisfy the window length of the sliding window, the subset may be discarded, or other processing methods may be used, which is not particularly limited in this exemplary embodiment.
[0086] In step S320, the listening completion data in the predicted playback set is obtained, and candidate songs are determined in the predicted playback set based on the listening completion data.
[0087] In the predicted playback set, the listening completion degree of each song, that is, the listening completion degree data, can be determined.
[0088] Further, the listening completion data corresponding to the songs are compared to determine the song with the highest listening completion in the predicted play set as the candidate song. The candidate song can be used as the predicted song of the corresponding historical play set.
[0089] In step S330, the candidate songs are added to the historical play set to obtain data features corresponding to the historical play set.
[0090] After the candidate songs are determined, the candidate songs may be added to the historical play collection.
[0091] In an alternative embodiment, Figure 4 A flow chart showing the steps of the method for obtaining data features is shown, such as Figure 4 As shown, the method includes at least the following steps: In step S410, the candidate songs are added to the historical play set to obtain an updated play set.
[0092] When the song play set, the historical play set and the predicted play set are all sequences, the candidate song can be added to the end of the historical play sequence.
[0093] Furthermore, the song with the second highest song completion degree in the predicted play set is determined as a candidate song and added to the historical play set as a new prediction object, and this cycle is repeated multiple times. Therefore, each historical play set can obtain multiple candidate songs for training or prediction.
[0094] For example, the number of times may be 5 times, or may be other times, and this exemplary embodiment does not specifically limit this.
[0095] When the loop is finished, the historical play set that has been added to the candidate songs can be determined as the updated play set.
[0096] In step S420, data features corresponding to the song listening completion data in the updated playback set are obtained.
[0097] The data feature may be a feature corresponding to the song listening completion data in the updated play set, such as the song listening completion level.
[0098] For example, when the user listens to the entire first song, the song listening completion is 1; when the user listens to the second 4-minute song, he only listens to 2 minutes, so the song listening completion is 0.5.
[0099] Correspondingly, the listening completion levels of these two songs are 0 and 1 respectively.
[0100] It can be seen that the listening completion level is negatively correlated with the listening completion data. That is, the larger the listening completion data, the lower the listening completion level; the smaller the listening completion data, the higher the listening completion level.
[0101] In addition, two other parts of content, namely the song name and the singer, can also be obtained to serve as data features together with the song listening completion level. Of course, other data can also be obtained or processed as data features according to actual conditions, and this exemplary embodiment does not make special restrictions on this.
[0102] In this exemplary embodiment, the data characteristics of the historical play set can be determined by segmenting and adding to the song play set. The processing method is simple and easy, and the logic is rigorous, which provides a good data basis for subsequent song recommendations.
[0103] In step S220, the data features are mapped to obtain feature vectors, and the feature vectors are encoded to obtain embedded vectors.
[0104] In an exemplary embodiment of the present disclosure, the mapping process for data features may be a process of generating random numbers, so as to determine the generated random numbers as feature vectors of the data features. In addition, there may be other mapping processes, which are not particularly limited in this exemplary embodiment.
[0105] After the feature vector is obtained, the feature vector can be further encoded.
[0106] In an optional embodiment, the feature vector is input into a coding model so that the coding model encodes the feature vector to obtain an embedding vector.
[0107] The encoding model may be a transformer model. The transformer model is derived from an attention mechanism in natural language processing. In the recommendation field, it can achieve deep cross-features and learn high-level expressions of features.
[0108] The transformer model consists of two parts: the encoder and the decoder. The left half of the model is the encoder side, which is composed of 6 identical stacked layers; the right half of the model is the decoder side, which is the same as the encoder side and is also composed of 6 identical stacked layers.
[0109] It is worth noting that the feature vector is input into the encoding model, which can be input into the encoder side of the transformer model, and the feature vector is encoded by the encoder side of the transformer model to obtain the embedded vector without the need for processing at the decoder side.
[0110] When inputting feature vectors, the feature vectors of the song completion level of each song in the updated playback set can be connected, the feature vectors of the song names of each song can be connected, and then the feature vectors of the singers of each song can be connected. The feature vectors connected by these three parts can be input into the encoding model for encoding processing to obtain an embedded vector.
[0111] In addition, other methods may be used to encode the feature vector to obtain the embedded vector, which is not particularly limited in this exemplary embodiment.
[0112] In this exemplary embodiment, the encoding model is used to perform encoding processing on the feature vector, which improves the speed of the encoding processing and optimizes the effect of the encoding processing.
[0113] In step S230, a recommendation vector corresponding to the embedded vector is determined, and a similarity calculation is performed between the embedded vector and the recommendation vector to obtain a target song for recommendation.
[0114] In an exemplary embodiment of the present disclosure, an embedding vector may be obtained after encoding processing, so as to further determine a recommendation vector according to the embedding vector.
[0115] In an alternative embodiment, Figure 5 A flowchart showing the steps of the method for determining the recommendation vector is shown in FIG. Figure 5 As shown, the method includes at least the following steps: In step S510, a song library corresponding to the song play set is obtained, and the song library is segmented to obtain song features.
[0116] The song library can include a huge number of all songs. After adding the long-tail songs, it can reach millions or even tens of millions. At this time, the song library corresponds to the online process. After determining the dimension of the song library, the song library can be further segmented in the same way as the song play set to obtain song features. The specific segmentation method is the same as Figure 3 The segmentation processing method is the same as that of , which will not be repeated here.
[0117] In step S520, the song features are mapped to obtain a song vector, and the song vector is encoded to obtain a recommendation vector.
[0118] After obtaining the song features, the song features may be further mapped to obtain a song vector. The specific mapping process is the same as step S220 and will not be described in detail here.
[0119] Then, the song vector may be encoded to obtain a recommendation vector. The specific encoding method is the same as step S220 and will not be described in detail here.
[0120] In this exemplary embodiment, the song library is segmented, mapped, and encoded to obtain a recommendation vector, which can make the subsequent prediction of the target song have the same order of magnitude as the embedded vector, further improving the prediction accuracy of the target song.
[0121] After the recommendation vector is determined, the target song to be recommended can be calculated.
[0122] In an alternative embodiment, Figure 6 A flowchart showing the steps of the method for calculating the similarity distance is shown, such as Figure 6 As shown, the method at least includes the following steps: In step S610, if there are multiple recommended vectors, a vector distance calculation is performed between the embedded vector and each recommended vector to obtain multiple similarity distances.
[0123] Specifically, vector distance calculation can be implemented through faiss. Faiss is a framework that provides efficient similarity search and clustering for dense vectors, developed by Facebook AI Research. Faiss has the characteristics of fast speed, storage in memory and disk, and multiple retrieval methods.
[0124] By using the Faiss algorithm to perform vector calculations on the embedded vector and the recommendation vector of each song, the corresponding similarity distance can be obtained.
[0125] The smaller the similarity distance is, the higher the correlation between the embedded vector and the recommended vector is; the larger the similarity distance is, the lower the correlation between the embedded vector and the recommended vector is.
[0126] In step S620, a plurality of similarity distances are compared, and a target song is determined in the song library for recommendation based on the comparison result.
[0127] Specifically, the similarity distance between the embedding vector and the recommendation vector of each song in the song library can be compared, and based on the comparison result, the song with the smallest similarity distance, that is, the song in the song library with the higher relevance, is selected as the target song and recommended to the user.
[0128] In addition, there may be other ways to determine the target song based on the similarity distance, which is not particularly limited in this exemplary embodiment.
[0129] In this exemplary embodiment, the target basis is determined by calculating the similarity distance between the embedded vector and the recommendation vector. This can achieve retrieval within ten milliseconds even with a song library data volume of millions, speeding up the determination of the target song. This is extremely suitable for music recommendation scenarios during the online process.
[0130] In addition to the method of determining the target song by calculating the similarity distance in the music recommendation scenario during the online process, the target song can also be determined offline by calculating the probability distribution.
[0131] In an alternative embodiment, Figure 7 A flow chart showing the steps of a method for calculating a probability distribution is shown in FIG. Figure 7 As shown, the method at least includes the following steps: In step S710, a normalization function is used to calculate the probability distribution of the embedded vector on the recommendation vector.
[0132] The normalization function may be a softmax function, and the processing result of the softmax function is a series of integers whose sum is 1, that is, the processing result may be regarded as a probability distribution.
[0133] Therefore, the softmax function can be used to calculate the probability distribution of the embedded vector on the recommendation vector.
[0134] It is worth noting that, in general, when applying sequence-to-sequence models to text training, the sample size of text training is in the order of hundreds of thousands. Therefore, when calculating the probability distribution, hundreds of thousands of songs can be selected from the song library according to the number of songs played, and the corresponding recommendation vectors can be obtained through segmentation, mapping, and encoding processes.
[0135] In step S720, a target song is determined for recommendation based on the probability distribution.
[0136] After determining the probability distribution of the embedding vector on the recommendation vectors corresponding to hundreds of thousands of songs, the probability distributions can be compared to determine the target song to recommend to the user.
[0137] Therefore, during offline training, the prediction process can predict the possibility of playing each song, and then select the one with the highest possibility as the target song.
[0138] In this exemplary embodiment, the target song to be recommended can be determined by calculating the probability distribution. The calculation method is simple and accurate, which ensures the accuracy of the target song.
[0139] The song recommendation method provided in the embodiment of the present disclosure is described in detail below in conjunction with a specific application scenario.
[0140] Figure 8 A flowchart showing the steps of the method for obtaining data features in an application scenario is shown, such as Figure 8 As shown, black boxes 810 represent songs in the historical play set, white boxes 820 represent songs in the predicted play set, light gray boxes 830 represent candidate songs determined in the predicted play set, and dark gray boxes 840 represent songs in the historical play set that are not used.
[0141] There are 4 songs in the historical play set, namely song 1, song 2, song 3 and song 4. And, the third song in the predicted play set is determined as the candidate song 830 according to the song listening completion data.
[0142] At this time, the historical play set is in a sequence form, and the candidate song 830 can be added to the end of the historical play sequence.
[0143] Further, when the historical playback set includes Song 2, Song 3, Song 4 and Song 5, the third song in the predicted playback set is determined as candidate song 830 based on the song listening completion data, and candidate song 830 is added to the end of the historical playback sequence at this time.
[0144] Then, when the historical play set includes Song 3, Song 4, Song 5 and Song 6, the second song is determined as a candidate song 830 in the predicted play set based on the song listening completion data for further addition.
[0145] When this cycle is repeated for multiple times, generally 5 times, it can be determined that the historical play set at this time is the updated play set.
[0146] Fig. 9 A flowchart showing the steps of calculating the probability distribution in an application scenario to determine the target song is shown. Fig. 9 As shown, the song name, singer and song listening completion data are mapped and encoded to obtain an embedded vector.
[0147] The embedding vector corresponding to the song name, singer and song listening completion data can be three-dimensional data of all songs in a collection of historical songs played by the user on platforms such as song applications, speakers or mini-programs.
[0148] Specifically, the mapping process for the data feature may be a process of generating a random number, so as to determine the generated random number as a feature vector of the data feature. In addition, there may be other mapping processes, which are not particularly limited in this exemplary embodiment.
[0149] Furthermore, the feature vector may be input into a coding model so that the coding model encodes the feature vector to obtain an embedding vector.
[0150] The encoding model may be a transformer model. The feature vector is input into the encoding model, which may be input into the encoder end of the transformer model, and the feature vector is encoded by the encoder end of the transformer model to obtain an embedding vector without the need for processing at the decoder end.
[0151] When inputting feature vectors, the feature vectors of the song completion level of each song in the updated playback set can be connected, the feature vectors of the song names of each song can be connected, and then the feature vectors of the singers of each song can be connected. The feature vectors connected by these three parts can be input into the encoding model for encoding processing to obtain an embedded vector.
[0152] In addition, other methods may be used to encode the feature vector to obtain the embedded vector, which is not particularly limited in this exemplary embodiment.
[0153] After obtaining the embedding vectors of the songs in the song library, a weighted calculation may be performed on the multiple embedding vectors to strengthen the influence of important songs on the target song to be recommended.
[0154] In addition, the influence of the most recent song on the target song to be recommended may be strengthened according to the chronological order of the user's historical song collection, or in other ways, which is not particularly limited in this exemplary embodiment.
[0155] Furthermore, the normalization function is used to calculate the probability distribution of the processed embedding vector mapping on the recommendation vector corresponding to the song in the music library.
[0156] Specifically, the normalization function may be a softmax function. The processing result of the softmax function is a series of integers whose sum is 1, that is, the processing result may be regarded as a probability distribution.
[0157] Therefore, the softmax function can be used to calculate the probability distribution of the embedded vector on the recommendation vector.
[0158] It is worth noting that, in general, when applying sequence-to-sequence models to text training, the sample size of text training is in the order of hundreds of thousands. Therefore, when calculating the probability distribution, hundreds of thousands of songs can be selected from the song library according to the number of songs played, and the corresponding recommendation vectors can be obtained through segmentation, mapping, and encoding processes.
[0159] Further, the target song S is determined according to the probability distribution. 0 , and set the target song S 0 Recommended to users.
[0160] After determining the probability distribution of the embedding vector on the recommendation vectors corresponding to hundreds of thousands of songs, the probability distributions can be compared to determine the target song to recommend to the user.
[0161] Therefore, during offline training, the prediction process can predict the possibility of playing each song, and then select the one with the highest possibility as the target song.
[0162] It can be seen that since the encoding model is the encoder side of the transformer model, there is no need to perform subsequent decoder side processing.
[0163] Based on the above application scenarios, it can be seen that the song recommendation method provided by the embodiments of the present disclosure, on the one hand, determines the recommendation vector corresponding to the embedded vector so that the recommendation vector is of the same order of magnitude as the embedded vector, thereby solving the problem that unrecorded songs cannot be output due to the low order of magnitude of the recommendation vector; on the other hand, the target song is determined for recommendation based on the similarity calculation result, thereby improving the accuracy and real-time performance of song recommendations, solving the online delay problem, and meeting the song recommendation needs in scenarios such as home speakers.
[0164] It should be noted that although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0165] The following describes an apparatus embodiment of the present disclosure, which can be used to execute the song recommendation method in the above-mentioned embodiment of the present disclosure. For details not disclosed in the apparatus embodiment of the present disclosure, please refer to the above-mentioned embodiment of the song recommendation method of the present disclosure.
[0166] Fig.10 The structure block diagram of a song recommendation device in some embodiments of the present disclosure is schematically shown. Fig.10 As shown, the song recommendation device 1000 may mainly include: a segmentation processing module 1010 , a vector encoding module 1020 and a song recommendation module 1030 .
[0167] The segmentation processing module 1010 is configured to obtain a song playback set and segment the song playback set to obtain data features; the vector encoding module 1020 is configured to map the data features to obtain feature vectors, and encode the feature vectors to obtain embedded vectors; the song recommendation module 1030 is configured to determine a recommendation vector corresponding to the embedded vector, and calculate the similarity between the embedded vector and the recommendation vector to obtain a target song for recommendation.
[0168] In some embodiments of the present disclosure, the vector encoding module includes: an encoding model unit configured to input a feature vector into the encoding model so that the encoding model encodes the feature vector to obtain an embedded vector.
[0169] In some embodiments of the present disclosure, the segmentation processing module includes: a processing result unit, configured to segment the song playback set to obtain a historical playback set and a predicted playback set; a song determination unit, configured to obtain song listening completion data in the predicted playback set, and determine candidate songs in the predicted playback set based on the song listening completion data; a song adding unit, configured to add candidate songs to the historical playback set to obtain data features corresponding to the historical playback set.
[0170] In some embodiments of the present disclosure, the song adding unit includes: a set updating subunit, configured to add candidate songs to the historical playback set to obtain an updated playback set; and a feature generating subunit, configured to obtain data features in the updated playback set corresponding to the song listening completion data.
[0171] In some embodiments of the present disclosure, the song recommendation device also includes: a distribution calculation module, configured to calculate the probability distribution of the embedded vector on the recommendation vector using a normalization function; and a distribution determination module, configured to determine the target song for recommendation based on the probability distribution.
[0172] In some embodiments of the present disclosure, the song recommendation module includes: a music library acquisition unit, configured to acquire a song library corresponding to a song playback set, and segment the song library to obtain song features; a music library processing unit, configured to map the song features to obtain song vectors, and encode the song vectors to obtain recommendation vectors.
[0173] In some embodiments of the present disclosure, the song recommendation module includes: a distance calculation unit, configured to, if there are multiple recommendation vectors, perform vector distance calculation on the embedded vector and each recommendation vector to obtain multiple similarity distances; a distance recommendation unit, configured to compare the multiple similarity distances and determine the target song in the song library for recommendation based on the comparison results.
[0174] The specific details of the song recommendation device provided in each embodiment of the present disclosure have been described in detail in the corresponding method embodiment, so they will not be repeated here.
[0175] Fig.11 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present disclosure is shown.
[0176] It should be noted that Fig.11The computer system 1100 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0177] like Fig.11 As shown, the computer system 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1102 or the program loaded from the storage part 1108 to the random access memory (RAM) 1103. Various programs and data required for system operation are also stored in the RAM 1103. The CPU 1101, the ROM 1102, and the RAM 1103 are connected to each other through a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0178] The following components are connected to the I / O interface 1105: an input section 1106 including a keyboard, a mouse, etc.; an output section 1107 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to the I / O interface 1105 as needed. A removable medium 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1110 as needed so that a computer program read therefrom is installed into the storage section 1108 as needed.
[0179] In particular, according to an embodiment of the present disclosure, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 1109, and / or installed from a removable medium 1111. When the computer program is executed by a central processing unit (CPU) 1101, various functions defined in the system of the present application are executed.
[0180] It should be noted that the computer-readable medium shown in the embodiment of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by an instruction execution system, device or device or used in combination with it. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0181] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0182] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0183] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0184] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modifications, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure.
[0185] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A song recommendation method, characterized in that: The method comprises: Acquire a song play set, and segment the song play set to obtain data features; Mapping the data features to obtain a feature vector, and encoding the feature vector to obtain an embedding vector; Determine a recommendation vector corresponding to the embedding vector, and calculate the similarity between the embedding vector and the recommendation vector to obtain a target song for recommendation; The method of segmenting the song play set to obtain data features includes: segmenting the song play set to obtain a historical play set and a predicted play set; obtaining song listening completion data in the predicted play set, and determining candidate songs in the predicted play set according to the song listening completion data; adding the candidate songs to the historical play set to obtain an updated play set; and obtaining data features corresponding to the song listening completion data in the updated play set; The determining of the recommendation vector corresponding to the embedded vector, and calculating the similarity between the embedded vector and the recommendation vector to obtain a target song for recommendation, includes: obtaining a song library corresponding to the song play set, and segmenting the song library to obtain song features; mapping the song features to obtain a song vector, and encoding the song vector to obtain a recommendation vector; if there are multiple recommendation vectors, calculating the vector distance between the embedded vector and each of the recommendation vectors to obtain multiple similarity distances; comparing the multiple similarity distances, and determining the target song in the song library for recommendation based on the comparison results.
2. The song recommendation method according to claim 1, characterized in that: The encoding process of the feature vector to obtain the embedded vector includes: The feature vector is input into a coding model so that the coding model encodes the feature vector to obtain an embedding vector.
3. The song recommendation method according to claim 1, characterized in that: The method further comprises: Calculating the probability distribution of the embedding vector on the recommendation vector using a normalization function; The target song is determined according to the probability distribution for recommendation.
4. A song recommendation device, characterized in that: The device comprises: A segmentation processing module is configured to obtain a song play set and segment the song play set to obtain data features; A vector encoding module is configured to map the data features to obtain a feature vector, and encode the feature vector to obtain an embedding vector; A song recommendation module is configured to determine a recommendation vector corresponding to the embedding vector, and perform similarity calculation between the embedding vector and the recommendation vector to obtain a target song for recommendation; The method of segmenting the song play set to obtain data features includes: segmenting the song play set to obtain a historical play set and a predicted play set; obtaining song listening completion data in the predicted play set, and determining candidate songs in the predicted play set according to the song listening completion data; adding the candidate songs to the historical play set to obtain an updated play set; and obtaining data features corresponding to the song listening completion data in the updated play set; The determining of the recommendation vector corresponding to the embedded vector, and calculating the similarity between the embedded vector and the recommendation vector to obtain a target song for recommendation, includes: obtaining a song library corresponding to the song play set, and segmenting the song library to obtain song features; mapping the song features to obtain a song vector, and encoding the song vector to obtain a recommendation vector; if there are multiple recommendation vectors, calculating the vector distance between the embedded vector and each of the recommendation vectors to obtain multiple similarity distances; comparing the multiple similarity distances, and determining the target song in the song library for recommendation based on the comparison results.
5. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the song recommendation method according to any one of claims 1 to 3 is implemented.
6. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to perform the song recommendation method according to any one of claims 1 to 3 by executing the executable instructions.
7. A computer program product, characterized in that The invention comprises a computer program carried on a computer-readable medium, wherein the computer program is used to execute the song recommendation method according to any one of claims 1 to 3.
