Video recommendation method, apparatus, device, medium, and product
By generating user key-value pairs to represent user interests and preferences, the system recommends videos that are different from those already watched by the user, solving the problem of high latency in existing video recommendation technologies and achieving real-time and efficient video recommendation.
Patent Information
- Application Number
- CN202111054293.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-09
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-01-02
AI Technical Summary
Existing video recommendation methods have high latency, which cannot meet user needs, especially when there are a large number of active users and requests, the MinHash algorithm takes too long to calculate user similarity.
By generating user key values to represent user interests and preferences, target videos are selected from the user's video collection using preset selection rules, and videos different from those already watched by the user are recommended, avoiding the need to calculate similarity between users and reducing data computation complexity and cost.
It effectively reduces the latency of video recommendations, improves the user experience, and ensures real-time recommendation capabilities under a large number of user requests.
Smart Images

Figure CN113849684B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of video, and particularly relates to a video recommendation method and device, equipment, medium and product. BACKGROUND
[0002] With the rapid development of Internet technology and smart electronic devices, video playing as a practical function of electronic devices has been favored by more and more people, and the number of users watching videos through electronic devices is also increasing. However, video works are usually large in quantity and mixed in content, and it is difficult for people to quickly find the video of their interest from a large number of videos. Therefore, how to recommend the video of user interest to the user from a large number of videos has become a technical problem to be solved.
[0003] In the related art, the similarity between users is usually calculated by using a MinHash algorithm, and videos are recommended to users based on the similarity. For example, if the similarity between user A and user B is calculated to be relatively high, the videos watched by user B are recommended to user A.
[0004] In the process of implementing the present disclosure, the inventors found that at least the following problems exist in the related art: using the MinHash algorithm can only calculate the similarity between users in real time and on a small scale, and in the case of a large number of active users and a large number of user requests, a large amount of time is required for similarity calculation, resulting in high latency and failing to meet user demand. SUMMARY
[0005] The present disclosure provides a video recommendation method, device, equipment, medium and product to at least solve the problem of high latency of the video recommendation method in the related art and failing to meet user demand.
[0006] The technical solutions of the present disclosure are as follows:
[0007] According to a first aspect of embodiments of the present disclosure, a video recommendation method is provided, including: obtaining video data corresponding to a video acquisition request sent by a terminal device according to the received video acquisition request, wherein the video data includes a first video set watched by a first user corresponding to the terminal device, and each video in the first video set corresponds to a video identifier; generating a first user key value of the first user according to a video identifier of a first target video in the first video set, the first user key value being used to represent an interest preference of the first user, and the first target video being selected from the first video set based on a preset selection rule; determining a target user set corresponding to the first user key value in a preset database, wherein the preset database includes a plurality of user key values and a user set corresponding to each user key value, and users in a same user set have similar interest preferences; and recommending a second target video to the first user according to videos watched by all users in the target user set, wherein the second target video includes videos different from video identifiers of videos watched by the first user.
[0008] As an implementable manner of the first aspect, the preset selection rule includes selecting videos based on a first preset number, a second preset number and a first preset similarity threshold, and before determining the target user set corresponding to the first user key value in the preset database, the method further includes: obtaining a video set watched by each user in a plurality of users; selecting a first preset number of videos from the video set watched by each user to obtain a second video set corresponding to each user; determining a target selection number based on the first preset number, the first preset similarity threshold and the second preset number; selecting a second preset number of videos from the second video set corresponding to each user each time based on the target selection number; generating at least one user key value corresponding to each user based on video identifiers of the second preset number of videos selected each time; determining at least two users in the plurality of users corresponding to a same user key value; storing the same user key value and a user set corresponding to the same user key value, the user set including user identifiers of the at least two users, to obtain the preset database.
[0009] As an implementable manner of the first aspect, generating the first user key value of the first user according to the video identifier of the first target video in the first video set includes: selecting a first preset number of videos from the first video set to obtain a third video set corresponding to the first user; selecting a second preset number of first target videos from the third video set each time based on a target selection number; and generating the user key value of the first user based on identifiers of the first target videos selected each time.
[0010] As an implementation of the first aspect, the video acquisition request comprises a user identifier of the first user, and the video data corresponding to the video acquisition request is acquired, comprising: acquiring a video watched by the first user, and user context information and user attribute information corresponding to the user identifier; and filtering the video watched by the first user according to the user context information and the user attribute information to obtain a first video set.
[0011] As an implementation of the first aspect, the method further comprises: when the first user key value is not included in the preset database, acquiring a fourth video set watched by the first user in a first preset time period, and a fifth video set watched by a user in the plurality of users in the first preset time period; calculating the similarity of the fourth video set and the plurality of fifth video sets according to a minimum hash algorithm to obtain the similarity of the first user and the plurality of users; and recommending, to the first user, a video set watched by a third user, wherein the third user is a user in the plurality of users whose similarity to the first user is greater than a second preset similarity threshold, and the video in the video set is different from the video identifier of the video watched by the first user.
[0012] As an implementation of the first aspect, the video acquisition request comprises a user identifier of the first user, and the method further comprises: when the first user key value is not included in the preset database, storing the first user key value and the user identifier of the first user corresponding to the first user key value.
[0013] According to a second aspect of the embodiments of the present disclosure, a video recommendation device is provided, comprising: an acquisition module configured to acquire video data corresponding to a video acquisition request received by a terminal device according to the video acquisition request, wherein the video data comprises a first video set watched by a first user corresponding to the terminal device, and each video in the first video set corresponds to a video identifier; a generation module configured to generate a first user key value of the first user according to a video identifier of a first target video in the first video set, the first user key value being used to represent the interest preference of the first user, and the first target video being selected from the first video set based on a preset selection rule; a determination module configured to determine a target user set corresponding to the first user key value in a preset database, wherein the preset database comprises a plurality of user key values, and a user set corresponding to each user key value, and the interest preferences of the users in a same user set are similar; and a recommendation module configured to recommend a second target video to the first user according to a video watched by all users in the target user set, wherein the second target video comprises a video different from the video identifier of the video watched by the first user.
[0014] As an implementation of the second aspect, the preset selection rule comprises selecting the videos based on the first preset number, the second preset number and the first preset similarity threshold, and the apparatus further comprises: an obtaining module, further configured to obtain a set of videos watched by each of the plurality of users before determining the target user set corresponding to the first user key in the preset database; a selection module, configured to select the first preset number of videos from the set of videos watched by each of the plurality of users to obtain a second video set corresponding to each of the plurality of users; a determination module, further configured to determine the target selection times based on the first preset number, the first preset similarity threshold and the second preset number; the selection module, further configured to select the second preset number of videos from the second video set corresponding to each of the plurality of users each time based on the target selection times; a generation module, further configured to generate at least one user key corresponding to each of the plurality of users based on the video identifiers of the second preset number of videos selected each time; the determination module, further configured to determine at least two users of the plurality of users corresponding to the same user key; and a storage module, configured to store the same user key and the user set corresponding to the same user key, the user set comprising user identifiers of the at least two users, to obtain the preset database.
[0015] As an implementation of the second aspect, the generation module comprises: a selection unit, configured to select the first preset number of videos from the first video set to obtain a third video set corresponding to the first user; the selection unit, further configured to select the second preset number of first target videos from the third video set each time based on the target selection times; and a generation unit, configured to generate the user key of the first user based on the identifiers of the first target videos selected each time.
[0016] As an implementation of the second aspect, the video obtaining request comprises a user identifier of the first user, and the obtaining module comprises: an obtaining unit, configured to obtain the videos watched by the first user, and user context information and user attribute information corresponding to the user identifier; and a screening unit, configured to screen the videos watched by the first user according to the user context information and the user attribute information to obtain the first video set.
[0017] As an implementation manner of the second aspect, the apparatus further includes: an obtaining module, further configured to obtain a fourth video set watched by the first user in a first preset time period and a fifth video set watched by a user in the plurality of users in the first preset time period when the first user key value is not included in the preset database; a calculating module, configured to calculate the similarity between the fourth video set and the plurality of fifth video sets according to the MinHash algorithm to obtain the similarity between the first user and the plurality of users; and a recommending module, further configured to recommend, to the first user, a video in the video set watched by the third user, the video having a video identifier different from the video watched by the first user, wherein the third user is a user in the plurality of users having a similarity greater than a second preset similarity threshold with the first user.
[0018] As an implementation manner of the second aspect, the video obtaining request includes a user identifier of the first user, and the apparatus further includes a storage module, configured to store the first user key value and the user identifier of the first user corresponding to the first user key value when the first user key value is not included in the preset database.
[0019] According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the video recommendation method of the first aspect.
[0020] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the video recommendation method of the first aspect.
[0021] According to a fifth aspect of the embodiments of the present disclosure, a computer program product is provided, including computer instructions, when the computer instructions are executed by a processor, the video recommendation method of the first aspect is implemented.
[0022] The technical solutions provided by the embodiments of the present disclosure at least bring the following beneficial effects:
[0023] In the embodiments of the present disclosure, according to the received video acquisition request sent by the terminal device, the video data corresponding to the video acquisition request is acquired, wherein the video data comprises a first video set watched by a first user corresponding to the terminal device, and each video in the first video set corresponds to a video identifier; a first user key value of the first user is generated according to a video identifier of a first target video in the first video set, and the first target video is selected from the first video set based on a preset selection rule. Since the first user key value can be used to represent the interest preference of the first user, after determining a target user set corresponding to the first user key value in the preset database, a second target video can be recommended to the first user according to the videos watched by all users in the target user set, wherein the second target video comprises a video different from the video identifier of the video watched by the first user. Based on this, a plurality of users corresponding to the same user key value can determine that their interest preferences are similar, and therefore can recommend each other to browse the watched videos, without calculating the similarity between the users, effectively reducing the data calculation complexity and the calculation cost, reducing the time delay, and improving the user experience. For example, if the user key values of user A and user B are the same, the videos in a video set watched by user B and not watched by user A can be recommended to user A, and similarly, the videos in a video set watched by user A and not watched by user B can be recommended to user B, without calculating the similarity between user A and user B. Therefore, the embodiments of the present disclosure can solve the problem that the video recommendation method in the related art has a high time delay and cannot meet the user demand.
[0024] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0025] The accompanying drawings incorporated in the specification and forming a part of the specification illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure, and do not constitute an undue limitation on the present disclosure.
[0026] Figure 1 is an architecture diagram of a video recommendation according to an exemplary embodiment.
[0027] Figure 2 is a flowchart of a video recommendation method according to an exemplary embodiment.
[0028] Figure 3 is a flowchart of another video recommendation method according to an exemplary embodiment.
[0029] Figure 4 is a flowchart of still another video recommendation method according to an exemplary embodiment.
[0030] Figure 5is a block diagram of a video recommendation device according to an exemplary embodiment.
[0031] Figure 6 is a block diagram of an electronic device according to an exemplary embodiment.
[0032] Figure 7 is a block diagram of a device for a video recommendation method according to an exemplary embodiment. DETAILED DESCRIPTION
[0033] In order for those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings.
[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Rather, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0035] As in the background art, in the related art, the similarity between users is usually calculated using the MinHash algorithm, and videos are recommended to users based on the similarity. For example, the video sets corresponding to user A and user B are obtained respectively, and the number of same elements in the two sets is counted by traversing all elements in the two sets to represent the similarity of the sets, which can be used to represent the similarity between user A and user B. In the case where the similarity between user A and user B is high, the videos watched by user B are recommended to user A.
[0036] In the process of implementing the present application, the inventors found that at least the following problems exist in the related art: Since the calculation process of the similarity using the MinHash algorithm needs to traverse all elements in the set, the calculation process is relatively complex, so that using this calculation method can only calculate the similarity between users in real time and in small scale. In the case of a large number of active users and a large number of user requests, a large amount of time is required for similarity calculation, real-time large-scale calculation cannot be achieved, the latency of video recommendation is high, and user demand cannot be met.
[0037] To solve the problem of high latency of the video recommendation method in the related art and the inability to meet user needs, the present disclosure provides a video recommendation method. According to a video acquisition request sent by a terminal device, video data corresponding to the video acquisition request is acquired, wherein the video data includes a first video set watched by a first user corresponding to the terminal device, and each video in the first video set corresponds to a video identifier; a first user key value of the first user is generated according to a video identifier of a first target video in the first video set, and the first target video is selected from the first video set based on a preset selection rule. Since the first user key value can be used to represent the interest preference of the first user, after determining a target user set corresponding to the first user key value in a preset database, a second target video can be recommended to the first user according to the videos watched by all users in the target user set, wherein the second target video includes videos different from the video identifiers of the videos watched by the first user. Based on this, for multiple users corresponding to the same user key value, their interest preferences can be determined to be similar, so they can recommend each other to browse the videos they have watched, without calculating the similarity between users, effectively reducing the data calculation complexity and calculation cost, reducing the latency, and improving the user experience. For example, if the user key values of user A and user B are the same, the videos in the video set watched by user B and not watched by user A can be recommended to user A, and similarly, the videos in the video set watched by user A and not watched by user B can be recommended to user B, without calculating the similarity between user A and user B, solving the problem of high latency of the video recommendation method in the related art and the inability to meet user needs.
[0038] The video recommendation method provided by the embodiments of the present disclosure will be described in detail below in combination with the drawings, specific embodiments and application scenarios.
[0039] First, the video recommendation method provided by the present disclosure can be applied to an architecture such as Figure 1 , which will be described in detail in combination with Figure 1 .
[0040] Figure 1 is a video recommendation architecture diagram according to an exemplary embodiment.
[0041] As shown in Figure 1 , the electronic device 100 is in communication connection with the terminal device 200 through the network 300 to perform data communication or interaction. The electronic device 100 can be an interactive server or the like. The terminal device 200 can be, but is not limited to, a personal computer (PC), a smart phone, a tablet computer, a personal digital assistant (PDA), or the like. The network 300 can be a wired or wireless network. It should be noted that Figure 1As an example, the number of terminal devices 200 can be set according to actual needs in actual application.
[0042] In the embodiments of the present disclosure, the terminal device 200 can install a client of a video playing application, such as a client of a short video application, and the client can play a video in a user interface. The client installed in the terminal device 200 and the electronic device 100 can communicate with each other through the network 300. After a user registers an account in the client, the user can upload and watch a video, or watch a video uploaded by another user. Generally, one client is installed in one terminal device 200, but the embodiments of the present disclosure do not exclude the case that multiple clients can be installed in one terminal device 200, and the number of clients is not limited in the embodiments of the present disclosure.
[0043] In the embodiments of the present disclosure, the client is also called a user end. Optionally, the client can correspond to an application, or the client can correspond to a webpage. The type of the application corresponding to the client is not limited in the embodiments of the present disclosure, and the type of the application can include but is not limited to at least one of the following types: a video playing application, an instant messaging application, a shopping application, an information application, and a social application.
[0044] In the embodiments of the present disclosure, the electronic device 100 can be used to provide a background service for the client installed in the terminal device 200. For example, the electronic device 100 can be a background server of a video recommendation platform. The electronic device 100 can be a server, a server cluster composed of multiple servers, or a cloud computing service center. In an example, a user who has a demand for watching a video can send a video acquisition request to the electronic device 100 through the client in the terminal device 200, the electronic device 100 can receive the video acquisition request from the client in the terminal device 200, and select a video from a video library according to the video acquisition request, and send the selected video to the client. In another example, the user can upload a video to the electronic device 100 through the client by using a terminal to shoot and import a photo album, the electronic device 100 can receive the video uploaded by the client in the terminal device 200, analyze and process the video, determine the type and definition of the video, and then store the video in a video database. The location of the video database is not limited in the embodiments of the present disclosure, and the video database can be located in the electronic device 100 providing a background service for the client, or the video database can be located in another electronic device that can be called by the electronic device 100.
[0045] The video recommendation method provided by the embodiments of the present disclosure will be described in detail below.
[0046] The video recommendation method provided by the embodiments of the present disclosure can be applied to Figure 1 The electronic device 100 is not limited in the present disclosure.
[0047] Figure 2 FIG. 1 is a flowchart of a video recommendation method according to an example embodiment.
[0048] As shown in FIG. 1, the video recommendation method can include S210-S240. Figure 2
[0049] S210, obtaining video data corresponding to a video obtaining request sent by a terminal device according to the received video obtaining request, the video data including a first video set watched by a first user corresponding to the terminal device.
[0050] Each video in the first video set corresponds to a video identifier.
[0051] S220, generating a first user key value of the first user according to a video identifier of a first target video in the first video set, the first target video being selected from the first video set based on a preset selection rule.
[0052] Since the first user key value is generated based on the video identifier of the video watched by the first user, the first user key value can be used to represent the interest preference of the first user.
[0053] The number of first user key values can be at least one.
[0054] S230, determining a target user set corresponding to the first user key value in a preset database, the preset database including a plurality of user key values and a user set corresponding to each user key value.
[0055] The interest preferences of the users in the same user set are similar.
[0056] For example, the first user is user A, and the first user key value corresponding to user A is key1. The electronic device can determine a target user set R corresponding to key1 in the preset database. All users in the target user set R correspond to key1, i.e., all users in the target user set R have watched the videos corresponding to the video identifiers constituting key1. Since the users in the target user set R and user A have watched the videos corresponding to the video identifiers constituting key1, it can be determined that the interest preferences of the users in the target user set R are similar to that of user A, and the videos watched by all users in the target user set R can be recommended to user A.
[0057] In some embodiments, the preset database can be a redis database, and the user set can include an identifier of a user, which can be used to represent the identity of the user, such as a user account, a user nickname, a user ID card number, an identifier of a terminal device corresponding to the user, and the like, which are not limited herein.
[0058] In S240, a second target video is recommended to the first user according to videos watched by all users in the target user set.
[0059] The second target video includes a video different from the video identifier of the video watched by the first user.
[0060] Referring to the above example, the electronic device can determine that the users in the target user set R have similar interest preferences to the user A, and can recommend videos watched by the users in the target user set R to the user A. For example, the target user set R includes users C and D. The user A has watched 10 videos with identifiers id1-id10, and the users C and D have watched 14 videos with identifiers id3-id16. Since the identifiers id3-id16 include the identifiers id3-id10 of the videos watched by the user A, the electronic device can recommend videos corresponding to the identifiers id1, id2, and id11-id16 to the user A.
[0061] The video recommendation method provided by the present disclosure can obtain video data corresponding to a video acquisition request sent by a terminal device according to the received video acquisition request, wherein the video data includes a first video set watched by a first user corresponding to the terminal device, and each video in the first video set corresponds to a video identifier; a first user key value of the first user is generated according to a video identifier of a first target video in the first video set, and the first target video is selected from the first video set based on a preset selection rule. Since the first user key value can be used to represent the interest preference of the first user, after determining a target user set corresponding to the first user key value in a preset database, a second target video can be recommended to the first user according to videos watched by all users in the target user set, wherein the second target video includes a video different from the video identifier of the video watched by the first user. Based on this, multiple users corresponding to the same user key value can be determined to have similar interest preferences, and therefore can recommend videos watched by the other party to each other for browsing, without calculating the similarity between the users, effectively reducing the data calculation complexity and the calculation cost, reducing the time delay, and improving the user experience. For example, the user A and the user B have the same user key value, and therefore the user A can be recommended videos watched by the user B and not watched by the user A, and similarly, the user B can be recommended videos watched by the user A and not watched by the user B, without calculating the similarity between the user A and the user B
[0062] The above S210 and S250 will be described in detail below with reference to specific embodiments.
[0063] Firstly, S210 involves obtaining video data corresponding to the video acquisition request according to the received video acquisition request sent by the terminal device, wherein the video data includes a first video set watched by a first user corresponding to the terminal device.
[0064] In some embodiments of the present disclosure, the client in the terminal device can be an application that provides a video playing service, that is, the client can provide a video playing service for the user. The client can display a user interface, and the terminal device triggers the terminal device (or the client in the terminal device) to send a video acquisition request to the electronic device by receiving an operation of the user on the user interface, wherein the video acquisition request is used to request to acquire a video to be displayed in the user interface of the client, i.e., a recommended video.
[0065] In some embodiments of the present disclosure, the user interface of the client can include some operation controls, such as buttons, sliders, icons, etc., for the user to operate.
[0066] In one example, the user interface of the client displays a video playing control, and an operation of the user on the video playing control can trigger the client to generate a video acquisition request, for example, a click input, a sliding input, a double-click input, a long-press input, etc. of the user on the video playing control, which is not specifically limited in the present disclosure.
[0067] In another example, when the user clicks an icon corresponding to the client to trigger the client to display the user interface, the client can generate a video acquisition request.
[0068] In yet another example, in addition to triggering the client to generate a video acquisition request through a touch operation, the user can also trigger the client to generate a video acquisition request through voice, gesture, etc. For example, the user can slide fingers upward or downward on a screen corresponding to the client during the process of watching a video, which can trigger the client to generate a video acquisition request.
[0069] It should be noted that the above are only several examples of triggering the client in the terminal device to send a video acquisition request, and the present disclosure does not limit the triggering method of the video acquisition request.
[0070] In one embodiment, in order to ensure that the first user key value can represent the current interest preference of the first user, the first video set can be a video set watched by the first user in a second preset time period.
[0071] The second preset time period can be set according to specific requirements, and for example, the second preset time period can be the last three weeks.
[0072] In some embodiments of the present disclosure, the video acquisition request can include a user identifier of the first user, and acquiring the video data corresponding to the video acquisition request can specifically include: acquiring videos watched by the first user, and user context information and user attribute information corresponding to the user identifier; and filtering the videos watched by the first user according to the user context information and the user attribute information to obtain a first video set.
[0073] The user context information and the user attribute information can reflect the change of the interest preference of the user to some extent.
[0074] The user context information can include time context and location context. For example, the seasonal effect in the time context can reflect the influence of time itself on the interest of the user. For example, the user is interested in eating ice cream in summer and watches many videos about ice cream, and is interested in eating hot pot in winter and watches many videos about ice cream.
[0075] The user attribute information can include the age, gender, income, location, behavior and the like of the user. For example, after the user moves from the south to the north, the things that the user is interested in will also change.
[0076] For example, in combination with the user context information, it is currently summer, and the electronic device filters out the videos related to winter from the video set watched by the first user. In combination with the user attribute information, the current age of the user is 28, and the electronic device filters out the videos watched by the first user 8 years ago from the video set watched by the first user.
[0077] In the embodiments of the present disclosure, when the video set watched by the user is acquired, the situation of the user is analyzed in combination with the user context information and the user attribute information, so that the video set that truly conforms to the current interest preference of the user can be obtained, and the video set acquired is prevented from being biased to the interest of the user, thereby improving the accuracy of the user interest preference represented by the first user key value and improving the effect of video recommendation.
[0078] In some embodiments of the present disclosure, the electronic device can acquire the user attribute information through a user profile server.
[0079] In relation to S220, a first user key value of the first user is generated according to the video identifier of a first target video in the first video set, and the first target video is selected from the first video set based on a preset selection rule.
[0080] Since the number of videos in the first video set can be large, the first user key value cannot be generated based on the video identifiers of all videos in the first video set.
[0081] In some embodiments of the present disclosure, the preset selection rule can comprise selecting the videos based on the first preset number, the second preset number and the first preset similarity threshold, in order to generate the user key value of the first user, Figure 3 FIG. 6 is a flowchart of another video recommendation method according to an exemplary embodiment.
[0082] As shown in FIG. 6, S220 can specifically comprise S310-S330. Figure 3
[0083] S310, selecting a first preset number of videos from the first video set to obtain a third video set corresponding to the first user.
[0084] The first preset similarity threshold can be used to represent the similarity of the videos of interest of two users, and the first preset number, the second preset number and the first preset similarity threshold can be set according to actual needs, which are not limited in the present application.
[0085] Exemplarily, the first preset similarity threshold can be 1 / 3, and the first preset number can be 10, so that the electronic device can randomly select 10 videos from the first video set to obtain the third video set.
[0086] S320, selecting a second preset number of first target videos from the third video set each time based on a target selection number.
[0087] The target selection number is determined based on the first preset number, the first preset similarity threshold and the second preset number.
[0088] Exemplarily, the first user is user A, the first preset number is 10, the second preset number is 2, and the target selection number is 4. The third video set id1-id10 of user A includes 10 videos, and the electronic device can randomly select 2 first target videos each time from the 10 videos, a total of 4 times.
[0089] S330, generating the first user key value of the first user based on the identification of the first target video selected each time.
[0090] Referring to the above example, the electronic device can select 2 first target videos each time from id1-id10, and can generate a first user key value based on the identification of the 2 first target videos selected each time. Therefore, 4 times of selection can obtain {id1, id3}, {id4, id3}, {id5, id6} and {id1, id9} a total of 4 first user key values, and the number of first user key values is equal to the target selection number.
[0091] In the embodiments of the present disclosure, the user may have watched a large number of videos in a period of time, and the cardinality of the videos in the first video set is large. Therefore, if the first user key value is generated based on the video identifiers of all the videos in the first video set, the first user key value contains a large number of video identifiers, and it is difficult to find the target user set corresponding to the first user key value in the preset database, that is, it is difficult to find other users who have watched all the videos watched by the first user. Therefore, by preliminarily selecting the first preset number of videos from the first video set, the number of videos in the third video set can be reduced. On this basis, by selecting the second preset number of first target videos from the third video set each time based on the target selection times, the number of first user key values and the number of video identifiers contained in the first user key values can be ensured, so as to avoid the problem that the first user key value contains a large number of video identifiers and the target user set corresponding to the first user key value cannot be determined, and the video recommendation for the first user cannot be performed, and the success rate of video recommendation is effectively improved.
[0092] In some embodiments of the present disclosure, the identifiers of the first target videos can be sorted in the order of the publishing time of the first target videos to generate the first user key value.
[0093] S230 is related to, determining the target user set corresponding to the first user key value in the preset database, the preset database comprising a plurality of user key values and a user set corresponding to each user key value.
[0094] In some embodiments of the present disclosure, in order to obtain the preset database, the preset selection rule can comprise selecting videos based on the first preset number, the second preset number and the first preset similarity threshold, Figure 4 is a flowchart of another video recommendation method according to an exemplary embodiment.
[0095] As shown in Figure 4 , the video recommendation method can comprise S410-S470, and it should be noted that S410 is before S230.
[0096] S410, obtaining a video set watched by each user in a plurality of users.
[0097] The plurality of users can be at least part of the users of a video recommendation platform.
[0098] S420, selecting a first preset number of videos from the video set watched by each user to obtain a second video set corresponding to each user.
[0099] S430, determining a target selection times based on the first preset number, the first preset similarity threshold and the second preset number.
[0100] In some embodiments of the present disclosure, the target selection times can be determined based on the sample video set, the first preset number, the first preset similarity threshold, the second preset number and the permutation and combination algorithm.
[0101] For example, the first preset number is 10, the second preset number is 2, and the first preset similarity threshold is 1 / 3. The sample video set can include set P1 and set Q1. After randomly selecting 10 videos from set P1 and set Q1 respectively, set P2 {id1, id2…id10} and set Q2 {id6, id7…id15} are obtained. The intersection video of set P2 and set Q2 is id6-id10, which is five videos. Therefore, the probability of randomly selecting two videos from P2 and Q2 respectively and obtaining the same result needs to be calculated.
[0102] Since there are C(10, 2) = 45 combinations of randomly selecting two videos from P2, there are C(10, 2) = 45 combinations of randomly selecting two videos from Q2, and only when two videos are selected from the five videos id6-id10 will the same result be obtained, C(5, 2) = 10. Therefore, the probability of randomly selecting two videos from P2 and Q2 respectively and obtaining the same result is (10*1 / 45)*(10*1 / 45) = 4 / 81. Since the first preset similarity threshold is 1 / 3, the calculation process of the target selection times n is: 4 / 81*n = 1 / 3, n is about 8 times.
[0103] It should be noted that the user can select the sample video set according to the actual demand, and set the first preset number, the first preset similarity threshold and the second preset number. Based on any one of the sample video set, the first preset number, the first preset similarity threshold and the second preset number, the target selection times obtained are different.
[0104] S440, based on the target selection times, selecting the second preset number of videos from each user's corresponding second video set each time.
[0105] For example, the plurality of users can include user B and user C, the first preset number can be 5, the second preset number can be 2, and the target selection times can be 3. The second video set corresponding to user B can be {id1, id2, id5, id8, id9}, and two videos are randomly selected from the five videos each time, and the selection is performed three times, which can obtain {id1, id2}, {id1, id9} and {id5, id8}. The second video set corresponding to user C can be {id1, id3, id5, id9, id10}, and two videos are randomly selected from the five videos each time, and the selection is performed three times, which can obtain {id1, id9}, {id3, id10} and {id5, id9}.
[0106] S450, generating at least one user key value corresponding to each user based on the video identifier of the second preset number of videos selected each time.
[0107] Referring to the above example, the user key value corresponding to user B can include {id1, id2}, {id1, id9}, {id5, id8}; the user key value corresponding to user C can include {id1, id9}, {id3, id10}, {id5, id9}.
[0108] S460, determining at least two users in the plurality of users corresponding to the same user key value.
[0109] Among the at least two users corresponding to the same user key value, the similarity is greater than the first preset similarity threshold, so the interest preference can be determined to be similar.
[0110] S470, storing the same user key value and the user set corresponding to the same user key value, obtaining a preset database, and the user set including user identifiers of the at least two users.
[0111] Continuing to refer to the above example, user B and user C both correspond to the same user key value {id1, id9}, so {id1, id9} can be stored, and the user set {B, C} corresponding to {id1, id9} can be stored.
[0112] In another example, if the user key value corresponding to user B can include {id1, id2}, {id1, id9}, {id5, id8}; the user key value corresponding to user C can include {id1, id9}, {id3, id10}, {id5, id9}; and the user key value corresponding to user D can include {id1, id2}, {id1, id9}, {id7, id8}, the electronic device can determine the same user key values {id1, id2} and {id1, id9}, store the user set {B, D} corresponding to {id1, id2}, and store the user set {B, C, D} corresponding to {id1, id9}.
[0113] In the embodiments of the present disclosure, the electronic device can obtain a video set watched by each user, and by initially selecting a first preset number of videos from the video set, a second video set with a relatively small number of videos can be obtained. Based on this, by again selecting a second preset number of videos from the second video set, a user key value representing the user's own interest preference can be generated. Since the user key value can represent the user's own interest preference, multiple users corresponding to the same user key value can infer that their interest preferences are similar. On this basis, the same user key value and the user set corresponding to the same user key value can be stored in the preset database, and when a video acquisition request of a first user is received, the user set corresponding to the first user key value in the preset database can be determined as a target user set. Since all users in the target user set have watched the video corresponding to the first user key value, it can be determined that the target user set has a high degree of repetition or similarity with the videos watched by the first user, and the interest preferences are similar. According to the videos watched by all users in the target user set, videos can be recommended to the first user, which can ensure that the recommended videos can meet the user's preferences and ensure the accuracy of the recommended videos. At the same time, there is no need to calculate the similarity between users based on the minimum hash algorithm, which significantly reduces the amount of calculation. Even in the case of active users and receiving a large number of user requests, videos can be recommended to each user in time, and the speed of video recommendation can be improved.
[0114] In one embodiment, the electronic device can write the same user key value and the user set corresponding to the same user key value in the preset database in the form of a key-value pair.
[0115] In one embodiment, since the videos watched and browsed by the user are constantly updated, the video set watched by each user and the user key value corresponding to each user are also constantly updated. In order to ensure that the user key value stored in the preset database can represent the current interest preference of the user, the preset database can store the same user key value generated within a preset period and the user set corresponding to the same user key value generated within the preset period.
[0116] In some embodiments of the present disclosure, the video acquisition request can include a user identifier of the first user, and the method can further include the following steps: when the preset database does not include the first user key value, storing the first user key value and the user identifier of the first user corresponding to the first user key value.
[0117] In one example, the first user is user A, the first user key value can include {id1, id3}, {id4, id3}, {id5, id6}, {id1, id9}, the preset database includes {id1, id9}, and does not include {id4, id3}, {id5, id6}, {id1, id3}. In the case that {id4, id3}-{A}, {id5, id6}-{A}, {id1, id3}-{A} can be stored in the preset database. In the embodiments of the present disclosure, in the case that the first user key value is not included in the preset database, it is indicated that the user who has watched the video corresponding to the first user key value is not stored in the preset database, and therefore the first user key value and the identifier of the first user can be stored in the preset database. When receiving a video recommendation request of another user, if the other user also corresponds to the first user key value, the video watched by the first user can be recommended to the other user, so that the storage amount of the user key value in the preset database can be increased, and the success rate of video recommendation can be improved.
[0118] Finally, S240 is related to recommending a second target video to the first user according to the videos watched by all users in the target user set.
[0119] In some embodiments of the present disclosure, in order to ensure the instantaneity of the video content, S240 can specifically include: recommending a second target video to the first user according to the videos watched by all users in the target user set within a second preset time period.
[0120] The third preset time period can be set according to specific requirements, and the third preset time period can be the same as or different from the second preset time period.
[0121] For example, the third preset time period can be the last three days, so that the videos watched by all users in the target user set within the last three days can be recommended to the first user, and the instantaneity of the video content can be ensured.
[0122] In some embodiments of the present disclosure, in the case that the first user key value is not included in the preset database, in order to recommend a video to the first user, the method can further include the following steps: when the first user key value is not included in the preset database, obtaining a fourth video set watched by the first user within a second preset time period and a fifth video set watched by a user in a plurality of users within the second preset time period; calculating the similarity of the fourth video set and the plurality of fifth video sets according to a minimum hash algorithm to obtain the similarity of the first user and the plurality of users; and recommending, to the first user, a video set watched by a third user, wherein the video set is different from the video identifier of the video watched by the first user, and the third user is a user in the plurality of users whose similarity with the first user is greater than a second preset similarity threshold.
[0123] The second preset time period and the second similarity threshold can be set according to specific requirements. The first preset similarity threshold can be the same as or different from the second preset similarity threshold.
[0124] In one embodiment, because the number of videos watched by platform users per minute is very large, the calculation process of calculating the similarity based on the minhash algorithm is relatively complex and the calculation amount is large, and therefore the second preset time period should not be set too long. The second preset time period can be less than the preset time threshold, for example, less than 24 hours.
[0125] In the embodiments of the present disclosure, in the case where the first user key value is not included in the preset database, it is indicated that the user who has watched the video corresponding to the first user key value is not stored in the preset database. At this time, the video set watched by the first user and the platform user in the short term can be obtained, and the similarity between the video sets is calculated by the minhash algorithm to obtain the similarity between the users. Based on this, the third user whose similarity with the first user is greater than the second preset similarity threshold can be obtained, and the video not watched by the first user among the videos watched by the third user is recommended to the first user, avoiding the occurrence of the case where the video cannot be recommended to the user based on the user key value, ensuring that the video can be recommended to the user based on the user similarity in the case where the video cannot be recommended to the user based on the user key value, improving the success rate and efficiency of recommending the video, and meeting the video recommendation demand of the user.
[0126] The process of calculating the similarity between users using the minhash algorithm will be described in detail below in combination with specific examples.
[0127] In one example, the video set S1 corresponding to the user C1 is {item1, item4}; the video set S2 corresponding to the user C2 is {item3}; the video set S3 corresponding to the user C3 is {imte2, item4, item5}; and the video set S4 corresponding to the user C4 is {imte1, item3, item4}. Therefore, the universal set U is {item1, item2, item3, item4, item5}.
[0128] Step 1: According to the above four video sets, a 0-1 matrix as shown in Table (1) is constructed. For any element in the universal set U, if the video set of the user has the element, 1 is recorded, and if the video set of the user does not have the element, 0 is recorded.
[0129] Element S1 S2 S3 S4 Item 1 1 0 0 1 Item 2 0 0 1 0 Item 3 0 1 0 1 Item 4 1 0 1 1 Item 5 0 0 1 0
[0130] Table (1)
[0131] Step 2, in order to get the minimum hash value of each set, first, the matrix is randomly shuffled, define a minimum hash function h0, used to simulate the random row shuffle of the matrix, the 0-1 matrix after shuffling is shown in table (2).
[0132]
[0133]
[0134] Table (2)
[0135] Step 3, according to the 0-1 matrix after shuffling, determine the minimum hash value of each video set.
[0136] Take S1 as an example, the first "1" after shuffling appears in Item3 row. It should be noted that, since the row number starts from "0" instead of "1", therefore, Item1 is the 0th row, Item2 is the 1st row, and Item3 is the 2nd row. Therefore, the minimum hash value of S1 h0(S1) = 2.
[0137] Similarly, h0(S2) = 4, h0(S3) = 0, h0(S4) = 2 are calculated.
[0138] Step 4, after the random row shuffling in step 2, the probability of the minimum hash value of two sets being equal is equal to the Jaccard similarity of the two sets. Therefore, after obtaining the above 0-1 matrix (feature matrix), the Jaccard similarity between sets can be calculated by the similarity between columns in the above feature matrix, but when a feature matrix is very large (assuming there are hundreds of millions of rows), it is very time-consuming to shuffle the rows. Therefore, in order to solve this problem, some random hash functions can be used to simulate the effect of row shuffling. For example, consider the above feature matrix, replace item1-5 with the corresponding row number, and add two hash functions h1 and h2. Wherein, h1(x) = (x+1)mod 5, h2(x) = (3*x+1)mod 5, x is the row number.
[0139] Using two hash functions h1 and h2 to process the 0-1 matrix shown in table (1), the feature matrix shown in table (3) is obtained.
[0140] Line number S1 S2 S3 S4 h1 h2 0 1 0 0 1 1 1 1 0 0 1 0 2 4 2 0 1 0 1 3 2 3 1 0 1 1 4 0 4 0 0 1 0 0 3
[0141] Table (3)
[0142] Take the 0th row as an example, x is 0, then h1(0) = (0+1)mod 5 = 1, h2(0) = (3*0+1)mod 5 = 1, similarly, the hash values h1 and h2 of other rows are calculated.
[0143] Step 5, the signature matrix is calculated next. At the beginning, all are initialized to Inf, and the signature matrix shown in Table (4) is obtained.
[0144]
[0145]
[0146] Table (4)
[0147] First, look at the 0th row in the characteristic matrix shown in Table (3): the values of S2 and S3 are 0, so no change is needed; the values of S1 and S4 are 1, so change is needed, hi(0) = 1, h2(0) = 1, 1 is smaller than Inf, so replace the values corresponding to S1 and S4 in the signature matrix, and the signature matrix shown in Table (5) is obtained.
[0148] S1 S2 S3 S4 h1 1 Inf Inf 1 h2 1 Inf Inf 1
[0149] Table (5)
[0150] Next, look at the 1st row in the characteristic matrix shown in Table (3): only the value of S3 is 1, hi(1) = 2, h2(1) = 4, so replace the column of S3, and the signature matrix shown in Table (6) is obtained.
[0151] S1 S2 S3 S4 h1 1 Inf 2 1 h2 1 Inf 4 1
[0152] Table (6)
[0153] Next, look at the 2nd row in the characteristic matrix shown in Table (3): the values of S2 and S4 are 1, hi(2) = 3, h2(2) = 2, both values in the column of S4 in the characteristic matrix are 1, which is smaller than 3 and 2, so only replace the column of S2, and the signature matrix shown in Table (7) is obtained.
[0154] S1 S2 S3 S4 h1 1 3 2 1 h2 1 2 4 1
[0155] Table (7)
[0156] Next, look at the 3rd row in the characteristic matrix shown in Table (3): the values of S1, S3 and S4 are all 1, hi(3) = 4, h2(3) = 0, no modification of the signature matrix is needed.
[0157] Next, look at the 4th row in the characteristic matrix shown in Table (3): the value of S3 is 1, hi(4) = 0, h2(4) = 3, modify the signature matrix shown in Table (7), and the final signature matrix shown in Table (8) is obtained.
[0158] S1 S2 S3 S4 h1 1 3 0 1 h2 0 2 0 0
[0159] Table (8)
[0160] Step 6, based on the final signature matrix shown in Table (8), the similarity between video sets can be calculated.
[0161] Taking S1 and S4 as an example, since the column vectors corresponding to S1 and S4 are exactly the same, both are 1 and 0, so SIM(S1, S4) = 1 can be calculated, that is, the similarity of S1 and S4 is 1; similarly, SIM(S1, S3) = 0.5 can be obtained, that is, the similarity of S1 and S3 is 0.5.
[0162] Therefore, according to the similarity of video set S1 and S4 is 1, the similarity of S1 and S3 is 0.5, it can be determined that the similarity of user C1 and user C4 is 1, and the similarity of user C1 and user C3 is 0.5.
[0163] In one example, if the second preset similarity threshold is 0.4, then user C3 and user C4 are both third users of user C1, so the videos that user C1 has not watched among the videos watched by user C3 and user C4 can be recommended to user C1.
[0164] Based on the above video recommendation method, the disclosure also provides a video recommendation device. Specifically, the video recommendation device is described in detail in combination with Figure 5 .
[0165] Figure 5 is a block diagram of a video recommendation device according to an exemplary embodiment. Referring to Figure 5 , the video recommendation device 500 can include an acquisition module 510, a determination module 520, a generation module 530, and a recommendation module 540.
[0166] The acquisition module 510 is configured to acquire video data corresponding to a video acquisition request sent by a terminal device according to the received video acquisition request, wherein the video data includes a first video set watched by a first user corresponding to the terminal device, and each video in the first video set corresponds to a video identifier; the generation module 520 is configured to generate a first user key value of the first user according to a video identifier of a first target video in the first video set, the first user key value is used to represent the interest preference of the first user, and the first target video is selected from the first video set based on a preset selection rule; the determination module 530 is configured to determine a target user set in a preset database corresponding to the first user key value, wherein the preset database includes a plurality of user key values and a user set corresponding to each user key value, and the interest preferences of users in the same user set are similar; and the recommendation module 540 is configured to recommend a second target video to the first user according to the videos watched by all users in the target user set, wherein the second target video includes videos different from the video identifiers of the videos watched by the first user.
[0167] In the embodiments of the present disclosure, according to the received video acquisition request sent by the terminal device, the video data corresponding to the video acquisition request is acquired, wherein the video data includes a first video set watched by a first user corresponding to the terminal device, and each video in the first video set corresponds to a video identifier; a first user key value of the first user is generated according to a video identifier of a first target video in the first video set, and the first target video is selected from the first video set based on a preset selection rule. Since the first user key value can be used to represent the interest preference of the first user, after determining a target user set corresponding to the first user key value in a preset database, a second target video can be recommended to the first user according to the videos watched by all users in the target user set, wherein the second target video includes videos different from the video identifiers of the videos watched by the first user. Based on this, multiple users corresponding to the same user key value can be determined to have similar interest preferences, and therefore they can recommend each other to browse the watched videos, without calculating the similarity between the users, effectively reducing the data calculation complexity and the calculation cost, reducing the time delay, and improving the user experience. For example, if the user key values of user A and user B are the same, the videos in a video set watched by user B and not watched by user A can be recommended to user A, and similarly, the videos in a video set watched by user A and not watched by user B can be recommended to user B, without calculating the similarity between user A and user B.
[0168] In some embodiments of the present disclosure, the preset selection rule includes selecting videos based on a first preset number, a second preset number and a first preset similarity threshold. The apparatus further includes an acquisition module 510, which is further configured to perform, before determining a target user set corresponding to the first user key value in a preset database, acquiring a video set watched by each user in a plurality of users; a selection module, which is configured to perform selecting a first preset number of videos from the video set watched by each user to obtain a second video set corresponding to each user; a determination module 530, which is further configured to perform determining a target selection number based on the first preset number, the first preset similarity threshold and the second preset number; the selection module, which is further configured to perform selecting a second preset number of videos from the second video set corresponding to each user each time based on the target selection number; a generation module 520, which is further configured to perform generating at least one user key value corresponding to each user based on the video identifiers of the second preset number of videos selected each time; the determination module 530, which is further configured to perform determining at least two users in the plurality of users corresponding to the same user key value; and a storage module, which is configured to perform storing the same user key value and a user set corresponding to the same user key value, the user set including user identifiers of the at least two users, to obtain the preset database.
[0169] In some embodiments of the present disclosure, the generating module 520 comprises: a selecting unit configured to perform selecting a first preset number of videos from the first video set to obtain a third video set corresponding to the first user; the selecting unit is further configured to perform selecting a second preset number of first target videos from the third video set each time based on a target selection number; and a generating unit configured to perform generating the user key value of the first user based on the identification of the first target video selected each time.
[0170] In some embodiments of the present disclosure, the video acquisition request comprises the user identification of the first user, the acquiring module 510 comprises: an acquiring unit configured to perform acquiring the videos watched by the first user and the user context information and the user attribute information corresponding to the user identification; and a screening unit configured to perform screening the videos watched by the first user according to the user context information and the user attribute information to obtain the first video set.
[0171] In some embodiments of the present disclosure, the apparatus further comprises: the acquiring module 510 is further configured to perform, when the first user key value is not included in the preset database, acquiring a fourth video set watched by the first user within a first preset time period and a fifth video set watched by a user in the plurality of users within the first preset time period; and a calculating module configured to perform calculating the similarity of the fourth video set and the plurality of fifth video sets according to a minimum hash algorithm to obtain the similarity of the first user and the plurality of users; and the recommending module 540 is further configured to perform recommending, to the first user, a video set watched by a third user, wherein the video in the video set is different from the video identification of the video watched by the first user, and the third user is a user in the plurality of users whose similarity with the first user is greater than a second preset similarity threshold.
[0172] In some embodiments of the present disclosure, the video acquisition request comprises the user identification of the first user, and the apparatus further comprises: a storage module configured to perform, when the first user key value is not included in the preset database, storing the first user key value and the user identification of the first user corresponding to the first user key value.
[0173] As to the apparatus in the above-mentioned embodiments, the specific manners in which various modules perform operations have been described in details in the embodiments of the method, and thus will not be described in details here.
[0174] Figure 6 is a block diagram of an electronic device according to an exemplary embodiment. Referring to Figure 6 The present disclosure further provides an electronic device, which comprises a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 complete communication with each other through the communication bus 640.
[0175] The memory 630 is configured to store instructions executable by the processor 610.
[0176] The processor 610 is configured to execute the instructions stored in the memory 630, and implement the following steps:
[0177] According to the received video acquisition request sent by the terminal device, video data corresponding to the video acquisition request is acquired, wherein the video data includes a first video set watched by a first user corresponding to the terminal device, and each video in the first video set corresponds to a video identifier; a first user key value of the first user is generated according to a video identifier of a first target video in the first video set, the first user key value is used to represent an interest preference of the first user, and the first target video is selected from the first video set based on a preset selection rule; a target user set corresponding to the first user key value in a preset database is determined, wherein the preset database includes a plurality of user key values and a user set corresponding to each user key value, and users in a same user set have similar interest preferences; a second target video is recommended to the first user according to videos watched by all users in the target user set, wherein the second target video includes videos different from video identifiers of videos watched by the first user.
[0178] Figure 7 is a block diagram of an apparatus for a video recommendation method according to an example embodiment. For example, the apparatus 700 can be provided as an electronic device. Referring to Figure 7 , the electronic device 700 includes a processing component 722, which further includes one or more processors, and memory resources represented by a memory 732, for storing instructions executable by the processing component 722, such as application programs. The application programs stored in the memory 732 can include one or more than one module each corresponding to a set of instructions. In addition, the processing component 722 is configured to execute the instructions to perform the video recommendation method described in any of the above embodiments.
[0179] The apparatus 700 can also include a power supply component 726 configured to perform power management of the apparatus 700, a wired or wireless network interface 770 configured to perform connection of the apparatus 700 to a network, and an input / output (I / O) interface 778. The apparatus 700 can operate based on an operating system stored in the memory 732, such as Windows ServerTM, Mac OSXTM, Unix TM, Linux TM, FreeBSD TM or the like.
[0180] In some embodiments of the present disclosure, a storage medium is also provided, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device can perform the video recommendation method described in any of the above embodiments.
[0181] Optionally, the storage medium can be a non-transitory computer-readable storage medium. Exemplarily, the non-transitory computer-readable storage medium can be a computer readable only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, and an optical data storage device, etc.
[0182] In some embodiments of the present disclosure, a computer program product is also provided, when instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to perform the video recommendation method according to any one of the above-mentioned embodiments.
[0183] Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the present disclosure cover any and all variations of the present disclosure that come within the scope of the following claims and their equivalents. It is intended that the specification and examples be considered exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.
[0184] It should be understood that the present disclosure is not limited to the precise construction that has been described and illustrated herein and that various modifications and changes can be made therein without departing from the scope thereof. The scope of the present disclosure is indicated by the appended claims rather than by the description and examples.
Claims
1. A video recommendation method, characterized by, The method comprises: According to the received terminal device sends the video acquisition request, the video data corresponding to the video acquisition request is obtained, wherein the video data includes the first video set watched by the first user corresponding to the terminal device, and each video in the first video set corresponds to a video identifier; According to the video identifier of the first target video in the first video set, the first user key value of the first user is generated, the first user key value is used to represent the interest preference of the first user, and the first target video is selected from the first video set based on a preset selection rule; Determine the target user set corresponding to the first user key value in the preset database, wherein the preset database comprises a plurality of user key values, and a user set corresponding to each user key value, and the interest preferences of the users in the same user set are similar; According to the video watched by all users in the target user set, the second target video is recommended to the first user, wherein the second target video includes a video different from the video identifier of the video watched by the first user; The preset selection rule includes selecting a video based on a first preset number, a second preset number and a first preset similarity threshold, and the first user key value of the first user is generated according to the video identifier of the first target video in the first video set, which comprises: selecting the first preset number of videos from the first video set to obtain the third video set corresponding to the first user; Based on the target selection times, the second preset number of first target videos are selected from the third video set each time; Based on the identifier of each selected first target video, the user key value of the first user is generated, and the target selection times are determined by the first preset number, the first preset similarity threshold and the second preset number.
2. The method of claim 1, wherein, Before determining the target user set corresponding to the first user key value in the preset database, the method further comprises: Obtain the video set watched by each user in the plurality of users; Select the first preset number of videos from the video set watched by each user to obtain the second video set corresponding to each user; Determine the target selection times based on the first preset number, the first preset similarity threshold and the second preset number; Based on the target selection times, the second preset number of videos are selected from the second video set corresponding to each user each time; Based on the video identifier of the second preset number of videos selected each time, at least one user key value corresponding to each user is generated; Determine at least two users in the plurality of users corresponding to the same user key value; Store the same user key value and the user set corresponding to the same user key value, the user set includes the user identifier of the at least two users, and obtain the preset database.
3. The method according to claim 1 or 2, characterized in that, The video acquisition request includes the user identifier of the first user, and the video data corresponding to the video acquisition request is obtained, comprising: Obtain the video watched by the first user, and the user context information and user attribute information corresponding to the user identifier; Filter the videos watched by the first user according to the user context information and the user attribute information to obtain the first video set.
4. The method of claim 1, wherein, The method further comprises: When the first user key value is not included in the preset database, a fourth video set watched by the first user in a first preset time period and a fifth video set watched by a user in the plurality of users in the first preset time period are obtained; Similarities between the fourth video set and the plurality of fifth video sets are calculated according to a minimum hash algorithm to obtain similarities between the first user and the plurality of users; A video set watched by a third user is recommended to the first user, wherein the video in the video set is different from the video identifier of the video watched by the first user, and the third user is a user in the plurality of users whose similarity with the first user is greater than a second preset similarity threshold.
5. The method according to claim 1 or 4, characterized in that, The video acquisition request includes a user identifier of the first user, and the method further comprises: When the first user key value is not included in the preset database, the first user key value and the user identifier of the first user corresponding to the first user key value are stored.
6. A video recommendation apparatus, comprising: Comprise: An acquisition module configured to execute the video data corresponding to the video acquisition request according to the received video acquisition request sent by the terminal device, wherein the video data includes a first video set watched by a first user corresponding to the terminal device, and each video in the first video set corresponds to a video identifier; A generation module configured to execute the first user key value of the first user according to the video identifier of a first target video in the first video set, wherein the first user key value is used to represent the interest preference of the first user, and the first target video is selected from the first video set based on a preset selection rule; A determination module configured to execute the target user set corresponding to the first user key value in a preset database, wherein the preset database includes a plurality of user key values and a user set corresponding to each user key value, and the interest preferences of the users in the same user set are similar; A recommendation module configured to execute the second target video according to the videos watched by all users in the target user set and recommend the second target video to the first user, wherein the second target video includes a video different from the video identifier of the video watched by the first user; The preset selection rule includes selecting a video based on a first preset number, a second preset number and a first preset similarity threshold, and the generation module includes: a selection unit configured to execute the first preset number of videos from the first video set to obtain a third video set corresponding to the first user; the selection unit is configured to execute the second preset number of first target videos from the third video set each time based on a target selection number; and a generation unit configured to execute the user key value of the first user based on the identifier of each selected first target video, wherein the target selection number is determined by the first preset number, the first preset similarity threshold and the second preset number.
7. The apparatus of claim 6, wherein, The preset selection rule includes selecting a video based on a first preset number, a second preset number, and a first preset similarity threshold. The device further includes: The acquisition module is further configured to acquire a set of videos watched by each user in the plurality of users before determining a target user set corresponding to the first user key in the preset database; The selection module is configured to select a first preset number of videos from the set of videos watched by each user to obtain a second video set corresponding to each user; The determination module is further configured to determine a target selection number based on the first preset number, the first preset similarity threshold, and the second preset number; The selection module is further configured to select a second preset number of videos from the second video set corresponding to each user each time based on the target selection number; The generation module is further configured to generate at least one user key corresponding to each user based on the video identifier of the second preset number of videos selected each time; The determination module is further configured to determine at least two users corresponding to the same user key in the plurality of users; The storage module is configured to store the same user key and a user set corresponding to the same user key, the user set including user identifiers of the at least two users, to obtain the preset database.
8. The apparatus of claim 7, wherein, The acquisition module includes: The acquisition unit is configured to acquire videos watched by the first user, as well as user context information and user attribute information corresponding to the user identifier; The screening unit is configured to screen the videos watched by the first user according to the user context information and the user attribute information to obtain the first video set.
9. The apparatus of claim 6, wherein, The device further includes: The acquisition module is further configured to acquire a fourth video set watched by the first user within a first preset time period and a fifth video set watched by a user in the plurality of users within the first preset time period when the first user key is not included in the preset database; The calculation module is configured to calculate the similarity between the fourth video set and the plurality of fifth video sets according to a minimum hash algorithm to obtain the similarity between the first user and the plurality of users; The recommendation module is further configured to recommend to the first user a video set watched by a third user, wherein the video in the video set is different from the video identifier of the video watched by the first user, and the third user is a user in the plurality of users whose similarity with the first user is greater than a second preset similarity threshold.
10. The apparatus of claim 6 or 9, wherein, The video acquisition request includes a user identifier of the first user, and the device further includes: The storage module is configured to store the first user key and the user identifier of the first user corresponding to the first user key when the first user key is not included in the preset database.
11. An electronic device, comprising: includes: a processor; a memory configured to store the processor-executable instructions; wherein the processor is configured to execute the instructions to implement the video recommendation method of any one of claims 1-5.
12. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the video recommendation method of any one of claims 1-5.
13. A computer program product comprising computer instructions, characterized in that, The computer instructions, when executed by the processor, implement the video recommendation method of any one of claims 1-5.
Citation Information
Patent Citations
Video recommendation method and device, storage medium and electronic equipment
CN111538860A