CN114372170A - Song recommendation method, device, medium and electronic equipment - Google Patents

Song recommendation method, device, medium and electronic equipment Download PDF

Info

Publication number
CN114372170A
CN114372170A CN202011099242.2A CN202011099242A CN114372170A CN 114372170 A CN114372170 A CN 114372170A CN 202011099242 A CN202011099242 A CN 202011099242A CN 114372170 A CN114372170 A CN 114372170A
Authority
CN
China
Prior art keywords
song
vector
recommendation
data
playing set
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011099242.2A
Other languages
Chinese (zh)
Inventor
丁佳晨
谭翊章
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202011099242.2A priority Critical patent/CN114372170A/en
Publication of CN114372170A publication Critical patent/CN114372170A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/60Information retrieval; Database structures therefor; File system structures therefor of audio data
    • G06F16/63Querying
    • G06F16/635Filtering based on additional data, e.g. user or group profiles

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure provides a song recommendation method, a song recommendation device, a song recommendation medium and an electronic device. The method comprises the following steps: acquiring a song playing set, and segmenting the song playing set to obtain data characteristics; mapping the data characteristics to obtain a characteristic vector, and coding the characteristic vector to obtain an embedded vector; and determining a recommendation vector corresponding to the embedding vector, and performing similarity calculation on the embedding vector and the recommendation vector to obtain a target song for recommendation. On one hand, the recommendation vector corresponding to the embedded vector is determined, so that the order of magnitude of the recommendation vector is the same as that of the embedded vector, and the problem that unrecorded songs cannot be output due to the fact that the order of magnitude of the recommendation vector is low is solved; on the other hand, the target song is determined according to the similarity calculation result for recommendation, so that the accuracy and the real-time performance of song recommendation are improved, the problem of online delay is solved, and the song recommendation requirements in scenes such as family sound boxes are met.

Description

Song recommendation method, device, medium and electronic equipment
Technical Field
The present disclosure relates to the technical field of artificial intelligence, and in particular, to a song recommendation method, a song recommendation apparatus, a computer-readable medium, and an electronic device.
Background
In a music recommendation scenario, a music application may recommend songs to the terminal to optimize the user's experience in using the music application.
Generally, the recommended songs may be determined by using a collaborative filtering algorithm or by expanding the seed songs, but the accuracy of the recommended music is low because the cold songs are filtered out.
In view of the above, there is a need in the art to develop a new song recommendation method and apparatus.
It should be noted that the information disclosed in the above background section is only for enhancement of understanding of the technical background of the present application, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure is directed to a song recommendation method, a song recommendation apparatus, a computer-readable medium, and an electronic device, so as to overcome the technical problem of low music recommendation accuracy at least to some extent.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to an aspect of an embodiment of the present disclosure, there is provided a song recommendation method including: acquiring a song playing set, and segmenting the song playing set to obtain data characteristics; mapping the data features to obtain feature vectors, and coding the feature vectors to obtain embedded vectors; and determining a recommendation vector corresponding to the embedding vector, and calculating the similarity of the embedding vector and the recommendation vector to obtain a target song for recommendation.
According to an aspect of an embodiment of the present disclosure, there is provided a song recommendation apparatus including: the segmentation processing module is configured to acquire a song playing set and segment the song playing set to obtain data characteristics; the vector coding module is configured to perform mapping processing on the data features to obtain feature vectors, and perform coding processing on the feature vectors to obtain embedded vectors; and the song recommending module is configured to determine a recommending vector corresponding to the embedding vector and recommend the target song by calculating the similarity between the embedding vector and the recommending vector.
In some embodiments of the present disclosure, based on the above technical solutions, the vector encoding module includes: and the coding model unit is configured to input the feature vector into a coding model so that the coding model performs coding processing on the feature vector to obtain an embedded vector.
In some embodiments of the present disclosure, based on the above technical solution, the segmentation processing module includes: the processing result unit is configured to segment the song playing set to obtain a historical playing set and a predicted playing set; a song determining unit configured to acquire song listening completion data in the predicted playing set and determine candidate songs in the predicted playing set according to the song listening completion data; and the song adding unit is configured to add the candidate songs to the historical playing set so as to obtain the data characteristics corresponding to the historical playing set.
In some embodiments of the present disclosure, based on the above technical solutions, the song adding unit includes: a set updating subunit, configured to add the candidate song to the historical play set to obtain an updated play set; and the characteristic generating subunit is configured to acquire the data characteristics corresponding to the data of the completion degree of listening to the songs in the updated playing set.
In some embodiments of the present disclosure, based on the above technical solutions, the song recommendation apparatus further includes: a distribution calculation module configured to calculate a probability distribution of the embedding vector on the recommendation vector using a normalization function; and the distribution determining module is configured to determine the target song to be recommended according to the probability distribution.
In some embodiments of the present disclosure, based on the above technical solutions, the song recommendation module includes: the song library acquisition unit is configured to acquire a song library corresponding to the song playing set and perform segmentation processing on the song library to obtain song characteristics; and the song library processing unit is configured to perform mapping processing on the song characteristics to obtain a song vector, and perform coding processing on the song vector to obtain a recommendation vector.
In some embodiments of the present disclosure, based on the above technical solutions, the song recommendation module includes: the distance calculation unit is configured to perform vector distance calculation on the embedded vector and each recommendation vector to obtain a plurality of similarity distances if the recommendation vectors are multiple; and the distance recommendation unit is configured to compare the similarity distances and determine a target song to be recommended in the song library according to a comparison result.
According to an aspect of the embodiments of the present disclosure, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor implements a song recommendation method as in the above technical solutions.
According to an aspect of an embodiment of the present disclosure, there is provided an electronic apparatus including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the song recommendation method as in the above technical solution via executing the executable instructions.
In the technical scheme provided by the embodiment of the disclosure, on one hand, the recommendation vector corresponding to the embedded vector is determined, so that the order of magnitude of the recommendation vector is the same as that of the embedded vector, and the problem that unrecorded songs cannot be output due to the fact that the order of magnitude of the recommendation vector is low is solved; on the other hand, the target song is determined according to the similarity calculation result for recommendation, so that the accuracy and the real-time performance of song recommendation are improved, the problem of online delay is solved, and the song recommendation requirements in scenes such as family sound boxes are met.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty. In the drawings:
fig. 1 schematically illustrates an architecture diagram of an exemplary system to which the disclosed solution applies;
FIG. 2 schematically illustrates a flow chart of steps of a song recommendation method in some embodiments of the present disclosure;
FIG. 3 schematically illustrates a flow chart of steps of a method of a segmentation process in some embodiments of the present disclosure;
FIG. 4 schematically illustrates a flow chart of steps of a method of deriving data characteristics in some embodiments of the present disclosure;
FIG. 5 schematically illustrates a flow chart of steps of a method of determining a recommendation vector in some embodiments of the present disclosure;
FIG. 6 schematically illustrates a flow chart of steps of a method of calculating a similarity distance in some embodiments of the present disclosure;
FIG. 7 schematically illustrates a flow chart of steps of a method of calculating a probability distribution in some embodiments of the present disclosure;
FIG. 8 is a flow chart schematically illustrating steps of a method for obtaining data features in an application scenario in accordance with an embodiment of the present disclosure;
FIG. 9 is a flow chart that schematically illustrates steps of a method of an embodiment of the present disclosure for computing a probability distribution to determine a target song in an application scenario;
FIG. 10 schematically illustrates a block diagram of a song recommendation apparatus in some embodiments of the present disclosure;
FIG. 11 schematically illustrates a structural schematic diagram of a computer system suitable for use with an electronic device embodying embodiments of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different 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 thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the disclosure.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
In the related art, a Collaborative Filtering (CF) algorithm and a method of expanding seed songs are used to determine recommended songs.
Specifically, the data source of the determination method includes two parts, which are behavior data of the user and non-behavior data of the user respectively.
The behavior data of the user can include data generated by behaviors of the user such as collecting songs, downloading songs, sharing songs or actively playing songs; the non-behavioral data of the user may include data such as the user's geographic location, model of use, operating system, age and gender.
Further, the acquired data may be processed by using a collaborative filtering algorithm.
The collaborative filtering mode includes item based CF, user based CF, matrix decomposition and the like. Where item based CF may be a recommendation for a song similar to a song previously played by the user, and user based CF may be a recommendation for a song liked by another user having a common interest.
Generally, processing the acquired data using item based CF results in a candidate set of songs. And the process of obtaining the candidate set may be regarded as establishing a slave-seed song SiTo a collection R of similar or related songsiTo (3) is performed.
To obtain the set RiEach pair of seed song and candidate song (S) may be calculatedi,Sj) The number of simultaneous collections, and the number of common collections is marked as Ci,j
The candidate song SjFor seed song SiThe relevance score of (a) is defined as in equation (1):
R(Si,Cj)=Ci,j/f(Ci,Cj) (1)
wherein, CiAnd CjRespectively represent the seed song SiAnd a candidate song SjNumber of occurrences in favorites list, respectively, f (C)i,Cj) Is to calculate the seed song SiAnd a candidate song SjIs normalized to the global heat value.
In particular, the normalization function may be simply to seed the song SiAnd a candidate song SjWith reference to equation (2):
f(Ci,Cj)=sqrt(Ci*Cj) (2)
candidate song SjFor seed song SiThe relevancy score of (a) may be reduced by the formula (1), otherwise the candidate set may be filled with a large number of popular songs. And the higher the popularity value of the song, the lower the value of the embodied personalized preferences.
For seed song SiMay be according to the candidate song SjCorresponding relevance score R (S)i,Sj) The ranking selects a plurality of candidate songs asSet Ri. At the same time, for the set RiA score threshold may also be set to filter out some songs that are too cold.
For each pair of seed song and candidate song (S)i,Sj) Has an edge E of a directed graph between songsij. If and only if SjBelong to the set RiWhen the edge E isijMay be determined by the relevance score of equation (1).
For a set S of seed songs, the expansion may be performed according to a directed graph. That is, for each seed song S in the set S of seed songsiConsider the corresponding set RiAnd the union of these sets is labeled C1As shown in equation (3):
Figure BDA0002724809450000061
C1mainly the songs with higher similarity with the seed song set. To balance the freshness, a more recent set of songs may be acquired for the user.
To extend the recommended span range, the candidate set may be extended with a finite transitive closure on the directed graph.
Specifically, definition CnFor a set at a distance n from any one of the set of seed songs, as shown in equation (4):
Figure BDA0002724809450000062
and C0S is a set of seed songs, C1Is a set in equation (3).
And the final candidate set CfinalIs defined as shown in formula (5):
Figure BDA0002724809450000063
therefore, by obtaining the recommended songs in a recursive manner, the effect of obtaining a wide and diverse set of recommended songs by using the small distance expansion for a user even with a small set of seed songs can be achieved.
However, this approach may filter out cold songs, thus resulting in an insufficient accuracy of song recommendations; and the obtained recommended songs are a song set, and a song cannot be determined to be recommended in the music recommendation scene.
Based on the problems with the above solutions, the present disclosure provides a song recommendation method, a song recommendation apparatus, a computer-readable medium, and an electronic device.
Fig. 1 shows an exemplary system architecture diagram to which the disclosed solution is applied.
As shown in fig. 1, the system architecture 100 may include a terminal 110, a network 120, and a server side 130. Wherein the terminal 110 and the server 130 are connected through the network 120. The terminal 110 may specifically be a desktop terminal or a mobile terminal, and the mobile terminal may specifically be at least one of a mobile phone, a tablet computer, a notebook computer, and the like; network 120 may be any of a variety of connection types of communication media capable of providing a communication link between user terminal 110 and server end 130, such as a wired communication link, a wireless communication link, or a fiber optic cable, among others; the server 130 may be implemented by an independent server or a server cluster composed of a plurality of servers.
Specifically, the server 130 obtains a song playing set of the user, and performs segmentation processing on the song playing set to obtain data characteristics; then, mapping the data features to obtain feature vectors, and coding the feature vectors to obtain embedded vectors; furthermore, a recommendation vector corresponding to the embedding vector is determined, similarity calculation is carried out on the embedding vector and the recommendation vector to obtain a target song, and the target song is recommended to the user.
In addition, the song recommendation method in the embodiment of the present disclosure may be applied to a terminal, and may also be applied to a server side, which is not particularly limited in the present disclosure. The embodiment of the present disclosure is mainly illustrated by applying the song recommendation method to the server 130.
The song recommendation method, the song recommendation apparatus, the computer-readable medium, and the electronic device provided by the present disclosure are described in detail below with reference to specific embodiments.
Fig. 2 schematically shows a flowchart of steps of a song recommendation method in some embodiments of the present disclosure, and as shown in fig. 2, the song recommendation method may mainly include the following steps:
and S210, acquiring a song playing set, and segmenting the song playing set to obtain data characteristics.
And S220, mapping the data characteristics to obtain a characteristic vector, and coding the characteristic vector to obtain an embedded vector.
And step S230, determining a recommendation vector corresponding to the embedding vector, and performing similarity calculation on the embedding vector and the recommendation vector to obtain a target song for recommendation.
In the exemplary embodiment of the present disclosure, on one hand, determining the recommendation vector corresponding to the embedded vector may be determining the recommendation vector on the same order of magnitude as the embedded vector, so that the order of magnitude of the recommendation vector is the same as that of the embedded vector, and the problem that the unrecorded song cannot be output due to the lower order of magnitude of the recommendation vector is solved; on the other hand, the target song is determined according to the similarity calculation result for recommendation, so that the accuracy and the real-time performance of song recommendation are improved, the problem of online delay is solved, and the song recommendation requirements in scenes such as family sound boxes are met.
The respective steps of the song recommendation method will be described in detail below.
In step S210, a song play set is obtained, and the song play set is segmented to obtain data characteristics.
In an exemplary embodiment of the present disclosure, a song play set may be a set of historical songs played by a user on a platform such as a song application, a sound box, or an applet, and thus, the song play set may be { m }1,m2,m3,…,mN}. Wherein m is1,m2,m3,…,mNRespectively representing a first song, a second song, a third song, … …, and an nth song that were recently played by the user. Of course, the first song, the second song, the third song, … …, and the nth song that are played by the user at the earliest time may also be characterized, and the first song, the second song, the third song, … …, and the nth song may also be in other manners, which is not limited in this exemplary embodiment.
And, each song in the song play set contains three parts of the content of the song, namely the name of the song, the singer and the completion degree of listening to the song. Wherein the song listening completion degree indicates a time period for the user to listen to the song. When the user finishes listening to the whole song, the corresponding song listening completion degree is 1; when the user listens to a 4-minute song, the user only listens for 2 minutes, and the corresponding song listening completion degree is 0.5.
It should be noted that the song playing set is transparent to the user information, that is, the user information does not need to be acquired, and the information security and privacy of the user are guaranteed to a certain extent.
Further, the song play set may be segmented.
In an alternative embodiment, fig. 3 shows a flow chart of the steps of a method of slicing process, as shown in fig. 3, the method at least comprising the steps of: in step S310, the song play set is segmented to obtain a history play set and a prediction play set.
The process of segmenting the song play set may be implemented using a sliding window. The window length and the sliding step size of the sliding window are both constant values.
For example, for a song play set including 100 songs, the window length of the sliding window may be set to 32, and the sliding step size is 1. Thus, the song play set can be cut into m1,m2,m3,…,m32},{m2,m3,m4,…,m33},{m3,m4,m5,…,m34},……,{m68,m69,m70,…,m100A plurality of subsets.
In each sub-set, the historical play set and the predicted play set of each sub-set can be obtained by continuing the segmentation processing in a 1:1 manner.
For example, in subset { m }1,m2,m3,…,m32In the method, the historical play set corresponding to the subset can be obtained by segmentation, and the historical play set is { m }1,m2,m3,…,m16And a predictive play set is m17,m18,m19,…,m32}。
In addition, the song play set may be segmented in other manners or the historical play set and the predicted play set may be determined according to other proportions, which is not particularly limited in the present exemplary embodiment.
Moreover, when the last divided subset does not satisfy the window length of the sliding window, the subset may be discarded, or other processing manners may be available, which is not particularly limited in this exemplary embodiment.
In step S320, the song listening completion data in the predicted playing set is obtained, and a candidate song is determined in the predicted playing set according to the song listening completion data.
In the predictive play set, the completion of listening to a song, i.e., the completion data of listening to a song, of each song may be determined.
Furthermore, the song listening completion degree data corresponding to the songs are compared, and the song with the highest song listening completion degree in the predicted playing set is determined to be the candidate song. The candidate song may be a predicted song for the corresponding historical play set.
In step S330, the candidate songs are added to the historical play set to obtain data characteristics corresponding to the historical play set.
After determining the candidate songs, the candidate songs may be added to the historical play set.
In an alternative embodiment, fig. 4 shows a flow chart of the steps of a method of deriving data characteristics, which method comprises at least the following steps, as shown in fig. 4: in step S410, the candidate songs are added to the historical play set to obtain an updated play set.
When the song play set, the historical play set, and the predicted play set are all sequences, the candidate song may be added to the end of the historical play sequence.
Further, the songs with the highest song completion degree in the prediction playing set are continuously determined to be used as candidate songs to be added into the history playing set to be used as new prediction objects, and the process is circulated for multiple times. Therefore, each historical play set may result in a plurality of candidate songs for training or prediction.
For example, the number of times may be 5 times, or may be other times, which is not particularly limited in the present exemplary embodiment.
When the loop ends, the historical play set to which the candidate song has been added may be determined to be the updated play set.
In step S420, the data characteristics corresponding to the data of the completion of listening to songs in the updated playing set are obtained.
The data characteristic may be a characteristic corresponding to the data of the completion of listening to songs in the updated play set, such as the completion level of listening to songs.
For example, when the user finishes listening to the whole first song, the song listening completion degree is 1; when the user listens to the second 4-minute song, the user only listens for a 2-minute period, and thus the completion of listening to the song is 0.5.
Correspondingly, the listening completion levels of the two songs are 0 and 1, respectively.
It can be seen that the song listening completion level is inversely related to the song listening completion data. That is, the larger the data of the completion degree of listening to songs is, the lower the completion level of listening to songs is; the smaller the data of the completion degree of song listening, the higher the completion level of song listening.
In addition, the other two contents, i.e. the name of the song and the singer, can be obtained to be used as the data characteristic together with the completion level of listening to the song. Of course, other data may be acquired or processed as the data feature according to the actual situation, and this is not particularly limited in this exemplary embodiment.
In the exemplary embodiment, the data characteristics of the historical playing set can be determined by performing segmentation, addition and other processing on the song playing set, the processing mode is simple and feasible, and the method is meticulous in logic and provides a good data basis for subsequently recommending songs.
In step S220, a mapping process is performed on the data features to obtain feature vectors, and an encoding process is performed on the feature vectors to obtain embedded vectors.
In an exemplary embodiment of the present disclosure, the manner of performing the mapping process on the data feature may be a manner of generating a random number to determine the generated random number as a feature vector of the data feature. In addition, there may be other mapping processing manners, and this exemplary embodiment is not particularly limited in this respect.
After the feature vector is obtained, the feature vector may be further subjected to an encoding process.
In an alternative embodiment, the feature vector is input into the coding model, so that the coding model performs coding processing on the feature vector to obtain an embedded vector.
The coding model may be a transform model. the transformer model is derived from an attention mechanism in natural language processing, deep crossing of features can be realized in the recommendation field, and high-order expression of the features can be learned.
the transformer model consists of an encoder and a decoder, wherein the left half part of the model is an encoder end and consists of 6 same layers in an additive mode; the right half of the model is the decoder side, which is identical to the encoder side and consists of 6 identical layer stacks.
It should be noted that the feature vector may be input to the encoder of the transform model, and the feature vector is encoded by the encoder of the transform model to obtain the embedded vector, which does not need to be processed by the decoder.
When the feature vectors are input, the feature vectors of the song listening completion level of each song in the updated playing set can be connected, the feature vectors of the song name of each song are connected, the feature vectors of the singer of each song are connected, and the three connected feature vectors are input into a coding model to be coded to obtain the embedded vector.
In addition, other ways may also be used to encode the feature vector to obtain the embedded vector, which is not limited in this exemplary embodiment.
In the present exemplary embodiment, the feature vector is encoded by using the encoding model, so that the speed of the encoding process is increased, and the effect of the encoding process is optimized.
In step S230, a recommendation vector corresponding to the embedding vector is determined, and the embedding vector and the recommendation vector are subjected to similarity calculation to obtain a target song for recommendation.
In an exemplary embodiment of the present disclosure, the embedded vector may be obtained after the encoding process is performed to further determine a recommendation vector from the embedded vector.
In an alternative embodiment, fig. 5 shows a flow chart of the steps of a method of determining a recommendation vector, as shown in fig. 5, the method comprising at least the steps of: in step S510, a song library corresponding to the song playing set is obtained, and the song library is segmented to obtain the song characteristics.
The song library can include all songs with huge number, and after long-tail songs are added, the song library can reach the magnitude of millions or even tens of millions. At this time, the song library is corresponded in the online process. After the dimension of the song library is determined, the song library can be further subjected to the same segmentation processing as the song playing set to obtain the song characteristics. The specific segmentation processing method is the same as the segmentation processing method in fig. 3, and is not described herein again.
In step S520, the song features are mapped to obtain a song vector, and the song vector is encoded to obtain a recommendation vector.
After the song features are obtained, the song features can be further subjected to mapping processing to obtain a song vector. The specific mapping processing manner is the same as that of step S220, and is not described herein again.
Then, the song vector may be encoded to obtain a recommendation vector. The specific encoding processing manner is the same as that of step S220, and is not described herein again.
In the exemplary embodiment, the recommendation vector is obtained by performing processes such as segmentation, mapping, and encoding on the song library, so that the order of magnitude of the target song to be predicted subsequently is the same as that of the embedded vector, and the prediction accuracy of the target song is further improved.
After determining the recommendation vector, a calculation may be made to obtain the target song to be recommended.
In an alternative embodiment, fig. 6 shows a flow chart of the steps of a method of calculating a similarity distance, as shown in fig. 6, the method comprising at least the steps of: in step S610, if there are multiple recommendation vectors, a vector distance calculation is performed on the embedded vector and each recommendation vector to obtain multiple similarity distances.
Specifically, the vector distance calculation may be implemented by faiss. faces is a framework that provides efficient similarity search and clustering for dense vectors, developed by Facebook AI Research. The faiss has the characteristics of high speed, capability of being stored in a memory and a magnetic disk, multiple retrieval modes and the like.
And performing vector calculation on the embedded vector and the recommendation vector of each song by using a faiss algorithm to obtain a corresponding similarity distance.
The smaller the similarity distance is, the higher the correlation degree of the embedded vector and the recommended vector is; the greater the similarity distance, the lower the correlation between the embedding vector and the recommendation vector.
In step S620, the similarity distances are compared, and a target song is determined in the song library for recommendation according to the comparison result.
Specifically, the similarity distance between the embedded vector and the recommendation vector of each song in the song library may be compared, and the song in the song library with the smallest similarity distance, that is, the higher correlation, may be selected as the target song according to the comparison result, and recommended to the user.
In addition, there may be other ways to determine the target song according to the similarity distance, and this exemplary embodiment is not particularly limited to this.
In the exemplary embodiment, the similarity distance between the embedded vector and the recommendation vector is calculated to determine the target basis, so that the retrieval is completed within ten milliseconds under the condition of millions of song library data volumes, the determination speed of the target song is increased, and the method is extremely suitable for music recommendation scenes in the online process.
In addition to the way of determining the target song by calculating the similarity distance in the music recommendation scene during the online process, the way of calculating the probability distribution can be used for determining the target song online.
In an alternative embodiment, fig. 7 shows a flow chart of the steps of a method of calculating a probability distribution, as shown in fig. 7, the method comprising at least the steps of: in step S710, a probability distribution of the embedding vector on the recommendation vector is calculated using a normalization function.
Wherein the normalization function may be a softmax function. The result of the processing of the softmax function is a series of integers which add to 1, i.e. the result of the processing can be considered as a probability distribution.
Therefore, the probability distribution of the embedded vector on the recommendation vector can be calculated by utilizing the softmax function.
It is worth noting that the sample size of the text training is in the order of hundreds of thousands when the general sequence pair sequence model is applied in the text training process. Therefore, when the probability distribution is calculated, hundreds of thousands of songs can be selected from the song library according to the playing amount of the songs, and the corresponding recommendation vectors can be obtained through the processes of segmentation processing, mapping processing, encoding processing and the like.
In step S720, the target song is determined to be recommended according to the probability distribution.
After determining the probability distribution of the embedded vector over the recommendation vectors corresponding to hundreds of thousands of songs, the probability distributions may be compared to determine that the target song is recommended to the user.
Therefore, in the online off-training process, the prediction process can predict the playing possibility of each song, and then selects one with the highest possibility as the target song.
In the exemplary embodiment, the target song to be recommended can be determined by calculating the probability distribution, the calculation mode is simple and accurate, and the accuracy of the target song is guaranteed.
The following describes a song recommendation method provided in the embodiments of the present disclosure in detail with reference to a specific application scenario.
Fig. 8 is a flowchart illustrating steps of a method for obtaining data characteristics in an application scenario, where as shown in fig. 8, black boxes 810 represent songs in a historical play set, white boxes 820 represent songs in a 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.
Wherein, there are 4 songs in the history playing set, which are song 1, song 2, song 3 and song 4 respectively. And, determining 830 the 3 rd song in the predicted playing set as the candidate song according to the song listening completion data.
The historical play set at this time is in the form of a sequence, and the candidate song 830 may be added to the end of the historical play sequence.
Further, in the case that the historical play set includes song 2, song 3, song 4, and song 5, the 3 rd song in the predictive play set is determined as the candidate song 830 according to the song listening completion data, and the candidate song 830 is added to the end of the historical play sequence at this time.
Then, in the case that the historical play set includes song 3, song 4, song 5, and song 6, the 2 nd song is determined to be the candidate song 830 in the predictive play set according to the listening song completion data for further addition.
When such a loop is performed for a plurality of times, typically 5 times, the historical play set at this time can be determined as the updated play set.
Fig. 9 is a flowchart illustrating steps of a method for calculating probability distribution to determine a target song in an application scenario, and as shown in fig. 9, data of song names, singers and song listening completion degrees are subjected to mapping processing and encoding processing to obtain embedded vectors.
The embedded vectors corresponding to the song name, singer and song listening completion data may be data of three dimensions of all songs in a set of historical songs played by a user on a platform such as a song application, a sound box or an applet.
Specifically, the data feature may be mapped in a manner 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 processing manners, and this exemplary embodiment is not particularly limited in this respect.
Further, the feature vector may be input into the coding model, so that the coding model performs a coding process on the feature vector to obtain the embedded vector.
The coding model may be a transform model. The feature vector is input into the coding model, which may be input into an encoder end of the transform model, and the feature vector is encoded by the encoder end of the transform model to obtain an embedded vector, without processing at a decoder end.
When the feature vectors are input, the feature vectors of the song listening completion level of each song in the updated playing set can be connected, the feature vectors of the song name of each song are connected, the feature vectors of the singer of each song are connected, and the three connected feature vectors are input into a coding model to be coded to obtain the embedded vector.
In addition, other ways may also be used to encode the feature vector to obtain the embedded vector, which is not limited in this exemplary embodiment.
After obtaining the embedded vectors for songs in the song library, a plurality of embedded vectors may be weighted to enhance the impact of important songs on the target song to be recommended.
In addition, the influence of the latest song on the target song to be recommended may be strengthened according to the time sequence of the set of historical songs of the user, or in other ways, which is not particularly limited in the present exemplary embodiment.
Further, the probability distribution of the processed embedded vector mapped on the recommendation vector corresponding to the song library song is calculated by utilizing a normalization function.
In particular, the normalization function may be a softmax function. The result of the processing of the softmax function is a series of integers which add to 1, i.e. the result of the processing can be considered as a probability distribution.
Therefore, the probability distribution of the embedded vector on the recommendation vector can be calculated by utilizing the softmax function.
It is worth noting that the sample size of the text training is in the order of hundreds of thousands when the general sequence pair sequence model is applied in the text training process. Therefore, when the probability distribution is calculated, hundreds of thousands of songs can be selected from the song library according to the playing amount of the songs, and the corresponding recommendation vectors can be obtained through the processes of segmentation processing, mapping processing, encoding processing and the like.
Further, the target song S is determined according to the probability distribution0And the target song S0And recommending to the user.
After determining the probability distribution of the embedded vector over the recommendation vectors corresponding to hundreds of thousands of songs, the probability distributions may be compared to determine that the target song is recommended to the user.
Therefore, in the online off-training process, the prediction process can predict the playing possibility of each song, and then selects one with the highest possibility as the target song.
It can be seen that, since the coding model is the encoder side of the transform model, subsequent processing at the decoder side is not required.
Based on the application scenarios, on one hand, the song recommendation method provided by the embodiment of the disclosure determines the recommendation vector corresponding to the embedded vector, so that the order of magnitude of the recommendation vector is the same as that of the embedded vector, and the problem that unrecorded songs cannot be output due to the fact that the order of magnitude of the recommendation vector is low is solved; on the other hand, the target song is determined according to the similarity calculation result for recommendation, so that the accuracy and the real-time performance of song recommendation are improved, the problem of online delay is solved, and the song recommendation requirements in scenes such as family sound boxes are met.
It should be noted that although the various steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that these steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
Embodiments of the apparatus of the present disclosure are described below, which may be used to perform the song recommendation method in the above-described embodiments of the present disclosure. For details that are not disclosed in the embodiments of the apparatus of the present disclosure, please refer to the embodiments of the song recommendation method described above in the present disclosure.
Fig. 10 schematically illustrates a block diagram of a song recommendation apparatus in some embodiments of the present disclosure. As shown in fig. 10, the song recommending apparatus 1000 may mainly include: a segmentation processing module 1010, a vector encoding module 1020, and a song recommendation module 1030.
The segmentation processing module 1010 is configured to obtain a song playing set, and segment the song playing set to obtain data characteristics; a vector encoding module 1020 configured to perform mapping processing on the data features to obtain feature vectors, and perform encoding processing on the feature vectors to obtain embedded vectors; and a song recommending module 1030 configured to determine a recommendation vector corresponding to the embedding vector, and recommend the target song by performing similarity calculation between the embedding vector and the recommendation vector.
In some embodiments of the disclosure, the vector encoding module comprises: and the coding model unit is configured to input the feature vector into the coding model so that the coding model performs coding processing on the feature vector to obtain the embedded vector.
In some embodiments of the present disclosure, the segmentation process module includes: the processing result unit is configured to segment the song playing set to obtain a historical playing set and a predicted playing set; the song determining unit is configured to acquire the song listening completion degree data in the predicted playing set and determine candidate songs in the predicted playing set according to the song listening completion degree data; and the song adding unit is configured to add the candidate songs to the historical playing set so as to obtain the data characteristics corresponding to the historical playing set.
In some embodiments of the present disclosure, the song adding unit includes: the collection updating subunit is configured to add the candidate songs to the historical playing collection to obtain an updated playing collection; and the characteristic generating subunit is configured to acquire the data characteristics corresponding to the data of the completion degree of listening to the songs in the updated playing set.
In some embodiments of the present disclosure, the song recommending apparatus further comprises: a distribution calculation module configured to calculate a probability distribution of the embedded vector on the recommendation vector using a normalization function; and the distribution determining module is configured to determine the target songs to recommend according to the probability distribution.
In some embodiments of the disclosure, the song recommendation module comprises: the song library acquisition unit is configured to acquire a song library corresponding to the song playing set and perform segmentation processing on the song library to obtain song characteristics; and the song library processing unit is configured to map the song characteristics to obtain a song vector and encode the song vector to obtain a recommendation vector.
In some embodiments of the disclosure, the song recommendation module comprises: the distance calculation unit is configured to perform vector distance calculation on the embedded vector and each recommendation vector to obtain a plurality of similarity distances if the recommendation vectors are multiple; and the distance recommendation unit is configured to compare the plurality of similarity distances and determine a target song to be recommended in the song library according to the comparison result.
The specific details of the song recommendation apparatus provided in each embodiment of the present disclosure have been described in detail in the corresponding method embodiment, and therefore are not described herein again.
FIG. 11 illustrates a schematic structural diagram of a computer system suitable for use in implementing an electronic device of an embodiment of the present disclosure.
It should be noted that the computer system 1100 of the electronic device shown in fig. 11 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 11, a computer system 1100 includes a Central Processing Unit (CPU)1101, which can perform various appropriate actions and processes in accordance with a program stored in a Read-Only Memory (ROM) 1102 or a program loaded from a storage section 1108 into a Random Access Memory (RAM) 1103. In the RAM 1103, various programs and data necessary for system operation are also stored. The CPU 1101, ROM 1102, and RAM 1103 are connected to each other by a bus 1104. An Input/Output (I/O) interface 1105 is also connected to bus 1104.
The following components are connected to the I/O interface 1105: an input portion 1106 including a keyboard, mouse, and the like; an output section 1107 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage section 1108 including a hard disk and the like; and a communication section 1109 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. The communication section 1109 performs communication processing via a network such as the internet. A driver 1110 is also connected to the I/O interface 1105 as necessary. A removable medium 1111 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1110 as necessary, so that a computer program read out therefrom is mounted into the storage section 1108 as necessary.
In particular, the processes described in the various method flowcharts may be implemented as computer software programs, according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 1109 and/or installed from the 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.
It should be noted that the computer readable medium shown in the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer-readable signal medium may include a propagated data signal with computer-readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains.
It will be understood that the present disclosure is not limited to the precise arrangements 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 (10)

1. A song recommendation method, the method comprising:
acquiring a song playing set, and segmenting the song playing set to obtain data characteristics;
mapping the data features to obtain feature vectors, and coding the feature vectors to obtain embedded vectors;
and determining a recommendation vector corresponding to the embedding vector, and calculating the similarity of the embedding vector and the recommendation vector to obtain a target song for recommendation.
2. The song recommendation method of claim 1, wherein the encoding the feature vector to obtain an embedded vector comprises:
and inputting the characteristic vector into a coding model so that the coding model carries out coding processing on the characteristic vector to obtain an embedded vector.
3. The song recommendation method according to claim 1, wherein the segmenting the song play set to obtain data characteristics comprises:
performing segmentation processing on the song playing set to obtain a historical playing set and a predicted playing set;
acquiring song listening completion data in the predicted playing set, and determining candidate songs in the predicted playing set according to the song listening completion data;
and adding the candidate songs to the historical playing set to obtain the data characteristics corresponding to the historical playing set.
4. The song recommendation method of claim 3, wherein the adding the candidate song to the historical play set to obtain the data feature corresponding to the historical play set comprises:
adding the candidate songs to the historical playing set to obtain an updated playing set;
and acquiring data characteristics corresponding to the song listening completion data in the updated playing set.
5. The song recommendation method of claim 1, further comprising:
calculating a probability distribution of the embedding vector on the recommendation vector by using a normalization function;
and determining the target song to be recommended according to the probability distribution.
6. The song recommendation method of claim 1, wherein said determining a recommendation vector corresponding to the embedded vector comprises:
acquiring a song library corresponding to the song playing set, and performing segmentation processing on the song library to obtain song characteristics;
and mapping the song characteristics to obtain a song vector, and encoding the song vector to obtain a recommendation vector.
7. The song recommendation method of claim 6, wherein the calculating the similarity of the embedding vector and the recommendation vector to obtain the target song for recommendation comprises:
if the recommendation vectors are multiple, vector distance calculation is carried out on the embedded vector and each recommendation vector to obtain multiple similarity distances;
and comparing the similarity distances, and determining a target song in the song library to recommend according to the comparison result.
8. A song recommendation apparatus, characterized in that the apparatus comprises:
the segmentation processing module is configured to acquire a song playing set and segment the song playing set to obtain data characteristics;
the vector coding module is configured to perform mapping processing on the data features to obtain feature vectors, and perform coding processing on the feature vectors to obtain embedded vectors;
and the song recommending module is configured to determine a recommending vector corresponding to the embedding vector and recommend the target song by calculating the similarity between the embedding vector and the recommending vector.
9. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the song recommendation method according to any one of claims 1 to 7.
10. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the song recommendation method of any one of claims 1 to 7 via execution of the executable instructions.
CN202011099242.2A 2020-10-14 2020-10-14 Song recommendation method, device, medium and electronic equipment Pending CN114372170A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011099242.2A CN114372170A (en) 2020-10-14 2020-10-14 Song recommendation method, device, medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011099242.2A CN114372170A (en) 2020-10-14 2020-10-14 Song recommendation method, device, medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN114372170A true CN114372170A (en) 2022-04-19

