CN111523026A - User portrait update method, system, network device and storage medium - Google Patents
User portrait update method, system, network device and storage medium Download PDFInfo
- Publication number
- CN111523026A CN111523026A CN202010293572.9A CN202010293572A CN111523026A CN 111523026 A CN111523026 A CN 111523026A CN 202010293572 A CN202010293572 A CN 202010293572A CN 111523026 A CN111523026 A CN 111523026A
- Authority
- CN
- China
- Prior art keywords
- portrait
- user
- server
- user portrait
- difference value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9535—Search customisation based on user profiles and personalisation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/60—Information retrieval; Database structures therefor; File system structures therefor of audio data
- G06F16/63—Querying
- G06F16/635—Filtering based on additional data, e.g. user or group profiles
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/70—Information retrieval; Database structures therefor; File system structures therefor of video data
- G06F16/73—Querying
- G06F16/735—Filtering based on additional data, e.g. user or group profiles
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Computational Linguistics (AREA)
- Processing Or Creating Images (AREA)
- Information Transfer Between Computers (AREA)
Abstract
本发明实施方式涉及通信技术领域,公开了一种用户画像更新方法,包括:获取用户的行为记录并记录于所述终端中的行为记录表中;根据所述行为记录表以预设时间间隔计算并更新所述终端中所述用户的第一用户画像,并计算所述第一用户画像的画像差分值,其中,所述画像差分值为相较于前一时刻的用户画像的差分值;将所述画像差分值发送至服务端,以供所述服务端根据所述画像差分值更新所述服务端中所述用户的第二用户画像。本发明实施方式还提供了一种用户画像更新系统、网络设备及存储介质。本发明实施方式提供的用户画像更新方法、系统、网络设备及存储介质,使得用户画像的计算占用服务器的资源较少。
Embodiments of the present invention relate to the field of communication technologies, and disclose a method for updating user portraits, including: acquiring a user's behavior record and recording it in a behavior record table in the terminal; calculating at preset time intervals according to the behavior record table and update the first user portrait of the user in the terminal, and calculate the portrait difference value of the first user portrait, wherein the portrait difference value is compared with the difference value of the user portrait at the previous moment; The portrait difference value is sent to the server, so that the server can update the second user portrait of the user in the server according to the portrait difference value. The embodiments of the present invention also provide a user portrait updating system, network device and storage medium. The user portrait updating method, system, network device and storage medium provided by the embodiments of the present invention make the calculation of the user portrait occupy less resources of the server.
Description
技术领域technical field
本发明涉及通信技术领域,特别涉及一种用户画像更新方法、系统、网络设备及存储介质。The present invention relates to the field of communication technologies, and in particular, to a method, a system, a network device and a storage medium for updating a user portrait.
背景技术Background technique
用户画像是根据用户社会属性、生活习惯和消费行为等信息而抽象出的一个标签化的用户模型,可以用于信息内容的推送或协助商品的推广与营销等。User portrait is a labelled user model abstracted from information such as user social attributes, living habits and consumption behavior, which can be used to push information content or assist in product promotion and marketing.
现有的用户画像计算及使用的模式为:(1)用户使用终端产品(如网页或APP)观看视频、听歌等;(2)边缘节点上的服务器采集用户的使用行为记录形成用户行为日志,并将用户行为日志实时或近实时地上传至中心服务器进行存储;(3)在中心服务器上部署用户画像程序分析计算采集的用户行为日志,生成用户画像;(4)基于用户画像采用内容服务集群进行营销策略或内容推荐等。The existing user portrait calculation and use modes are: (1) users use terminal products (such as web pages or APPs) to watch videos, listen to songs, etc.; (2) servers on edge nodes collect user behavior records to form user behavior logs , and upload the user behavior logs to the central server for storage in real time or in near real time; (3) Deploy a user portrait program on the central server to analyze and calculate the collected user behavior logs to generate user portraits; (4) Use content services based on user portraits Cluster for marketing strategy or content recommendation, etc.
然而,发明人发现现有技术至少存在以下问题:由于用户数量巨大,中心服务器需要使用大量的存储资源存储用户行为日志;且在计算用户画像时,无论是基于流式的实时计算的方式,还是定期批量计算用户画像方式,中心服务器都需要使用大量的计算资源,导致目前的用户画像计算方法对服务器的资源占用较多。However, the inventor found that the prior art has at least the following problems: due to the huge number of users, the central server needs to use a large number of storage resources to store user behavior logs; In the method of calculating user portraits in batches on a regular basis, the central server needs to use a lot of computing resources, resulting in the current user portrait calculation method occupying a lot of server resources.
发明内容SUMMARY OF THE INVENTION
本发明实施方式的目的在于提供一种用户画像更新方法、系统、网络设备及存储介质,使得用户画像的计算占用服务器的资源较少。The purpose of the embodiments of the present invention is to provide a user portrait update method, system, network device and storage medium, so that the calculation of the user portrait occupies less server resources.
为解决上述技术问题,本发明的实施方式提供了一种用户画像更新方法,应用于终端,包括:获取用户的行为记录并记录于终端中的行为记录表中;根据行为记录表以预设时间间隔计算并更新终端中用户的第一用户画像;计算第一用户画像的画像差分值,其中,画像差分值为相较于前一时刻的用户画像的差分值;将画像差分值发送至服务端,以供服务端根据画像差分值更新服务端中用户的第二用户画像。In order to solve the above technical problems, embodiments of the present invention provide a user portrait update method, which is applied to a terminal, including: acquiring a user's behavior record and recording it in a behavior record table in the terminal; Calculate and update the first user portrait of the user in the terminal at intervals; calculate the portrait difference value of the first user portrait, wherein the portrait difference value is compared with the difference value of the user portrait at the previous moment; send the portrait difference value to the server , so that the server can update the second user portrait of the user in the server according to the difference value of the portrait.
本发明的实施方式还提供了一种用户画像更新系统,包括终端和服务端;终端用于获取用户的行为记录并记录于终端中的行为记录表中,根据行为记录表以预设时间间隔计算并更新终端中用户的第一用户画像,计算第一用户画像的画像差分值,将画像差分值发送至服务端,其中,画像差分值为相较于前一时刻的用户画像的差分值;服务端用于根据画像差分值更新服务端中用户的第二用户画像。Embodiments of the present invention also provide a user portrait updating system, including a terminal and a server; the terminal is used to obtain a user's behavior record and record it in a behavior record table in the terminal, and calculates at preset time intervals according to the behavior record table And update the first user portrait of the user in the terminal, calculate the portrait difference value of the first user portrait, and send the portrait difference value to the server, where the portrait difference value is compared with the difference value of the user portrait at the previous moment; The terminal is used to update the second user portrait of the user in the server according to the portrait difference value.
本发明的实施方式还提供了一种网络设备,包括:至少一个处理器;以及,与至少一个处理器通信连接的存储器;其中,存储器存储有可被至少一个处理器执行的指令,指令被至少一个处理器执行,以使至少一个处理器能够执行上述的用户画像更新方法。Embodiments of the present invention also provide a network device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by at least one processor. One processor executes, so that at least one processor can execute the above-mentioned user portrait updating method.
本发明的实施方式还提供了一种计算机可读存储介质,存储有计算机程序,计算机程序被处理器执行时实现上述的用户画像更新方法。Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the above-mentioned method for updating a user portrait is implemented.
本发明实施方式相对于现有技术而言,通过终端获取用户的行为记录并记录于终端中的行为记录表中,可以在终端保存用户的行为记录数据,使服务端不需要部署大量的存储资源进行行为记录数据的存储;通过在终端进行用户画像的计算和更新,使服务端不需要部署大量的计算资源进行用户画像的计算,占用服务端的资源较少;而通过预设时间间隔计算更新终端及服务端中的用户画像,则可以降低服务端中用户画像的更新频率,进一步减少对服务端的资源的占用;并且,在更新服务端中的用户画像时,采用画像差分值的形式进行更新,可以降低终端与服务端之间进行数据传输的带宽要求。Compared with the prior art, the embodiment of the present invention obtains the user's behavior record through the terminal and records it in the behavior record table in the terminal, so that the user's behavior record data can be saved in the terminal, so that the server does not need to deploy a large number of storage resources Store behavior record data; by calculating and updating user portraits on the terminal, the server does not need to deploy a large number of computing resources to calculate user portraits, which occupies less resources on the server; and update the terminal by calculating and updating the terminal at preset time intervals. and the user portrait in the server, the update frequency of the user portrait in the server can be reduced, and the resource occupation of the server can be further reduced; and when updating the user portrait in the server, the difference value of the portrait is used to update, The bandwidth requirement for data transmission between the terminal and the server can be reduced.
另外,在获取用户的行为记录并记录于终端中的行为记录表中之前,还包括:获取第一用户画像的时间戳作为第一时间戳、获取第二用户画像的时间戳作为第二时间戳;若第一时间戳大于第二时间戳,则将第一用户画像发送至服务端,以供服务端根据第一用户画像更新第二用户画像;若第一时间戳小于第二时间戳,则从服务端获取第二用户画像,根据第二用户画像更新第一用户画像。通过终端与服务端中的用户画像的时间戳的比较,在比较后进行终端或服务端中的用户画像的更新,可以实现终端与服务端中用户画像的同步,有利于后续采用画像差分值进行用户画像的计算与更新,保证用户画像计算的准确度;同时,通过终端与服务端中用户画像的同步,可以使用户方便在多个终端使用相同的应用程序,亦可以使在终端或服务端中的用户画像丢失后,可以通过另外一个作为备份进行用户画像的恢复。In addition, before acquiring the user's behavior record and recording it in the behavior record table in the terminal, it also includes: acquiring the timestamp of the first user portrait as the first timestamp, and acquiring the timestamp of the second user portrait as the second timestamp ; If the first time stamp is greater than the second time stamp, send the first user portrait to the server for the server to update the second user portrait according to the first user portrait; if the first time stamp is less than the second time stamp, then Obtain the second user portrait from the server, and update the first user portrait according to the second user portrait. By comparing the timestamps of the user portraits in the terminal and the server, and updating the user portraits in the terminal or the server after the comparison, the synchronization of the user portraits in the terminal and the server can be realized, which is conducive to the subsequent use of portrait difference values. The calculation and update of the user portrait ensures the accuracy of the calculation of the user portrait; at the same time, through the synchronization of the user portrait in the terminal and the server, the user can easily use the same application program in multiple terminals, and can also be used in the terminal or the server. After the user portrait is lost, another user portrait can be used as a backup to restore the user portrait.
另外,预设时间间隔为动态时间间隔,动态时间间隔与服务端的传输速度负相关。根据动态时间间隔更新终端及服务端中的用户画像,可以匹配网络传输的环境和服务端处理的能力,实现对服务端中的用户画像的更新频率进行动态控制,从而在服务端传输速度较慢而延时较大时,降低服务端中的用户画像的更新频率从而减轻服务端的负载;在服务端传输速度较快而响应快时,提高服务端中的用户画像的更新频率,从而能够以更快的速度将用户画像的数据发送给服务端。In addition, the preset time interval is a dynamic time interval, and the dynamic time interval is negatively correlated with the transmission speed of the server. Update the user portraits in the terminal and the server according to the dynamic time interval, which can match the network transmission environment and the processing capability of the server, and realize the dynamic control of the update frequency of the user portrait in the server, so that the transmission speed on the server is slow. When the delay is large, the update frequency of the user portrait in the server is reduced to reduce the load of the server; when the transmission speed of the server is fast and the response is fast, the update frequency of the user portrait in the server is increased. The data of the user portrait is sent to the server at a fast speed.
另外,用户画像更新方法还包括:根据以下计算公式计算动态时间间隔:In addition, the user portrait update method further includes: calculating the dynamic time interval according to the following calculation formula:
Δt=t0-t0*α1/R;Δt=t 0 −t 0 *α 1/R ;
其中,Δt为动态时间间隔,t0为预设的最大时间间隔,α为常数且0<α<1,R为服务端的传输速度。Among them, Δt is the dynamic time interval, t 0 is the preset maximum time interval, α is a constant and 0<α<1, and R is the transmission speed of the server.
另外,用户画像更新方法还包括:当行为记录表中的行为记录数据更新时,开始动态时间间隔的时长计算。在行为记录数据更新时,才开始动态时间间隔的时长计算,再根据动态时间间隔计算和更新终端的用户画像,可以结合用户的实际使用情况进行用户画像的计算和更新,减少对终端资源的占用。In addition, the user portrait updating method further includes: when the behavior record data in the behavior record table is updated, starting the calculation of the duration of the dynamic time interval. When the behavior record data is updated, the calculation of the duration of the dynamic time interval is started, and then the user portrait of the terminal is calculated and updated according to the dynamic time interval. The user portrait can be calculated and updated according to the actual usage of the user, reducing the occupation of terminal resources. .
另外,在根据行为记录表以预设时间间隔计算并更新终端中用户的第一用户画像之后,还包括:将行为记录表中更新第一用户画像所用及的行为记录数据删除;若行为记录表中的行为记录数据为空,则停止动态时间间隔的时长计算。将行为记录表中参与第一用户画像更新的行为记录数据删除,可以减少对终端存储资源的占用;在行为记录数据为空时停止动态时间间隔的时长计算,可以停止第一用户画像的计算和更新,减少对终端计算资源的占用。In addition, after calculating and updating the first user portrait of the user in the terminal at preset time intervals according to the behavior record table, the method further includes: deleting the behavior record data used for updating the first user portrait in the behavior record table; if the behavior record table If the behavior record data in is empty, the calculation of the duration of the dynamic interval is stopped. Deleting the behavior record data participating in the update of the first user portrait in the behavior record table can reduce the occupation of terminal storage resources; when the behavior record data is empty, stop the calculation of the duration of the dynamic time interval, which can stop the calculation and calculation of the first user portrait. Update, reduce the occupation of terminal computing resources.
另外,在将画像差分值发送至服务端,以供服务端根据画像差分值更新服务端中用户的第二用户画像之后,还包括:获取服务端更新第二用户画像的结果,若结果为更新失败,则将画像差分值作为第一画像差分值;获取下次计算的画像差分值作为第二画像差分值;将第一画像差分值与第二画像差分值合并,得到第三画像差分值;将第三画像差分值发送至服务端,以供服务端根据第三画像差分值更新第二用户画像。由于在第二用户更新的结果为失败时,表明服务端此时的网络环境较差或处理能力不足,若立即重传则大概率会失败,若设置经过一段时间后重传则会增加终端与服务端传输数据的次数;因此,将更新失败的画像差分值与下次计算的画像差分值合并后再更新服务端中的第二用户画像,可以提高第二用户画像的更新成功率,且可以减少用户画像数据的传输次数,减少对服务端资源的占用。In addition, after sending the portrait difference value to the server so that the server can update the second user portrait of the user in the server according to the portrait difference value, the method further includes: obtaining a result of updating the second user portrait by the server, if the result is an update Failure, then use the portrait difference value as the first portrait difference value; Obtain the portrait difference value calculated next time as the second portrait difference value; Combine the first portrait difference value with the second portrait difference value to obtain the third portrait difference value; The third portrait difference value is sent to the server, so that the server can update the second user portrait according to the third portrait difference value. When the result of the second user update is failure, it indicates that the network environment of the server is poor or the processing capability is insufficient. If the retransmission is performed immediately, it will fail with a high probability. If the retransmission is set after a period of time, the terminal and The number of times the server transmits data; therefore, updating the second user portrait in the server after merging the failed update portrait difference value with the next calculated portrait difference value can improve the update success rate of the second user portrait, and can Reduce the transmission times of user portrait data and reduce the occupation of server resources.
附图说明Description of drawings
一个或多个实施例通过与之对应的附图中的图片进行示例性说明,这些示例性说明并不构成对实施例的限定。One or more embodiments are exemplified by the pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments.
图1是本发明第一实施方式提供的用户画像更新方法的流程示意图;1 is a schematic flowchart of a method for updating a user portrait provided by a first embodiment of the present invention;
图2是本发明第一实施方式提供的用户画像更新方法中的用户画像的示例图;2 is an example diagram of a user portrait in the user portrait updating method provided by the first embodiment of the present invention;
图3是现有技术中用户画像更新的原理结构示意图;Fig. 3 is the principle structure schematic diagram of user portrait update in the prior art;
图4是本发明第一实施方式提供的用户画像更新方法的原理结构示意图;4 is a schematic diagram of the principle structure of a user portrait updating method provided by the first embodiment of the present invention;
图5是本发明第二实施方式提供的用户画像更新方法的流程示意图;5 is a schematic flowchart of a method for updating a user portrait provided by a second embodiment of the present invention;
图6是本发明第二实施方式提供的用户画像更新方法的具体流程示例图;Fig. 6 is the specific flow chart of the user portrait update method provided by the second embodiment of the present invention;
图7是本发明第三实施方式提供的用户画像更新系统的结构示意图;7 is a schematic structural diagram of a user portrait updating system provided by a third embodiment of the present invention;
图8是本发明第四实施方式提供的网络设备的结构示意图。FIG. 8 is a schematic structural diagram of a network device according to a fourth embodiment of the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明的各实施方式进行详细的阐述。然而,本领域的普通技术人员可以理解,在本发明各实施方式中,为了使读者更好地理解本申请而提出了许多技术细节。但是,即使没有这些技术细节和基于以下各实施方式的种种变化和修改,也可以实现本申请所要求保护的技术方案。In order to make the objectives, technical solutions and advantages of the present invention clearer, each embodiment of the present invention will be described in detail below with reference to the accompanying drawings. However, those of ordinary skill in the art can appreciate that, in the various embodiments of the present invention, many technical details are set forth in order for the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in the present application can be realized.
本发明的第一实施方式涉及一种用户画像更新方法,应用于终端,通过获取用户的行为记录并记录于终端中的行为记录表中,根据行为记录表以预设时间间隔计算并更新终端中用户的第一用户画像;计算第一用户画像的画像差分值;将画像差分值发送至服务端,以供服务端根据画像差分值更新服务端中用户的第二用户画像。在终端保存用户的行为记录和进行用户画像的计算,可以使服务端不需要部署大量的存储资源记录用户的行为记录、不需要部署大量的计算资源进行用户画像的计算,对服务端的资源占用较少;而根据预设时间间隔更新终端及服务端中的用户画像,可以降低服务端中用户画像的更新频率,进一步减少对服务端的资源的占用;并且,在更新服务端中的用户画像时,采用画像差分值的形式进行更新,可以降低终端与服务端之间进行数据传输的带宽要求。The first embodiment of the present invention relates to a method for updating a user portrait, which is applied to a terminal. The user's behavior record is obtained and recorded in a behavior record table in the terminal, and the behavior record table is calculated and updated at preset time intervals according to the behavior record table. The first user portrait of the user; calculate the portrait difference value of the first user portrait; send the portrait difference value to the server, so that the server can update the second user portrait of the user in the server according to the portrait difference value. Saving user behavior records and calculating user portraits on the terminal can make the server do not need to deploy a large number of storage resources to record user behavior records, and does not need to deploy a large number of computing resources to calculate user portraits. and updating the user portraits in the terminal and the server according to the preset time interval can reduce the update frequency of the user portraits in the server and further reduce the occupation of resources on the server; and, when updating the user portraits in the server, The update is performed in the form of the differential value of the portrait, which can reduce the bandwidth requirement for data transmission between the terminal and the server.
本发明实施方式提供的用户画像更新方法应用于终端,即执行主体为终端,其中,终端可以包括手机、平板电脑、个人计算机等的终端。具体可以是终端上的应用程序,例如是手机上的APP。The user portrait update method provided by the embodiment of the present invention is applied to a terminal, that is, the execution subject is a terminal, wherein the terminal may include a terminal such as a mobile phone, a tablet computer, a personal computer, and the like. Specifically, it may be an application program on a terminal, for example, an APP on a mobile phone.
本发明实施方式提供的用户画像更新方法的具体流程如图1所示,具体包括以下步骤:The specific process of the user portrait update method provided by the embodiment of the present invention is shown in FIG. 1 , and specifically includes the following steps:
S101:获取用户的行为记录并记录于终端中的行为记录表中。S101: Acquire a user's behavior record and record it in a behavior record table in the terminal.
其中,用户的行为记录为用户在终端使用应用程序时的行为记录。例如,用户通过手机APP听音乐时,用户的行为记录可以为用户对音乐资源的播放、评论、收藏等的行为记录。Among them, the behavior record of the user is the behavior record when the user uses the application program on the terminal. For example, when a user listens to music through a mobile phone APP, the user's behavior record may be the user's behavior record of playing, commenting, and collecting music resources.
具体地,当用户使用终端的应用程序时,终端通过应用程序获取用户的行为记录并记录于预先设置的行为记录表中。其中,行为记录表中记录的行为记录可以根据实际需要进行设置,例如可以是播放资源的ID、播放的时长、播放的次数等,此处不做具体限制。行为记录表的示例如下表1所示:Specifically, when the user uses the application program of the terminal, the terminal obtains the user's behavior record through the application program and records it in a preset behavior record table. The behavior records recorded in the behavior record table can be set according to actual needs, for example, the ID of the playback resource, the playback duration, the number of playbacks, etc., which are not specifically limited here. An example of a behavior record sheet is shown in Table 1 below:
表1Table 1
表1中,“结束时间”为unix时间戳,unix时间戳是从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数,不考虑闰秒。In Table 1, the "end time" is the unix timestamp, which is the number of seconds elapsed since January 1, 1970 (midnight in UTC/GMT), regardless of leap seconds.
S102:根据行为记录表以预设时间间隔计算并更新终端中用户的第一用户画像。S102: Calculate and update the first user portrait of the user in the terminal at preset time intervals according to the behavior record table.
其中,预设时间间隔可以根据实际需要进行设置,此处不做具体限制。可以理解的是,当预设时间间隔较短时,终端的第一用户画像及服务端中第二用户画像更新的频率较高;当预设时间间隔较长时,第一用户画像及第二用户画像更新的频率较低。The preset time interval can be set according to actual needs, and no specific limitation is made here. It can be understood that when the preset time interval is short, the update frequency of the first user portrait of the terminal and the second user portrait in the server is relatively high; when the preset time interval is long, the first user portrait and the second user portrait are updated more frequently. User portraits are updated less frequently.
请参考图2,其为用户画像的一具体示例图,用户画像包括画像类型标识字段、画像时间戳标识字段和画像标签字段。其中,画像类型标识字段用于标识用户画像是终端的用户画像还是服务端的用户画像,即分别对应第一用户画像和第二用户画像;画像时间戳标识字段用于标识用户画像计算或更新的时间;画像标签字段可以包括标签ID(即上述的内容标签)、标签值和标签分值,存储用户具体的画像标签、标签值及分值。可选地,为了方便用户画像的计算,终端的应用程序在从内容服务器获取内容时,应用程序获取内容对应的内容标签并下载至终端本地。可以理解的是,由于内容标签本身的数据量很小且只在用户打开内容时才会进行获取,因此获取内容标签增加的流量非常有限,不会对内容服务器及整个网络造成影响。Please refer to FIG. 2 , which is a specific example diagram of a user portrait. The user portrait includes a portrait type identification field, a portrait timestamp identification field, and a portrait label field. Among them, the portrait type identification field is used to identify whether the user portrait is a terminal user portrait or a server user portrait, that is, corresponding to the first user portrait and the second user portrait respectively; the portrait timestamp identification field is used to identify the time when the user portrait is calculated or updated ; The portrait label field may include a label ID (that is, the above-mentioned content label), label value and label score, and store the user's specific portrait label, label value and score. Optionally, in order to facilitate the calculation of the user portrait, when the application of the terminal acquires the content from the content server, the application acquires the content tag corresponding to the content and downloads it locally to the terminal. It is understandable that since the amount of data in the content tag itself is very small and is only obtained when the user opens the content, the traffic increased by acquiring the content tag is very limited and will not affect the content server and the entire network.
可选地,终端在更新终端中用户的第一用户画像时,可以将计算得到的用户画像直接替换原来存储在终端本地的第一用户画像,以完成第一用户画像的更新。若原来存储在终端本地的第一用户画像为空,则直接将计算得到的用户画像存储在终端本地,完成第一用户画像的更新。Optionally, when the terminal updates the first user portrait of the user in the terminal, the calculated user portrait may directly replace the first user portrait originally stored locally in the terminal to complete the update of the first user portrait. If the first user portrait originally stored locally in the terminal is empty, the calculated user portrait is directly stored in the terminal locally, and the update of the first user portrait is completed.
预设时间间隔可以为静态时间间隔或动态时间间隔。优选地,预设时间间隔为动态时间间隔,且动态时间间隔与服务端的传输速度负相关。即服务端的传输速度越快,动态时间间隔越短;服务端的传输速度越慢,动态时间间隔越长。根据动态时间间隔更新终端及服务端中的用户画像,对于终端而言,可以在终端网络环境较差的情况下,降低画像差分值的传输频次,有利于降低终端的耗电量,改善终端的卡顿情况;对于服务端而言,可以匹配网络传输的环境和服务端处理的能力,实现对服务端中的用户画像的更新频率进行动态控制,从而在服务端传输速度较慢而延时较大时,降低服务端中的用户画像的更新频率从而减轻服务端的负载,减少服务端因负载大而宕机的风险,提升服务端的系统平稳运行的水平;在服务端传输速度较快而响应快时,提高服务端中的用户画像的更新频率又能够以更快的速度将用户画像的数据发送给服务端。The preset time interval can be a static time interval or a dynamic time interval. Preferably, the preset time interval is a dynamic time interval, and the dynamic time interval is negatively correlated with the transmission speed of the server. That is, the faster the transmission speed of the server, the shorter the dynamic time interval; the slower the transmission speed of the server, the longer the dynamic time interval. The user portraits in the terminal and the server are updated according to the dynamic time interval. For the terminal, when the terminal network environment is poor, the transmission frequency of the differential value of the portrait can be reduced, which is beneficial to reduce the power consumption of the terminal and improve the terminal's performance. Stalling situation; for the server, it can match the network transmission environment and the processing capability of the server, and realize dynamic control of the update frequency of the user portrait in the server, so that the transmission speed on the server is slower and the delay is longer. When it is large, reduce the update frequency of the user portrait in the server to reduce the load of the server, reduce the risk of the server being down due to heavy load, and improve the level of the smooth operation of the system on the server; the transmission speed on the server is faster and the response is fast. When the update frequency of the user portrait in the server is increased, the data of the user portrait can be sent to the server at a faster speed.
在一个具体的例子中,可以根据以下计算公式计算动态时间间隔:In a specific example, the dynamic time interval can be calculated according to the following calculation formula:
Δt=t0-t0*α1/R;Δt=t 0 −t 0 *α 1/R ;
其中,Δt为动态时间间隔,t0为预设的最大时间间隔,α为常数且0<α<1,R为服务端的传输速度。Among them, Δt is the dynamic time interval, t 0 is the preset maximum time interval, α is a constant and 0<α<1, and R is the transmission speed of the server.
具体地,t0可以根据实际需要进行设置,此处不做具体限制,α例如可以为0.1、0.5、0.7等常数,也可以根据实际需要进行设置,此处不做具体限制。R可以根据在一个时间段传输的数据量k和相应的传输时延τ来计算,即R=k/τ。可以理解的是,R越大,Δt越接近于Δt=t0-t0*α;R越小,Δt越接近于t0;另外,根据动态时间间隔更新终端及服务端的用户画像,不影响服务端最终得到的用户画像,只会在服务端响应慢时造成一定程度服务端中的用户画像的延迟,其延迟的程度可以由计算公式中的t0进行控制。Specifically, t 0 can be set according to actual needs, and no specific limitation is made here. R can be calculated according to the amount of data k transmitted in a time period and the corresponding transmission delay τ, that is, R=k/τ. It can be understood that the larger R is, the closer Δt is to Δt=t 0 -t 0 *α; the smaller R is, the closer Δt is to t 0 ; in addition, updating the user portraits of the terminal and server according to the dynamic time interval does not affect The user portrait finally obtained by the server will only cause a certain degree of delay in the user portrait in the server when the response of the server is slow. The degree of delay can be controlled by t 0 in the calculation formula.
动态时间间隔具体可以通过设置相应的计时器来实现的。可选地,可以设置在行为记录表中的行为记录数据更新时,开始动态时间间隔的时长计算。即相当于设置一个触发开关,当行为记录数据更新时才进行动态时间间隔的时长计算,再根据动态时间间隔计算和更新终端的用户画像,从而结合用户的实际使用情况进行用户画像的计算和更新,减少对终端资源的占用。The dynamic time interval can be specifically implemented by setting a corresponding timer. Optionally, when the behavior record data in the behavior record table is updated, the calculation of the duration of the dynamic time interval can be started. That is, it is equivalent to setting a trigger switch. When the behavior record data is updated, the duration of the dynamic time interval is calculated, and then the user portrait of the terminal is calculated and updated according to the dynamic time interval, so as to calculate and update the user portrait according to the actual usage of the user. , reduce the occupation of terminal resources.
在一个具体的例子中,在根据行为记录表以预设时间间隔计算并更新终端中用户的第一用户画像之后,还包括:将行为记录表中更新第一用户画像所用及的行为记录数据删除;若行为记录表中的行为记录数据为空,则停止动态时间间隔的时长计算。In a specific example, after calculating and updating the first user portrait of the user in the terminal at preset time intervals according to the behavior record table, the method further includes: deleting the behavior record data used for updating the first user portrait in the behavior record table ; If the behavior record data in the behavior record table is empty, stop the calculation of the duration of the dynamic time interval.
具体地,服务端在更新第一用户画像之后,将行为记录表中参与第一用户画像更新的行为记录数据删除,以减少对终端存储资源的占用;判断行为记录表中的行为记录数据是否为空,若已完成对行为记录表中的行为记录删除动作,此时行为记录数据为空,则停止动态时间间隔的时长计算,相当于将触发第一用户画像更新的触发开关关闭,停止第一用户画像的计算和更新,减少对终端计算资源的占用。Specifically, after updating the first user portrait, the server deletes the behavior record data participating in the update of the first user portrait in the behavior record table, so as to reduce the occupation of terminal storage resources; determine whether the behavior record data in the behavior record table is Empty, if the action of deleting the behavior record in the behavior record table has been completed, and the behavior record data is empty at this time, the calculation of the duration of the dynamic time interval will be stopped, which is equivalent to turning off the trigger switch that triggers the update of the first user portrait and stopping the first user portrait. The calculation and update of user portraits reduce the occupation of terminal computing resources.
S103:计算第一用户画像的画像差分值,其中,画像差分值为相较于前一时刻的用户画像的差分值。S103: Calculate the difference value of the portrait of the first user portrait, where the difference value of the portrait is a difference value compared with the user portrait at the previous moment.
具体地,终端将当前计算得到的第一用户画像与前一时刻的用户画像作差值,从而得到当前计算得到的第一用户画像的画像差分值。其中,画像差分值的示例如下表2:Specifically, the terminal makes a difference between the currently calculated first user portrait and the user portrait at the previous moment, so as to obtain a portrait difference value of the currently calculated first user portrait. Among them, the example of the difference value of the portrait is as follows in Table 2:
表2Table 2
可选地,终端在更新终端中的第一用户画像前,可以先将前一时刻的用户画像作一备份,从而在更新终端中的第一用户画像后,根据备份计算第一用户画像的差分值。实际应用中,也可以先获取本次计算得到的第一用户画像与前一时刻的用户画像的差分值,再进行终端中第一用户画像的更新。Optionally, before updating the first user portrait in the terminal, the terminal may first make a backup of the user portrait at the previous moment, so that after updating the first user portrait in the terminal, the difference between the first user portrait is calculated according to the backup. value. In practical applications, the difference value of the first user portrait obtained by this calculation and the user portrait at the previous moment may also be obtained first, and then the first user portrait in the terminal is updated.
S104:将画像差分值发送至服务端,以供服务端根据画像差分值更新服务端中用户的第二用户画像。S104: Send the portrait difference value to the server, so that the server can update the second user portrait of the user in the server according to the portrait difference value.
具体地,终端将计算得到的画像差分值发送至服务端,服务端接收到画像差分值后,将画像差分值与原来存储在服务端的第二用户画像相加,从而完成第二用户画像的更新。Specifically, the terminal sends the calculated portrait difference value to the server, and after receiving the portrait difference value, the server adds the portrait difference value to the second user portrait originally stored in the server, thereby completing the update of the second user portrait .
可选地,在更新第二用户画像时,服务端可以根据第一用户画像中的标签字段遍历服务端中的标签字段,逐个将用户画像中的画像差分值更新至服务端的数据库。具体过程可以为:服务端从数据库取出用户画像中的标签ID及标签分值,与用户画像中的画像差分值与数据库中的标签分值进行相加后作为新的标签分值写入数据库;当数据库中不存在与用户画像对应的标签时,直接将用户画像中的标签写入数据库,以用户画像中的画像差分值作为标签分值写入数据库。Optionally, when updating the second user portrait, the server may traverse the label fields in the server according to the label fields in the first user portrait, and update the difference values of the portraits in the user portrait to the database of the server one by one. The specific process can be as follows: the server fetches the tag ID and tag score in the user portrait from the database, adds the difference value of the portrait in the user portrait and the tag score in the database, and writes it into the database as a new tag score; When there is no label corresponding to the user portrait in the database, the label in the user portrait is directly written into the database, and the difference value of the portrait in the user portrait is written into the database as the label score.
在终端更新完第一用户画像后,根据第一用户画像更新服务端中的第二用户画像,有利于采用用户画像的推荐系统等业务能够及时使用到最新的用户画像。After the terminal has updated the first user portrait, the second user portrait in the server is updated according to the first user portrait, which is beneficial for businesses such as recommendation systems using the user portrait to be able to use the latest user portrait in time.
应当理解的是,在更新第二用户画像时,由于一个用户画像通常由几百个标签字段和数千个标签值组成,其大小在1-10KB左右,若直接将第一用户画像发送至服务端,根据第一用户画像更新第二用户画像,在用户行为频繁产生时,传输至服务端的网络流量依然较大。由于每次重新计算用户画像时,新的用户画像与原有的用户画像相比,只是部分标签或者部分标签值有所变化,大部分的用户画像数据保持不变,因此在更新时,可以使用画像差分值来更新服务端中的第二用户画像,减少传输至服务端的网络流量,降低终端与服务端之间进行数据传输的带宽要求。It should be understood that when updating the second user portrait, since a user portrait is usually composed of hundreds of tag fields and thousands of tag values, and its size is about 1-10KB, if the first user portrait is directly sent to the service At the server, the second user portrait is updated according to the first user portrait. When user behavior occurs frequently, the network traffic transmitted to the server is still relatively large. Since each time the user portrait is recalculated, the new user portrait only has some tags or some tag values changed compared with the original user portrait, and most of the user portrait data remains unchanged. Therefore, when updating, you can use The image difference value is used to update the second user portrait in the server, which reduces the network traffic transmitted to the server and reduces the bandwidth requirements for data transmission between the terminal and the server.
在一个具体的例子中,在将画像差分值发送至服务端,以供服务端根据画像差分值更新服务端中用户的第二用户画像之后,还包括:获取服务端更新第二用户画像的结果,若结果为更新失败,则将画像差分值作为第一画像差分值;获取下次计算的画像差分值作为第二画像差分值;将第一画像差分值与第二画像差分值合并,得到第三画像差分值;将第三画像差分值发送至服务端,以供服务端根据第三画像差分值更新第二用户画像。In a specific example, after sending the portrait difference value to the server so that the server can update the second user portrait of the user in the server according to the portrait difference value, the method further includes: obtaining a result of updating the second user portrait by the server , if the result is an update failure, then the portrait differential value is used as the first portrait differential value; The portrait differential value calculated next time is obtained as the second portrait differential value; The first portrait differential value is merged with the second portrait differential value to obtain the first Three portrait differential values; sending the third portrait differential value to the server for the server to update the second user portrait according to the third portrait differential value.
可以理解的是,在获取到服务端更新第二用户画像的结果为失败后,可采用重传机制进行重传。可选地,也可以设置经过一段时间后再进行重传。但是,若更新第二用户画像的结果为失败,表明服务端此时的网络环境较差或处理能力不足,立即重传的结果大概率会是失败,而设置经过一段时间后重传则会增加终端与服务端传输数据的次数。因此,将更新失败的画像差分值与下次计算的画像差分值合并后再更新服务端中的第二用户画像,可以提高第二用户画像的更新成功率,且可以减少用户画像数据的传输次数,减少对服务端资源的占用。It can be understood that, after obtaining the result that the server fails to update the second user portrait, a retransmission mechanism can be used to retransmit. Optionally, retransmission can also be set after a period of time. However, if the result of updating the second user portrait is a failure, it indicates that the network environment of the server at this time is poor or the processing capability is insufficient, and the result of immediate retransmission will be a failure, and the retransmission will increase after a period of time. The number of times the terminal and the server transmit data. Therefore, updating the second user portrait in the server after merging the portrait difference value of the update failure with the portrait difference value calculated next time can improve the update success rate of the second user portrait and reduce the transmission times of the user portrait data. , reduce the occupation of server resources.
请参考图3,其为现有技术中用户画像更新的原理结构图。具体地,用户通过终端应用程序产生用户行为,采集服务器集群通过行为采集模块采集海量用户的用户记录,并形成各用户相应的行为记录表;将行为记录表发送至存储集群进行集中存储,再采用用户画像计算集群根据存储集群中的行为记录表进行用户画像的计算与更新;内容服务集群再根据计算和更新的用户画像进行内容的推荐等。由于需要部置存储集群存储海量用户的行为记录表,因此需要占用大量的存储资源;且采用用户画像计算集群进行用户画像的计算时,由于用户数量巨大,因此无论是基于流式的实时计算,还是定期批量的计算,均需要占用服务端大量的计算资源。进一步地,由于需要将用户的行为记录明细上传至服务端,因此会对用户造成隐私侵扰甚至明细数据泄漏的风险。另外,若用户画像的数据库丢失,则需要遍历所有行为记录表来还原用户画像的数据库,计算及时间成本巨大。Please refer to FIG. 3 , which is a schematic structural diagram of user portrait updating in the prior art. Specifically, the user generates user behavior through the terminal application, the collection server cluster collects user records of a large number of users through the behavior collection module, and forms a corresponding behavior record table for each user; the behavior record table is sent to the storage cluster for centralized storage, and then uses The user portrait computing cluster calculates and updates the user portrait according to the behavior record table in the storage cluster; the content service cluster then recommends content based on the calculated and updated user portrait. Since a storage cluster is required to store the behavior record tables of a large number of users, a large amount of storage resources are required; and when the user portrait computing cluster is used for the calculation of user portraits, due to the huge number of users, whether it is streaming-based real-time computing, Or periodic batch calculations, which require a lot of computing resources on the server side. Further, since the details of the user's behavior record need to be uploaded to the server, the risk of privacy intrusion or even detailed data leakage will be caused to the user. In addition, if the database of the user portrait is lost, it is necessary to traverse all the behavior record tables to restore the database of the user portrait, and the computational and time costs are huge.
请参考图4,其为本发明实施方式提供的用户画像更新方法的原理结构图。具体地,终端(APP)获取用户的行为记录并记录于终端本地,根据记录的行为记录计算并更新终端本地的用户画像,再计算用户画像的画像差分值,将画像差分值发送至画像服务器(服务端),画像服务器根据画像差分值更新画像服务器中的用户画像;内容服务集群根据画像服务器中的用户画像进行内容推荐等业务。由于用户的行为记录数据保存在终端本地,因此不需要占用服务端的存储资源;且在终端本地进行用户画像的计算,每个用户都使用各自的终端计算用户画像,因此不需要服务端部署大量的计算资源来进行用户画像的计算。进一步地,由于不需要将用户的行为记录数据发送至服务端,因此不会导致存在用户的敏感信息泄漏的风险;通过画像差分值更新服务端中的用户画像,使最终的用户画像数据无法还原出用户行为记录数据。另外,终端本地与服务端均保存有用户画像,两者互为备份,即使其中一个丢失,亦能通过另外一个找回,不会因为服务端中的用户画像的数据的丢失而付出巨大的计算代价。Please refer to FIG. 4 , which is a schematic structural diagram of a method for updating a user portrait provided by an embodiment of the present invention. Specifically, the terminal (APP) obtains the user's behavior record and records it locally, calculates and updates the local user portrait of the terminal according to the recorded behavior record, then calculates the portrait difference value of the user portrait, and sends the portrait difference value to the portrait server ( server), the portrait server updates the user portrait in the portrait server according to the portrait difference value; the content service cluster performs content recommendation and other services according to the user portrait in the portrait server. Since the user's behavior record data is stored locally on the terminal, it does not need to occupy the storage resources of the server; and the user portrait is calculated locally on the terminal, and each user uses its own terminal to calculate the user portrait, so there is no need to deploy a large number of servers on the server. Computing resources are used to calculate user portraits. Further, since there is no need to send the user's behavior record data to the server, there is no risk of leakage of the user's sensitive information; the user portrait in the server is updated through the portrait difference value, so that the final user portrait data cannot be restored. Record user behavior data. In addition, both the terminal and the server save user portraits, and the two are backups of each other. Even if one of them is lost, it can be retrieved through the other. It will not cost a huge amount of calculation due to the loss of the user portrait data in the server. cost.
与现有技术相比,本发明实施方式提供的用户画像更新方法,通过终端获取用户的行为记录并记录于终端中的行为记录表中,可以在终端保存用户的行为记录数据,使服务端不需要部署大量的存储资源进行行为记录数据的存储;通过在终端进行用户画像的计算和更新,使服务端不需要部署大量的计算资源进行用户画像的计算,占用服务端的资源较少;而通过预设时间间隔更新终端及服务端中的用户画像,则可以降低服务端中用户画像的更新频率,进一步减少对服务端的资源的占用;并且,在更新服务端中的用户画像时,采用画像差分值的形式进行更新,可以降低终端与服务端之间进行数据传输的带宽要求。Compared with the prior art, the user portrait update method provided by the embodiment of the present invention obtains the user's behavior record through the terminal and records it in the behavior record table in the terminal, and can save the user's behavior record data in the terminal, so that the server does not It is necessary to deploy a large number of storage resources for the storage of behavior record data; by calculating and updating user portraits on the terminal, the server does not need to deploy a large number of computing resources for the calculation of user portraits, occupying less resources on the server side; Setting the time interval to update the user portraits in the terminal and the server can reduce the update frequency of the user portraits in the server and further reduce the resource occupation of the server; and, when updating the user portraits in the server, the difference value of the portrait is used. It can be updated in the form of data transmission, which can reduce the bandwidth requirements for data transmission between the terminal and the server.
本发明的第二实施方式涉及一种用户画像更新方法。第二实施方式与第一实施方式大致相同,主要区别之处在于:在获取用户的行为记录并记录于终端中的行为记录表中之前,还包括:获取第一用户画像的时间戳作为第一时间戳、获取第二用户画像的时间戳作为第二时间戳,若第一时间戳大于第二时间戳,则将第一用户画像发送至服务端,以供服务端根据第一用户画像更新第二用户画像;若第一时间戳小于第二时间戳,则从服务端获取第二用户画像,根据第二用户画像更新第一用户画像。The second embodiment of the present invention relates to a method for updating a user portrait. The second embodiment is roughly the same as the first embodiment, and the main difference is that: before acquiring the user's behavior record and recording it in the behavior record table in the terminal, it also includes: acquiring the timestamp of the first user portrait as the first The timestamp and the timestamp obtained from the second user portrait are taken as the second timestamp. If the first timestamp is greater than the second timestamp, the first user portrait is sent to the server, so that the server can update the first user portrait according to the first user portrait. Two user portraits; if the first timestamp is less than the second timestamp, obtain the second user portrait from the server, and update the first user portrait according to the second user portrait.
本发明实施方式提供的用户画像更新方法的具体流程如图5所示,具体包括以下步骤:The specific process of the user portrait update method provided by the embodiment of the present invention is shown in FIG. 5 , and specifically includes the following steps:
S201:获取第一用户画像的时间戳作为第一时间戳、获取第二用户画像的时间戳作为第二时间戳。S201: Acquire the timestamp of the first user portrait as the first timestamp, and obtain the timestamp of the second user portrait as the second timestamp.
S202:判断第一时间戳是否大于第二时间戳,若第一时间戳大于第二时间戳,则进入S203;若第一时间戳小于或等于第二时间戳,则进入S204。S202: Determine whether the first time stamp is greater than the second time stamp, if the first time stamp is greater than the second time stamp, go to S203; if the first time stamp is less than or equal to the second time stamp, go to S204.
S203:将第一用户画像发送至服务端,以供服务端根据第一用户画像更新第二用户画像。S203: Send the first user portrait to the server, so that the server can update the second user portrait according to the first user portrait.
S204:判断第一时间戳是否小于第二时间戳,若第一时戳小于第二时间戳,则进入S205,若第一时间戳等于第二时间戳,则进入S206。S204: Determine whether the first time stamp is smaller than the second time stamp, if the first time stamp is smaller than the second time stamp, go to S205, and if the first time stamp is equal to the second time stamp, go to S206.
S205:从服务端获取第二用户画像,根据第二用户画像更新第一用户画像。S205: Obtain the second user portrait from the server, and update the first user portrait according to the second user portrait.
S206:获取用户的行为记录并记录于终端中的行为记录表中。S206: Acquire the user's behavior record and record it in the behavior record table in the terminal.
S207:根据行为记录表以预设时间间隔计算并更新终端中用户的第一用户画像。S207: Calculate and update the first user portrait of the user in the terminal at preset time intervals according to the behavior record table.
S208:计算第一用户画像的画像差分值,其中,画像差分值为相较于前一时刻的用户画像的差分值。S208: Calculate the difference value of the portrait of the first user portrait, where the difference value of the portrait is a difference value compared with the user portrait at the previous moment.
S209:将画像差分值发送至服务端,以供服务端根据画像差分值更新服务端中用户的第二用户画像。S209: Send the portrait difference value to the server, so that the server can update the second user portrait of the user in the server according to the portrait difference value.
其中,S206-S209与第一实施方式中的S101-S104相同,具体可参见第一实施方式中的描述,为了减少重复,这里不再赘述。Wherein, S206-S209 are the same as S101-S104 in the first embodiment. For details, please refer to the description in the first embodiment. In order to reduce repetition, details are not repeated here.
对于S201-S205,具体地,终端在启动应用程序后,获取终端本地的第一用户画像的时间戳作为第一时间戳、获取服务端的第二用户画像的时间戳作为第二时间戳;然后判断第一时间戳是否大于第二时间戳,若第一时间戳大于第二时间戳,表明终端本地的第一用户画像是最新的,则将第一用户画像发送至服务端,使服务端根据第一用户画像更新第二用户画像,并在服务端更新完第二用户画像后进入S206;若第一时间戳小于或等于第二时间戳,则进一步判断第一时间戳是否小于第二时间戳;若第一时间戳小于第二时间戳,则表明服务端的第二用户画像是最新的,则终端从服务端获取第二用户画像,根据第二用户画像更新第一用户画像,在终端更新完第一用户画像后进入S206;若第一时间戳等于第二时间戳,表明终端和服务端的用户画像均为最新的,则直接进入S206。For S201-S205, specifically, after starting the application, the terminal obtains the timestamp of the first user portrait locally on the terminal as the first timestamp, and obtains the timestamp of the second user portrait on the server as the second timestamp; and then judges Whether the first time stamp is greater than the second time stamp, if the first time stamp is greater than the second time stamp, it indicates that the local first user portrait of the terminal is the latest, then the first user portrait is sent to the server, so that the server can A user portrait updates the second user portrait, and enters S206 after the server updates the second user portrait; if the first time stamp is less than or equal to the second time stamp, further determine whether the first time stamp is less than the second time stamp; If the first timestamp is less than the second timestamp, it indicates that the second user portrait on the server is the latest, and the terminal obtains the second user portrait from the server, updates the first user portrait according to the second user portrait, and after the terminal updates the first user portrait Enter S206 after a user portrait; if the first time stamp is equal to the second time stamp, indicating that the user portraits of the terminal and the server are both up-to-date, go directly to S206.
可选地,在根据第一用户画像更新第二用户画像,或根据第二用户画像更新第一用户画像时,可以通过用户画像的替换来完成更新。由于需要将用户画像在终端与服务端进行传输,为了保护用户的信息安全,可以设置相应的加密算法后再进行传输,具体的加密算法可以根据需要进行设置,这里不做具体限定。Optionally, when the second user portrait is updated according to the first user portrait, or the first user portrait is updated according to the second user portrait, the update may be completed by replacing the user portrait. Since the user portrait needs to be transmitted between the terminal and the server, in order to protect the user's information security, the corresponding encryption algorithm can be set before transmission, and the specific encryption algorithm can be set as needed, which is not specifically limited here.
可选地,第一时间戳可以在第一用户画像更新时获取时间戳进行更新。第二时间戳可在更新第二用户画像时,根据第一时间戳更新,以使服务端中的第二用户画像更新成功后,终端与服务端的用户画像的时间戳一致,以便根据时间戳来完成终端与服务端中的用户画像的同步。Optionally, the first timestamp may be updated by obtaining a timestamp when the first user portrait is updated. The second time stamp can be updated according to the first time stamp when the second user portrait is updated, so that after the second user portrait in the server is successfully updated, the time stamps of the user portraits of the terminal and the server are consistent, so that according to the time stamps Complete the synchronization of user portraits in the terminal and the server.
请参考图6,其为本发明实施方式提供的用户画像更新方法的一具体流程示例图。具体地,终端APP启动,初始化动态时间间隔;用户使用APP,当用户的行为记录数据写入时,将触发开关打开,开始动态时间间隔的计算;根据动态时间间隔进行判断,判断动态时间间隔的时长是否已到,若未到动态时间间隔的时长,则继续休眠;若动态时间间隔的时长已到,则触发终端本地的用户画像计算流程;进行用户画像计算流程后,计算画像差分值并传输至服务端(画像服务器),再次计算动态时间间隔,更新动态时间间隔。在进行用户画像计算后,更新本地画像的时间戳,并删除本地行为记录表的行为记录数据,判断行为记录数据是否为空,若为空,则将触发开关关闭。Please refer to FIG. 6 , which is a specific flowchart of a method for updating a user portrait provided by an embodiment of the present invention. Specifically, the terminal APP is started, and the dynamic time interval is initialized; when the user uses the APP, when the user's behavior record data is written, the trigger switch is turned on, and the calculation of the dynamic time interval starts; Whether the duration has expired, if the duration of the dynamic time interval is not reached, it will continue to sleep; if the duration of the dynamic time interval has expired, the terminal's local user portrait calculation process will be triggered; after the user portrait calculation process, the portrait difference value will be calculated and transmitted. Go to the server (image server), calculate the dynamic time interval again, and update the dynamic time interval. After calculating the user portrait, update the timestamp of the local portrait, delete the behavior record data in the local behavior record table, and determine whether the behavior record data is empty. If it is empty, the trigger switch will be turned off.
与现有技术相比,本发明实施方式提供的用户画像更新方法,通过在获取用户的行为记录并记录于终端中的行为记录表中之前,获取第一用户画像的第一时间戳和获取第二用户画像的第二时间戳进行比较,在第一时间戳大于第二时间戳时,根据第一用户画像更新第二用户画像;在第一时间戳小于第二时间戳时,根据第二用户画像更新第一用户画像,可以实现终端与服务端中用户画像的同步,有利于后续采用画像差分值进行用户画像的计算与更新,保证用户画像计算的准确度;同时,通过终端与服务端中用户画像的同步,可以使用户方便在多个终端使用相同的应用程序,亦可以使在终端或服务端中的用户画像丢失后,可以通过另外一个作为备份进行用户画像的恢复。Compared with the prior art, the user portrait update method provided by the embodiment of the present invention obtains the first time stamp of the first user portrait and obtains the first time stamp of the first user portrait before obtaining the user's behavior record and recording it in the behavior record table in the terminal. The second timestamps of the two user portraits are compared, and when the first timestamp is greater than the second timestamp, the second user portrait is updated according to the first user portrait; when the first timestamp is less than the second timestamp, the second user portrait is updated according to the The update of the first user portrait by the portrait can realize the synchronization of the user portrait in the terminal and the server, which is conducive to the subsequent calculation and update of the user portrait by using the portrait difference value, and ensures the accuracy of the user portrait calculation; at the same time, through the terminal and the server. The synchronization of user portraits can make it convenient for users to use the same application program on multiple terminals, and can also restore user portraits by using another one as a backup after the user portrait in the terminal or server is lost.
上面各种方法的步骤划分,只是为了描述清楚,实现时可以合并为一个步骤或者对某些步骤进行拆分,分解为多个步骤,只要包含相同的逻辑关系,都在本专利的保护范围内;对算法中或者流程中添加无关紧要的修改或者引入无关紧要的设计,但不改变其算法和流程的核心设计都在该专利的保护范围内。The step division of the above various methods is only for the purpose of describing clearly. During implementation, it can be combined into one step or some steps can be split and decomposed into multiple steps, as long as they contain the same logical relationship, they are all within the protection scope of this patent. ;Adding insignificant modifications to the algorithm or process or introducing insignificant designs, but not changing the core design of the algorithm and process are all within the scope of protection of this patent.
本发明第三实施方式涉及一种用户画像更新系统300,如图7所示,包含:终端301和服务端302。The third embodiment of the present invention relates to a user
终端301用于获取用户的行为记录并记录于终端301中的行为记录表中,根据行为记录表以预设时间间隔计算并更新终端301中用户的第一用户画像,并计算第一用户画像的画像差分值,将画像差分值发送至服务端302,其中,画像差分值为相较于前一时刻的用户画像的差分值;The terminal 301 is used to obtain the user's behavior record and record it in the behavior record table in the terminal 301, calculate and update the first user portrait of the user in the terminal 301 at preset time intervals according to the behavior record table, and calculate the value of the first user portrait. Portrait difference value, sending the portrait difference value to the
服务端302用于根据画像差分值更新服务端302中用户的第二用户画像。The
进一步地,终端301还用于:获取第一用户画像的时间戳作为第一时间戳、获取第二用户画像的时间戳作为第二时间戳;若第一时间戳大于第二时间戳,则将第一用户画像发送至服务端302;若第一时间戳小于第二时间戳,则从服务端302获取第二用户画像,根据第二用户画像更新第一用户画像;服务端302还用于在第一时间戳大于第二时间戳,且接收到第一用户画像时,根据第一用户画像更新第二用户画像。Further, the terminal 301 is further configured to: obtain the timestamp of the first user portrait as the first timestamp, and obtain the timestamp of the second user portrait as the second timestamp; if the first timestamp is greater than the second timestamp, then The first user portrait is sent to the
进一步地,预设时间间隔为动态时间间隔,动态时间间隔与服务端302的传输速度负相关。Further, the preset time interval is a dynamic time interval, and the dynamic time interval is negatively correlated with the transmission speed of the
进一步地,根据以下计算公式计算动态时间间隔:Further, the dynamic time interval is calculated according to the following calculation formula:
Δt=t0-t0*α1/R;Δt=t 0 −t 0 *α 1/R ;
其中,Δt为动态时间间隔,t0为预设的最大时间间隔,α为常数且0<α<1,R为服务端302的传输速度。Among them, Δt is the dynamic time interval, t 0 is the preset maximum time interval, α is a constant and 0<α<1, and R is the transmission speed of the
进一步地,终端301还用于:当行为记录表中的行为记录数据更新时,开始动态时间间隔的时长计算。Further, the terminal 301 is further configured to start the calculation of the duration of the dynamic time interval when the behavior record data in the behavior record table is updated.
进一步地,终端301还用于:将行为记录表中更新第一用户画像所用及的行为记录数据删除;若行为记录表中的行为记录数据为空,则停止动态时间间隔的时长计算。Further, the terminal 301 is further configured to: delete the behavior record data used for updating the first user portrait in the behavior record table; if the behavior record data in the behavior record table is empty, stop the calculation of the duration of the dynamic time interval.
进一步地,终端301还用于:获取服务端302更新第二用户画像的结果,若结果为更新失败,则将画像差分值作为第一画像差分值;获取下次计算的画像差分值作为第二画像差分值;将第一画像差分值与第二画像差分值合并,得到第三画像差分值;将第三画像差分值发送至服务端302;服务端302还用于根据第三画像差分值更新第二用户画像。Further, the terminal 301 is also used to: obtain the result of updating the second user portrait by the
不难发现,本实施方式为与第一实施方式及第二实施方式相对应的系统实施例,本实施方式可与第一实施方式及第二实施方式互相配合实施。第一实施方式及第二实施方式中提到的相关技术细节在本实施方式中依然有效,为了减少重复,这里不再赘述。相应地,本实施方式中提到的相关技术细节也可应用在第一实施方式中。It is not difficult to find that this embodiment is a system example corresponding to the first embodiment and the second embodiment, and this embodiment can be implemented in cooperation with the first embodiment and the second embodiment. The related technical details mentioned in the first embodiment and the second embodiment are still valid in this embodiment, and are not repeated here in order to reduce repetition. Correspondingly, the related technical details mentioned in this embodiment can also be applied to the first embodiment.
值得一提的是,本实施方式中所涉及到的各模块均为逻辑模块,在实际应用中,一个逻辑单元可以是一个物理单元,也可以是一个物理单元的一部分,还可以以多个物理单元的组合实现。此外,为了突出本发明的创新部分,本实施方式中并没有将与解决本发明所提出的技术问题关系不太密切的单元引入,但这并不表明本实施方式中不存在其它的单元。It is worth mentioning that each module involved in this embodiment is a logical module. In practical applications, a logical unit may be a physical unit, a part of a physical unit, or multiple physical units. A composite implementation of the unit. In addition, in order to highlight the innovative part of the present invention, this embodiment does not introduce units that are not closely related to solving the technical problem proposed by the present invention, but this does not mean that there are no other units in this embodiment.
本发明第四实施方式涉及一种网络设备,如图8所示,包括至少一个处理器401;以及,与至少一个处理器401通信连接的存储器402;其中,存储器402存储有可被至少一个处理器401执行的指令,指令被至少一个处理器401执行,以使至少一个处理器401能够执行上述的用户画像更新方法。The fourth embodiment of the present invention relates to a network device. As shown in FIG. 8 , it includes at least one
其中,存储器402和处理器401采用总线方式连接,总线可以包括任意数量的互联的总线和桥,总线将一个或多个处理器401和存储器402的各种电路连接在一起。总线还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路连接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。总线接口在总线和收发机之间提供接口。收发机可以是一个元件,也可以是多个元件,比如多个接收器和发送器,提供用于在传输介质上与各种其他装置通信的单元。经处理器401处理的数据通过天线在无线介质上进行传输,进一步,天线还接收数据并将数据传送给处理器401。The
处理器401负责管理总线和通常的处理,还可以提供各种功能,包括定时,外围接口,电压调节、电源管理以及其他控制功能。而存储器402可以被用于存储处理器401在执行操作时所使用的数据。
本发明第五实施方式涉及一种计算机可读存储介质,存储有计算机程序。计算机程序被处理器执行时实现上述方法实施例。A fifth embodiment of the present invention relates to a computer-readable storage medium storing a computer program. The above method embodiments are implemented when the computer program is executed by the processor.
即,本领域技术人员可以理解实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-OnlyMemory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。That is, those skilled in the art can understand that all or part of the steps in the method of the above-mentioned embodiments can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium and includes several instructions to make a device (which can be It is a single chip microcomputer, a chip, etc.) or a processor (processor) that executes all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, removable hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes.
本领域的普通技术人员可以理解,上述各实施方式是实现本发明的具体实施例,而在实际应用中,可以在形式上和细节上对其作各种改变,而不偏离本发明的精神和范围。Those skilled in the art can understand that the above-mentioned embodiments are specific examples for realizing the present invention, and in practical applications, various changes in form and details can be made without departing from the spirit and the spirit of the present invention. scope.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010293572.9A CN111523026B (en) | 2020-04-15 | 2020-04-15 | User portrait update method, system, network equipment and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010293572.9A CN111523026B (en) | 2020-04-15 | 2020-04-15 | User portrait update method, system, network equipment and storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN111523026A true CN111523026A (en) | 2020-08-11 |
| CN111523026B CN111523026B (en) | 2023-10-17 |
Family
ID=71901367
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010293572.9A Active CN111523026B (en) | 2020-04-15 | 2020-04-15 | User portrait update method, system, network equipment and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111523026B (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119048147A (en) * | 2024-10-31 | 2024-11-29 | 北京同方凌讯科技有限公司 | User portrait generation method and system based on behavior data |
Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2000330679A (en) * | 1999-05-21 | 2000-11-30 | Sony Corp | Information processing apparatus and method, medium |
| CN103188097A (en) * | 2011-12-30 | 2013-07-03 | 金蝶软件(中国)有限公司 | Method, device and system achieving patch management |
| US20140156539A1 (en) * | 2012-08-17 | 2014-06-05 | CrowdCare Corporation | Device Profile-Based Rule Making for Customer Care |
| CN104750731A (en) * | 2013-12-30 | 2015-07-01 | 华为技术有限公司 | Method and device for obtaining complete user portrait |
| CN105005587A (en) * | 2015-06-26 | 2015-10-28 | 深圳市腾讯计算机系统有限公司 | User portrait updating method, apparatus and system |
| CN106557335A (en) * | 2015-09-28 | 2017-04-05 | 网易(杭州)网络有限公司 | The update method of application program, apparatus and system |
| CN108133013A (en) * | 2017-12-22 | 2018-06-08 | 平安养老保险股份有限公司 | Information processing method, device, computer equipment and storage medium |
| WO2019242331A1 (en) * | 2018-06-20 | 2019-12-26 | 华为技术有限公司 | User behavior prediction method and apparatus, and behavior prediction model training method and apparatus |
-
2020
- 2020-04-15 CN CN202010293572.9A patent/CN111523026B/en active Active
Patent Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2000330679A (en) * | 1999-05-21 | 2000-11-30 | Sony Corp | Information processing apparatus and method, medium |
| CN103188097A (en) * | 2011-12-30 | 2013-07-03 | 金蝶软件(中国)有限公司 | Method, device and system achieving patch management |
| US20140156539A1 (en) * | 2012-08-17 | 2014-06-05 | CrowdCare Corporation | Device Profile-Based Rule Making for Customer Care |
| CN104750731A (en) * | 2013-12-30 | 2015-07-01 | 华为技术有限公司 | Method and device for obtaining complete user portrait |
| CN105005587A (en) * | 2015-06-26 | 2015-10-28 | 深圳市腾讯计算机系统有限公司 | User portrait updating method, apparatus and system |
| CN106557335A (en) * | 2015-09-28 | 2017-04-05 | 网易(杭州)网络有限公司 | The update method of application program, apparatus and system |
| CN108133013A (en) * | 2017-12-22 | 2018-06-08 | 平安养老保险股份有限公司 | Information processing method, device, computer equipment and storage medium |
| WO2019242331A1 (en) * | 2018-06-20 | 2019-12-26 | 华为技术有限公司 | User behavior prediction method and apparatus, and behavior prediction model training method and apparatus |
Non-Patent Citations (1)
| Title |
|---|
| 张雨: "一种用户行为数据管理平台的设计与实现" * |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119048147A (en) * | 2024-10-31 | 2024-11-29 | 北京同方凌讯科技有限公司 | User portrait generation method and system based on behavior data |
| CN119048147B (en) * | 2024-10-31 | 2025-05-13 | 北京同方凌讯科技有限公司 | User portrait generation method and system based on behavior data |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111523026B (en) | 2023-10-17 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US10121169B2 (en) | Table level distributed database system for big data storage and query | |
| US10606806B2 (en) | Method and apparatus for storing time series data | |
| US9292387B2 (en) | Medium, control method, and information processing apparatus | |
| US10242388B2 (en) | Systems and methods for efficiently selecting advertisements for scoring | |
| CN103853671B (en) | A kind of data write-in control method and device | |
| CN113438275A (en) | Data migration method and device, storage medium and data migration equipment | |
| CN109947668A (en) | The method and apparatus of storing data | |
| CN107092628B (en) | Method and device for processing time series data | |
| CN104038908A (en) | Push message sending method and device | |
| CN115469813A (en) | Data processing method and device, storage medium and electronic device | |
| CN114945026A (en) | Data processing method, device and system | |
| CN110704422A (en) | Data query method, device, system, computer equipment and storage medium | |
| CN107346270A (en) | Method and system based on the sets cardinal calculated in real time | |
| CN111984628A (en) | Database statistical information collection method, device, medium and electronic equipment | |
| CN118672499A (en) | Data storage method, device, electronic equipment and readable storage medium | |
| CN110875885A (en) | Message processing method, server, terminal, system and storage medium | |
| CN104424246A (en) | Data storage system and method | |
| CN111523026B (en) | User portrait update method, system, network equipment and storage medium | |
| CN120492231B (en) | Database data processing method, device, equipment and storage medium | |
| US20220335567A1 (en) | Systems and methods for capturing user consumption of information | |
| CN115082038A (en) | System integration method, device and electronic device | |
| CN113872994B (en) | Organization architecture synchronization method, device, computer equipment and storage medium | |
| CN114928610A (en) | Data update notification method, data processing method, device, equipment and medium | |
| CN118540371A (en) | Cluster resource management method and device, storage medium and electronic equipment | |
| CN112052077A (en) | Method, device, equipment and medium for software task management |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |

