Content recommendation method, device and equipment

文档序号:1889411 发布日期:2021-11-26 浏览:4次 中文

阅读说明:本技术 内容推荐方法、装置和设备 (Content recommendation method, device and equipment ) 是由 缪石乾 于 2020-05-21 设计创作,主要内容包括:本申请公开了内容推荐方法、装置和设备,涉及大数据领域。具体实现方案为:获取多个初始样本,并对多个初始样本进行层区间划分,获得至少一个层;每层包括多个区间样本,至少一个层中的最后一层中的多个区间样本的区间样本数量小于预设阈值;每个初始样本为一个内容;对于每层,根据层对应的随机数和权重值区间,或者层的上一层的目标区间样本以及层的随机数和权重值区间,确定层的目标区间样本;根据第一层中确定的目标区间样本中的多个初始样本,确定待推荐内容;将待推荐内容发送给终端设备,减少了内容抽样时的计算量,提高了服务器进行内容推荐的处理效率。(The application discloses a content recommendation method, a content recommendation device and content recommendation equipment, and relates to the field of big data. The specific implementation scheme is as follows: obtaining a plurality of initial samples, and carrying out interlayer division on the plurality of initial samples to obtain at least one layer; each layer comprises a plurality of interval samples, and the number of the interval samples in the last layer of at least one layer is less than a preset threshold value; each initial sample is a piece of content; for each layer, determining a target interval sample of the layer according to the random number and the weight value interval corresponding to the layer, or a target interval sample of the layer above the layer and the random number and the weight value interval of the layer; determining content to be recommended according to a plurality of initial samples in the target interval samples determined in the first layer; and the content to be recommended is sent to the terminal equipment, so that the calculation amount during content sampling is reduced, and the processing efficiency of content recommendation by the server is improved.)

1. A content recommendation method, comprising:

obtaining a plurality of initial samples, and carrying out interlayer division on the plurality of initial samples to obtain at least one layer; each layer comprises a plurality of interval samples, and the number of the interval samples in the last layer of the at least one layer is less than a preset threshold value; each of the initial samples is a content;

for each layer, determining a target interval sample of the layer according to the random number and the weight value interval corresponding to the layer, or a target interval sample of a layer above the layer and the random number and the weight value interval of the layer;

determining content to be recommended according to a plurality of initial samples in the target interval samples determined in the first layer;

and sending the content to be recommended to the terminal equipment.

2. The method of claim 1, wherein said inter-layer partitioning of the plurality of initial samples into at least one layer comprises:

performing layer 1 division on the plurality of initial samples, and acquiring a plurality of interval samples included in the layer 1;

if the number of interval samples of a plurality of interval samples included in the ith layer is larger than a preset threshold value, performing (i + 1) th layer division on the plurality of interval samples included in the ith layer to obtain a plurality of interval samples included in the (i + 1) th layer, and repeatedly executing the step by taking i +1 as a new i until the number of interval samples of the plurality of interval samples included in the ith layer is not larger than the preset threshold value, wherein i is larger than or equal to 1.

3. The method according to claim 1 or 2, wherein if the layer is the last layer, determining the target interval sample of the layer according to the random number and the weight value interval corresponding to the layer comprises:

determining a weight value interval corresponding to each interval sample in a plurality of interval samples included in the last layer;

generating a first random number;

searching a first target weight value interval in which the first random number is located in a plurality of weight value intervals;

and determining a first target interval sample of the last layer according to the first target weight value interval.

4. The method according to claim 1 or 2, wherein if the layer is a layer other than the last layer, determining the target interval sample of the layer according to the target interval sample of the layer above the layer and the random number and weight value intervals of the layer comprises:

determining at least two to-be-processed interval samples corresponding to the target interval sample of the (i + 1) th layer in the ith layer according to the target interval sample of the (i + 1) th layer;

respectively determining weight value intervals corresponding to at least two to-be-processed interval samples;

generating a second random number;

searching a second target weight value interval where the second random number is located in the weight value intervals corresponding to the at least two samples of the interval to be processed;

and determining a second target interval sample of the ith layer according to the second target weight value interval.

5. The method according to claim 1 or 2, wherein the determining the content to be recommended according to a plurality of initial samples in the target interval samples determined in the first layer comprises:

determining a weight value interval of each initial sample in a plurality of initial samples in a target interval sample of a first layer;

generating a third random number;

searching a third target weight value interval in which the third random number is located in the weight value intervals of the plurality of initial samples;

and determining the content to be recommended according to the third target weight value interval.

6. The method of claim 2, wherein the i +1 th layer division of the plurality of interval samples included in the i-th layer comprises:

grouping a plurality of interval samples included by the ith layer to obtain an (i + 1) th layer, wherein each group of the (i + 1) th layer includes at least two interval samples of the ith layer.

7. The method of claim 1 or 2, wherein each layer comprises a plurality of weight value intervals, each weight value interval corresponding to one interval sample.

8. The method according to claim 7, wherein a start value of a first weight value interval is 0, an end value is a weight value of a section sample corresponding to the first weight value interval minus one, for the other weight value intervals except the first weight value interval, a start value of each weight value interval is a start value of a last adjacent weight value interval plus one, and an end value is a start value of the weight value interval plus a weight value of a section sample corresponding to the weight value interval minus one.

9. The method according to claim 8, wherein the weight value of each bin sample included in an i +1 th layer is a sum of weight values of at least two to-be-processed bin samples corresponding to the bin samples of the i +1 th layer in the i-th layer, i being equal to or greater than 1.

10. A content recommendation apparatus characterized by comprising:

the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a plurality of initial samples and carrying out interlayer division on the plurality of initial samples to obtain at least one layer; each layer comprises a plurality of interval samples, and the number of the interval samples in the last layer of the at least one layer is less than a preset threshold value; each of the initial samples is a content;

a first determining module, configured to determine, for each layer, a target interval sample of the layer according to a random number and a weight value interval corresponding to the layer, or a target interval sample of a layer above the layer and the random number and the weight value interval of the layer;

the second determining module is used for determining the content to be recommended according to a plurality of initial samples in the target interval samples determined in the first layer;

and the sending module is used for sending the content to be recommended to the terminal equipment.

11. The apparatus of claim 10, wherein the obtaining module is configured to:

performing layer 1 division on the plurality of initial samples, and acquiring a plurality of first interval samples included in the layer 1;

if the number of interval samples of the first interval samples included in the ith layer is larger than a preset threshold value, performing i +1 th layer division on the first interval samples included in the ith layer to obtain a plurality of interval samples included in the i +1 th layer, and repeatedly executing the step by taking i +1 as a new i until the number of interval samples of the first interval samples included in the ith layer is not larger than the preset threshold value, wherein i is larger than or equal to 1.

12. The apparatus of claim 10 or 11, wherein if the layer is a last layer, the first determining module is configured to:

determining a weight value interval corresponding to each interval sample in a plurality of interval samples included in the last layer;

generating a first random number;

searching a first target weight value interval in which the first random number is located in a plurality of weight value intervals;

and determining a first target interval sample of the last layer according to the first target weight value interval.

13. The apparatus of claim 10 or 11, wherein if the layer is a layer other than the last layer, the first determining module is configured to:

determining at least two to-be-processed interval samples corresponding to the target interval sample of the (i + 1) th layer in the ith layer according to the target interval sample of the (i + 1) th layer;

respectively determining weight value intervals corresponding to at least two to-be-processed interval samples;

generating a second random number;

searching a second target weight value interval where the second random number is located in the weight value intervals corresponding to the at least two samples of the interval to be processed;

and determining a second target interval sample of the ith layer according to the second target weight value interval.

14. The apparatus of claim 10 or 11, wherein the second determining module is configured to:

determining a weight value interval of each initial sample in a plurality of initial samples in a target interval sample of a first layer;

generating a third random number;

searching a third target weight value interval in which the third random number is located in the weight value intervals of the plurality of initial samples;

and determining the content to be recommended according to the third target weight value interval.

15. The apparatus of claim 11, wherein the obtaining module is configured to:

grouping a plurality of first interval samples included in the ith layer to obtain an (i + 1) th layer, wherein each group of the (i + 1) th layer includes at least two first interval samples of the ith layer.

16. The apparatus of claim 10 or 11, wherein each layer comprises a plurality of weight value intervals, each weight value interval corresponding to one interval sample.

17. The apparatus of claim 16, wherein a start value of a first weight value interval is 0, an end value is a weight value of a section sample corresponding to the first weight value interval minus one, and for other weight value intervals except the first weight value interval, a start value of each weight value interval is a start value of a last adjacent weight value interval plus one, and an end value is a start value of the weight value interval plus a weight value of a section sample corresponding to the weight value interval minus one.

18. The apparatus according to claim 17, wherein the weight value of each bin sample included in an i +1 th layer is a sum of weight values of at least two to-be-processed bin samples corresponding to the bin samples of the i +1 th layer in the i-th layer, i being equal to or greater than 1.

19. An electronic device, comprising:

at least one processor; and

a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,

the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.

20. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-9.

Technical Field

The application relates to the technical field of data processing, in particular to a big data technology.

Background

With the rapid development of networks, people's daily life is more and more unable to leave the networks, and people's daily life habits have become through network listening to songs, watching videos, browsing information contents and the like.

With the explosive growth of various contents on networks, it is increasingly difficult for users to quickly select desired contents from a large number of contents, and thus, actively recommending contents to users becomes an option of content providers. When recommending content to a user, because the content pool usually has massive content, the server often takes a long time to extract a plurality of contents to be recommended to the user from the massive content, and the efficiency is low.

Disclosure of Invention

The application provides a content recommendation method, device and equipment.

In a first aspect, an embodiment of the present application provides a method for content recommendation, including:

obtaining a plurality of initial samples, and carrying out interlayer division on the plurality of initial samples to obtain at least one layer; each layer comprises a plurality of interval samples, and the number of the interval samples in the last layer of the at least one layer is less than a preset threshold value; each of the initial samples is a content;

for each layer, determining a target interval sample of the layer according to the random number and the weight value interval corresponding to the layer, or a target interval sample of a layer above the layer and the random number and the weight value interval of the layer;

determining content to be recommended according to a plurality of initial samples in the target interval samples determined in the first layer;

and sending the content to be recommended to the terminal equipment.

When content recommendation is performed, each content in the content pool is used as an initial sample, the initial samples are grouped to obtain at least one layer of interval sample, and random sampling is performed on the obtained at least one layer of interval sample from the last layer by layer, so that the calculated amount during content sampling is greatly reduced, and the processing efficiency of content recommendation performed by the server is improved.

In a second aspect, an embodiment of the present application provides a content recommendation apparatus, including:

the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a plurality of initial samples and carrying out interlayer division on the plurality of initial samples to obtain at least one layer; each layer comprises a plurality of interval samples, and the number of the interval samples in the last layer of the at least one layer is less than a preset threshold value; each of the initial samples is a content;

a first determining module, configured to determine, for each layer, a target interval sample of the layer according to a random number and a weight value interval corresponding to the layer, or a target interval sample of a layer above the layer and the random number and the weight value interval of the layer;

the second determining module is used for determining the content to be recommended according to a plurality of initial samples in the target interval samples determined in the first layer;

and the sending module is used for sending the content to be recommended to the terminal equipment.

According to a third aspect, there is provided an electronic device comprising:

at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of the first aspects.

According to a fourth aspect, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any of the above first aspects.

It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.

Drawings

The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:

fig. 1 is a flowchart illustrating a content recommendation method according to a first embodiment of the present application;

fig. 2 is a schematic diagram of a terminal device displaying content to be recommended according to a first embodiment of the present application;

FIG. 3 is a schematic flow chart of a method for zonal compartmentalization of an initial sample according to a second embodiment of the present application;

fig. 4 is a schematic diagram of the results of inter-layer division provided according to a second embodiment of the present application;

fig. 5 is a schematic structural diagram of a content recommendation device according to a fifth embodiment of the present application;

fig. 6 is a block diagram of an electronic device for implementing a content recommendation method according to an embodiment of the present application.

Detailed Description

The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.

The method provided by the embodiment of the application can be applied to a scene of content recommendation, and the specific type of the content is not limited in the embodiment of the application, for example, the content may be a song, a movie, news, an article, and the like. Illustratively, a user browses news through a news client in a mobile phone, and after determining news to be recommended to the user in a content pool, a server sends the news to a mobile phone terminal of the user, so that the user can select to browse the news. Or after the user opens the vehicle-mounted equipment in the vehicle, the server of the vehicle-mounted equipment determines the contents to be recommended to the user in the content pool and then sends the contents to the vehicle-mounted equipment, so that the user can select the contents from the contents to listen or browse and the like.

When determining the content to be recommended to the user, the server may randomly sample in the content pool based on the weight value of each content, and determine the extracted content as the content to be recommended.

Therefore, the content in the content pool is divided into one or more layers, and the content in the content pool is divided into one layer of intervals, namely, the content in the content pool is divided into groups; and the multi-layer interval division is to continuously group the groups obtained after the first grouping until a preset stop condition is met, then to randomly sample the groups of one or more layers of the groups layer by layer until one group in the first layer of the groups is extracted, and to-be-recommended content is extracted from the group and sent to the terminal equipment, so that the calculation amount during content extraction is greatly reduced, and the processing efficiency of the server is improved.

Hereinafter, the method for acquiring sample data provided in the present application will be described in detail by specific examples. It is to be understood that the following detailed description may be combined with other embodiments, and that the same or similar concepts or processes may not be repeated in some embodiments.

Example one

Fig. 1 is a flowchart illustrating a content recommendation method according to a first embodiment of the present application. The method may be performed by a software and/or hardware device, which may be, for example, a server for providing content. As shown in fig. 1, the content recommendation method includes:

s101, obtaining a plurality of initial samples, and carrying out interlayer division on the plurality of initial samples to obtain at least one layer.

Each layer comprises a plurality of interval samples, and the number of the interval samples in the last layer of at least one layer is less than a preset threshold value; each initial sample is a piece of content.

In this embodiment, each content in the content pool is an initial sample, and because the number of the initial samples is large, layer division needs to be performed on the initial samples, that is, the initial samples are grouped by layers, where the layers may be one or more layers.

Taking one layer as an example, grouping the initial samples into a group of at least two, where each of the obtained groups is an interval sample of the first layer, and each interval sample of the first layer includes at least two initial samples.

Taking a plurality of layers as an example, after the initial samples are grouped once according to the foregoing method, the obtained groups may be further grouped to obtain second-layer interval samples, where each of the second-layer interval samples includes at least two interval samples of the first layer. And repeating the steps until the number of the interval samples of the last layer is less than the preset threshold value, and not grouping.

And S102, for each layer, determining a target interval sample of the layer according to the random number and the weight value interval corresponding to the layer, or the target interval sample of the layer above the layer and the random number and the weight value interval of the layer.

And sampling the interval samples of each layer by adopting a random sampling method based on the weight value. Each bin sample in each layer has a corresponding weight value bin obtained from the weight values of the initial samples included in each bin sample.

The method comprises the steps of firstly sampling the last layer, generating a random number corresponding to the last layer, and determining a target sample interval of the last layer according to a weight value interval of the random number. And the target sample interval of the last layer comprises at least two interval samples of the next layer of the last layer, and the at least two interval samples of the next layer of the last layer are randomly sampled according to the same method to obtain the target sample interval of the next layer of the last layer. And the like until the target sample interval of the first layer is determined.

S103, determining the content to be recommended according to a plurality of initial samples in the target interval samples determined in the first layer.

And S104, sending the content to be recommended to the terminal equipment.

For the target sample interval of the first layer determined in S102, which includes a plurality of initial samples, the content to be recommended may be obtained by sampling the plurality of initial samples by the above random sampling method based on the weight value. It can be understood that the number of the content to be recommended may be one or more, when the number of the content to be recommended is multiple, after one content to be recommended is determined from multiple initial samples in the target sample interval of the first layer by random sampling, the content to be recommended is removed from the multiple initial samples in the target sample interval of the first layer, and from the remaining initial samples, the content to be recommended is continuously extracted by a random sampling method based on a weight value until the required number of the content to be recommended is obtained, and the content to be recommended is sent to the terminal device so as to be convenient for the user to view. As shown in fig. 2, 6 contents to be recommended sent by the server are displayed on a display screen of the terminal device, and the contents to be recommended are illustrated as songs and news videos in fig. 2.

According to the content recommendation method provided by the embodiment of the application, each content in the content pool is used as an initial sample, the initial samples are grouped to obtain at least one layer of interval sample, and random sampling is performed on the obtained at least one layer of interval sample from the last layer by layer, so that the calculated amount during content sampling is greatly reduced, and the processing efficiency of a server is improved.

In S101 of the first embodiment, the interlayer division of the layer on the initial sample is described, and the detailed description of the interlayer division is provided below with reference to the specific embodiment.

Example two

Fig. 3 is a schematic flow chart of a method for inter-layer division of an initial sample according to a second embodiment of the present application. As shown in fig. 3, the method includes:

s301, carrying out layer 1 division on the multiple initial samples, and obtaining multiple interval samples included in the layer 1.

Assuming that the number of initial samples is 64000000, the 64000000 initial samples are subjected to layer 1 division, that is, 64000000 initial samples are grouped by each group including the number G of initial samples, and assuming that G is 100, 640000 interval samples of the layer 1 can be obtained, each interval sample includes 100 initial samples, and the interval sample of the layer 1 is referred to as a first interval sample. It should be noted that, in practical applications, the value of G may be dynamically set, the size of G may be related to the number T of the content to be recommended to the user, which needs to be acquired, and G is greater than or equal to T. It should be noted that, when the initial samples are divided into G samples in each group, if a remainder exists after the initial sample number is divided by G, the remaining remainder initial samples are divided into the last group.

S302, determining whether the number of interval samples of a plurality of interval samples included in the ith layer is greater than a preset threshold, and if so, executing S203; if not, ending. Wherein i is greater than or equal to 1.

The first number of section samples included in the layer 1 is 640000, and assuming that the preset threshold is 200, the number of section samples of the plurality of section samples included in the layer 1 is greater than the preset threshold, and S303 may be continuously performed.

It should be noted that, in practical applications, the magnitude of the preset threshold may also be dynamically set, for example, the preset threshold may be set to 2G. If the number of interval samples of the multiple interval samples included in the ith layer is greater than 2G, it indicates that the multiple interval samples included in the ith layer can be subdivided into at least two groups according to each group of G interval samples.

S303, performing i +1 th layer division on the multiple section samples included in the i-th layer to obtain multiple section samples included in the i + 1-th layer, and repeatedly executing S202 with i +1 as a new i.

Grouping a plurality of interval samples included by the ith layer to obtain an (i + 1) th layer, wherein each group of the (i + 1) th layer includes at least two interval samples of the ith layer.

The method includes the steps of performing layer 2 division on 640000 first interval samples included in a layer 1, namely grouping 640000 first interval samples of the layer 1 according to 100 group pairs to obtain 6400 interval samples of the layer 2, wherein the interval samples of the layer 2 are called second interval samples, and each second interval sample includes 100 first interval samples.

For 6400 second interval samples of the layer 2, continuously determining whether the number of interval samples of the 6400 second interval samples of the layer 2 is greater than a preset threshold according to S202, obviously, 6400 is greater than 200, then executing S203 again, and continuously performing layer 3 division on the 6400 second interval samples included in the layer 2, that is, grouping the 6400 second interval samples of the layer 2 according to 100 groups to obtain 64 interval samples of the layer 3, where the interval samples of the layer 3 are referred to as third interval samples, and each third interval sample includes 100 second interval samples.

For the 64 third section samples of the layer 3, again according to S202, it is determined whether the number of section samples of the 64 section samples of the layer 3 is greater than the preset threshold, and obviously, 64 is not greater than 200, and the grouping is ended. The result of the layer interval division on the 64000000 initial samples can be seen in fig. 4.

In the method for dividing the layer interval of the initial samples provided in this embodiment, the number of samples included in each group in each layer and the condition for stopping grouping may be set according to actual needs, so that the number of layers to be finally divided is controllable, and dynamic grouping is performed in actual application to meet content sampling requirements under different conditions.

In the above embodiment, in S102, a method of determining, for each layer, a target interval sample of the layer according to the random number and the weight value interval is described. This will be described in detail with reference to the following specific examples.

EXAMPLE III

Since the stratification of the initial sample may be one or more layers, the target interval sample of each of the one or more layers also needs to be determined layer by layer when determining the target interval sample. In this embodiment, a method of determining a target interval sample of a layer when the layer is the last layer and the layer is a layer other than the last layer will be described. It is understood that when there is only one layer for layering, that layer is the last layer.

First, the weight value section will be described. The weight value of the initial sample may be determined according to the attribute of the initial sample, that is, the attribute of the content, and the user attribute. Wherein, the attribute of the content can be set according to the requirement. For example, a certain initial sample is a song, the attribute of the song may be duration, style, word song author, singer, and the like, the user attribute may be user age, gender, history browsing record, and the like, the weight value of the initial sample is determined according to the matching degree of the attribute of the initial sample and the user attribute, the higher the matching degree is, the higher the weight value is, and the lower the matching degree is, the lower the weight value is. The embodiment of the specific algorithm for determining the weight value is not limited.

For a plurality of interval samples included in each layer, each interval sample corresponds to one weight value interval, that is, each layer includes a plurality of weight value intervals. For a plurality of weight value intervals corresponding to a plurality of interval samples of each layer, the initial value of a first weight value interval is 0, the ending value is the weight value minus one of the interval samples corresponding to the first weight value interval, for other weight value intervals except the first weight value interval, the initial value of each weight value interval is the ending value of the last adjacent weight value interval plus one, and the ending value is the weight value minus one of the interval samples corresponding to the initial value weighted weight value interval of the weight value interval.

For example, assume that one of the layers includes 10 interval samples, and the weight values of each interval sample are 10, 20, 30, 40, 50, 60, 70, 80, 90, and 100, respectively. Then the weight value interval of the 1 st interval sample is [0, 9], the weight value interval of the 2 nd interval sample is [10, 29], the weight value interval of the 3 rd interval sample is [30-59], and so on, the weight value interval of the 10 th interval sample is [ 450-.

In addition, the weight value of each section sample included in the i +1 th layer is the sum of the weight values of at least two to-be-processed section samples corresponding to the section sample of the i +1 th layer in the i-th layer, and i is equal to or greater than 1.

The weight value of each interval sample included in the level 1 is the sum of the weight values of the initial samples included in each interval sample, and for other levels after the level 1, for example, the level 2, each interval sample of the level 2 includes at least two interval samples of the level 1, and the weight value of each interval sample of the level 2 is the sum of the weight values of at least two interval samples of the level 1 included in each interval sample of the level 2.

The weight value interval of the interval sample obtained by the method ensures that the weight value interval of each interval sample is not overlapped, and the weight value interval of the interval sample is related to the weight value of the interval sample, namely the weight value interval is related to the weight value of the initial sample included by the interval sample, so that the sampling of the interval sample of each layer is still based on the weight value of the initial sample, and the matching degree of the sampling result and the user is improved. The following description will proceed to the section of each layer, which should be sampled to obtain the target section sample.

In the first case:

if the layer is the last layer, determining a target interval sample of the last layer according to the random number and the weight value interval corresponding to the last layer, which may specifically include: determining a weight value interval corresponding to each interval sample in a plurality of interval samples included in the last layer; generating a first random number; searching a first target weight value interval in which a first random number is located in a plurality of weight value intervals; and determining a first target interval sample of the last layer according to the first target weight value interval.

The description will be made with reference to the results of layer interval division of 64000000 initial samples in example two. The last layer, i.e., layer 3, includes 64 interval samples in layer 3, and determines, for the 64 interval samples, a weight value interval corresponding to each interval sample therein. Assume that the weight value interval corresponding to each interval sample is [0, 999], [1000, 2999], [ 3000-. It is to be understood that, only the weight value intervals corresponding to the first 3 interval samples are listed here as an example, and the sizes of the weight value intervals listed here are only used for illustration, and the weight value in practical application is calculated according to the method described above.

The first random number is generated, and it is understood that the starting value of the random interval for generating the first random number is the starting value of the weight value interval of the first interval sample, and the ending value is the last, that is, the ending value of the weight value interval of the 64 th interval sample. Assuming that the first random number is 2345, the weight value interval corresponding to the first random number may be determined to be [1000, 2999], and therefore, the 2 nd interval sample corresponding to the weight value interval [1000, 2999] is determined to be the first target interval sample of the last layer.

In the second case:

if the layer is other than the last layer, determining a target interval sample of the layer according to the target interval sample of the layer above the layer and the random number and weight value interval of the layer, including: determining at least two to-be-processed interval samples corresponding to the target interval sample of the (i + 1) th layer in the ith layer according to the target interval sample of the (i + 1) th layer; respectively determining weight value intervals corresponding to at least two to-be-processed interval samples; generating a second random number; searching a second target weight value interval in which a second random number is located in the weight value intervals corresponding to the at least two samples of the interval to be processed; and determining a second target interval sample of the ith layer according to the second target weight value interval.

For example, the description will be made by taking the result of inter-layer division of 64000000 initial samples and the first target interval sample of the last layer determined in the first case as an example.

The first target interval sample of layer 3 includes 100 target interval samples of layer 2, that is, 100 to-be-processed interval samples of layer 2. And determining a weight value interval corresponding to each to-be-processed interval sample in the 100 to-be-processed interval samples of the layer 2. It is assumed that the weight value intervals corresponding to each interval sample are [0, 999], [100, 299], [ 300-. It is to be understood that, only the weight value intervals corresponding to the first 3 to-be-processed interval samples are listed here as an example, and the size of the weight value intervals listed here is merely used for illustration, and the weight value intervals in practical application are obtained by calculation according to the method described above.

As can be understood, the start value of the random interval for generating the second random number is the start value of the weight value interval of the first layer 2 to-be-processed interval sample, and the end value is the last, i.e., the end value of the weight value interval of the 100 th to-be-processed interval sample of the layer 2. Assuming that the second random number is 230, it may be determined that a weight value interval corresponding to the second random number is [0, 999], so that the to-be-processed interval sample of the 1 st layer 2 corresponding to the weight value interval [0, 999] is determined as the second target interval sample of the layer 2.

And continuously sampling 100 to-be-processed interval samples of the layer 1 corresponding to the second target interval sample of the layer 2 according to the same method, so as to obtain a second target interval sample of the layer 1, wherein the second target interval sample of the layer 1 comprises 100 initial samples.

In this embodiment, the interval samples of each layer are respectively sampled randomly, and the range of the samples sampled at this layer is based on the sampling result of the previous layer, so that a plurality of initial samples can be quickly determined by sampling the interval samples of multiple layers, the range of sampling the initial samples is reduced, and the processing efficiency of the server in content recommendation is improved.

In the above embodiment, the target interval sample of the first layer is determined by sampling the multiple layers of interval samples layer by layer, and then, the content to be recommended may be determined according to multiple initial samples in the target interval sample of the first layer. The following description will be given with reference to specific examples.

Example four

Determining a weight value interval of each initial sample in a plurality of initial samples in a target interval sample of a first layer; generating a third random number; searching a third target weight value interval in which a third random number is located in the weight value intervals of the plurality of initial samples; and determining the content to be recommended according to the third target weight value interval.

The target interval sample of the first layer determined in the third embodiment is taken as an example for explanation. The target interval sample of the first layer includes 100 initial samples, i.e., 100 contents. Let the weight values of each initial sample be 3, 4, 5, 6 …, etc., and only the weight values of the first three initial samples are listed here for example. Then, the weight value interval of the 1 st initial sample is [0, 2], the weight value interval of the 2 nd initial sample is [3, 6], the weight value interval of the 3 rd initial sample is [7-11], the weight value interval of the 4 th initial sample is [12-17], and so on, the weight value interval of 100 initial samples can be determined.

The generated third random number is generated, and it is understood that a start value of a random interval for generating the third random number is a start value of a weight value interval of a first initial sample, i.e., a first content, and an end value is an end value of a weight value interval of a last, i.e., a 100 th, initial sample. Assuming that the third random number is 10, it may be determined that the weight value interval corresponding to the third random number is [7-11], and therefore, the 3 rd initial sample, i.e., the 3 rd content, corresponding to the weight value interval [7-11] is determined as the content to be recommended.

Assuming that the number of contents to be recommended to the user is 10, after the 3 rd content is determined to be the content to be recommended, the 3 rd content is removed from 100 initial samples, and 99 initial samples remain. The weighted value of each of the 99 initial samples is 3, 4, 6 …, etc., and only the weighted values of the first three initial samples are listed here for example, and it can be seen that, since the 3 rd initial sample is removed, the original 4 th initial sample becomes the new 3 rd initial sample. Then the weight value interval of the 1 st initial sample is [0, 2], the weight value interval of the 2 nd initial sample is [3, 6], the weight value interval of the 3 rd initial sample is [7-12], and so on. And generating a new third random number again, and determining a second content to be recommended according to the weight value interval corresponding to the new third random number. And removing the second content to be recommended and then sampling again until 10 contents to be recommended are extracted.

In the embodiment, when the initial sample, that is, the content, is sampled according to the weight value of the content, it is ensured that the matching degree of the extracted content and the user is high, and the requirement of the user can be met. On the basis, the result is ensured to have certain randomness by combining random numbers, and the diversity of content recommendation is improved.

EXAMPLE five

Fig. 5 is a schematic structural diagram of a content recommendation device according to a fifth embodiment of the present application, as shown in fig. 5, a content recommendation device 50 includes:

an obtaining module 501, configured to obtain multiple initial samples, and perform inter-layer division on the multiple initial samples to obtain at least one layer; each layer comprises a plurality of interval samples, and the number of the interval samples in the last layer of at least one layer is less than a preset threshold value; each initial sample is a piece of content;

a first determining module 502, configured to determine, for each layer, a target interval sample of the layer according to the random number and the weight value interval corresponding to the layer, or a target interval sample of a layer above the layer and the random number and the weight value interval of the layer;

a second determining module 503, configured to determine, according to a plurality of initial samples in the target interval samples determined in the first layer, content to be recommended;

a sending module 504, configured to send the content to be recommended to the terminal device.

Optionally, the obtaining module 501 is configured to:

carrying out layer 1 division on a plurality of initial samples, and obtaining a plurality of first interval samples included in the layer 1;

and if the number of the interval samples of the first interval samples included in the ith layer is larger than the preset threshold value, performing i +1 th layer division on the first interval samples included in the ith layer to obtain a plurality of interval samples included in the i +1 th layer, and repeatedly executing the step by taking i +1 as a new i until the number of the interval samples of the first interval samples included in the ith layer is not larger than the preset threshold value, wherein i is larger than or equal to 1.

Optionally, if the layer is the last layer, the first determining module 502 is configured to:

determining a weight value interval corresponding to each interval sample in a plurality of interval samples included in the last layer;

generating a first random number;

searching a first target weight value interval in which a first random number is located in a plurality of weight value intervals;

and determining a first target interval sample of the last layer according to the first target weight value interval.

Optionally, if the layer is other than the last layer, the first determining module 502 is configured to:

determining at least two to-be-processed interval samples corresponding to the target interval sample of the (i + 1) th layer in the ith layer according to the target interval sample of the (i + 1) th layer;

respectively determining weight value intervals corresponding to at least two to-be-processed interval samples;

generating a second random number;

searching a second target weight value interval in which a second random number is located in the weight value intervals corresponding to the at least two samples of the interval to be processed;

and determining a second target interval sample of the ith layer according to the second target weight value interval.

Optionally, the second determining module 503 is configured to:

determining a weight value interval of each initial sample in a plurality of initial samples in a target interval sample of a first layer;

generating a third random number;

searching a third target weight value interval in which a third random number is located in the weight value intervals of the plurality of initial samples;

and determining the content to be recommended according to the third target weight value interval.

Optionally, the obtaining module 501 is configured to:

grouping a plurality of first interval samples included in the ith layer to obtain an (i + 1) th layer, wherein each group of the (i + 1) th layer includes at least two first interval samples of the ith layer.

Optionally, each layer includes a plurality of weight value intervals, and each weight value interval corresponds to one interval sample.

Optionally, the starting value of the first weight value interval is 0, the ending value is the weight value of the interval sample corresponding to the first weight value interval minus one, for the other weight value intervals except the first weight value interval, the starting value of each weight value interval is the ending value of the last adjacent weight value interval plus one, and the ending value is the weight value of the interval sample corresponding to the starting value weighted weight value interval of the weight value interval minus one.

Optionally, the weight value of each interval sample included in the (i + 1) th layer is the sum of the weight values of at least two to-be-processed interval samples corresponding to the interval sample of the (i + 1) th layer in the (i) th layer, and i is greater than or equal to 1.

The content recommendation device provided in the embodiment of the present application may implement the technical solution of the content recommendation method in any of the above embodiments, and the implementation principle and the beneficial effect of the content recommendation method are similar to those of the content recommendation method, which can be referred to as the implementation principle and the beneficial effect of the content recommendation method, and are not described herein again.

According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.

As shown in fig. 6, fig. 6 is a block diagram of an electronic device for implementing a content recommendation method according to an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.

As shown in fig. 6, the electronic apparatus includes: one or more processors 601, memory 602, and interfaces for connecting the various components, including a high-speed interface and a low-speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). In fig. 6, one processor 601 is taken as an example.

The memory 602 is a non-transitory computer readable storage medium as provided herein. The memory stores instructions executable by the at least one processor to cause the at least one processor to perform the content recommendation method provided herein. The non-transitory computer-readable storage medium of the present application stores computer instructions for causing a computer to execute the content recommendation method provided by the present application.

The memory 602 is used as a non-transitory computer readable storage medium for storing non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the content recommendation method in the embodiment of the present application (for example, the obtaining module 501, the first determining module 502, the second determining module 503, and the sending module 504 shown in fig. 5). The processor 601 executes various functional applications of the server and data processing by running non-transitory software programs, instructions, and modules stored in the memory 602, that is, implements the content recommendation method in the above-described method embodiments.

The memory 602 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the electronic device of the content recommendation method, and the like. Further, the memory 602 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 602 may optionally include a memory remotely located from the processor 601, and these remote memories may be connected to the electronic device of the content recommendation method through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.

The electronic device of the content recommendation method may further include: an input device 603 and an output device 604. The processor 601, the memory 602, the input device 603 and the output device 604 may be connected by a bus or other means, and fig. 6 illustrates the connection by a bus as an example.

The input device 603 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic apparatus of the content recommendation method, such as an input device of a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, or the like. The output devices 604 may include a display device, auxiliary lighting devices (e.g., LEDs), and tactile feedback devices (e.g., vibrating motors), among others. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.

Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.

These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.

To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.

The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.

The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.

According to the technical scheme of the embodiment of the application, when content recommendation is carried out, each content in the content pool is used as an initial sample, the initial samples are grouped to obtain at least one layer of interval sample, and random sampling is carried out on the obtained at least one layer of interval sample layer by layer from the last layer, so that the calculated amount during content sampling is greatly reduced, and the processing efficiency of content recommendation carried out by a server is improved.

It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, and the present invention is not limited thereto as long as the desired results of the technical solutions disclosed in the present application can be achieved.

The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

18页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于主题多样性的旅游景点动态推荐算法及装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!