Family

ID=81138569

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011099242.2A Pending CN114372170A (en) 2020-10-14 2020-10-14 Song recommendation method, device, medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114372170A (en)

Similar Documents

Publication Publication Date Title
US11423234B2 (en) Content generation using target content derived modeling and unsupervised language modeling
CN111241851A (en) Semantic similarity determination method and device and processing equipment
CN106407381B (en) A kind of method and apparatus of the pushed information based on artificial intelligence
CN111259647A (en) Question and answer text matching method, device, medium and electronic equipment based on artificial intelligence
CN116601626A (en) Personal knowledge graph construction method and device and related equipment
CN112182281B (en) Audio recommendation method, device and storage medium
CN114548296A (en) Graph convolution recommendation method based on self-adaptive framework and related device
CN116452263A (en) Information recommendation method, device, equipment, storage medium and program product
CN116034402A (en) Deterministic learning video scene detection
WO2024021685A1 (en) Reply content processing method and media content interactive content interaction method
CN116956183A (en) Multimedia resource recommendation method, model training method, device and storage medium
CN113704466B (en) Text multi-label classification method and device based on iterative network and electronic equipment
CN116958622A (en) Data classification method, device, equipment, medium and program product
US20220405473A1 (en) Machine learning for training nlp agent
WO2022246162A1 (en) Content generation using target content derived modeling and unsupervised language modeling
US20220171985A1 (en) Item recommendation with application to automated artificial intelligence
CN114372170A (en) Song recommendation method, device, medium and electronic equipment
CN111914201B (en) Processing method and device of network page
CN112417260B (en) Localized recommendation method, device and storage medium
US20210117853A1 (en) Methods and systems for automated feature generation utilizing formula semantification
CN113761933A (en) Retrieval method, retrieval device, electronic equipment and readable storage medium
CN114996435A (en) Information recommendation method, device, equipment and storage medium based on artificial intelligence
CN112035740A (en) Project use duration prediction method, device, equipment and storage medium
CN113220994B (en) User personalized information recommendation method based on target object enhanced representation
CN112417086B (en) Data processing method, device, server and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination