CN113780479A - Periodic prediction model training method and device, and periodic prediction method and equipment - Google Patents

Periodic prediction model training method and device, and periodic prediction method and equipment Download PDF

Info

Publication number
CN113780479A
CN113780479A CN202111272810.9A CN202111272810A CN113780479A CN 113780479 A CN113780479 A CN 113780479A CN 202111272810 A CN202111272810 A CN 202111272810A CN 113780479 A CN113780479 A CN 113780479A
Authority
CN
China
Prior art keywords
historical
period
user
repurchase
prediction model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111272810.9A
Other languages
Chinese (zh)
Inventor
吴长发
仲济源
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202111272810.9A priority Critical patent/CN113780479A/en
Publication of CN113780479A publication Critical patent/CN113780479A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/284Lexical analysis, e.g. tokenisation or collocates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/04Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/06Buying, selling or leasing transactions
    • G06Q30/0601Electronic shopping [e-shopping]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Strategic Management (AREA)
  • Evolutionary Computation (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Human Resources & Organizations (AREA)
  • Mathematical Physics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Software Systems (AREA)
  • General Business, Economics & Management (AREA)
  • Biomedical Technology (AREA)
  • Computing Systems (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Development Economics (AREA)
  • Molecular Biology (AREA)
  • Biophysics (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Game Theory and Decision Science (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Operations Research (AREA)
  • Quality & Reliability (AREA)
  • Tourism & Hospitality (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The disclosure relates to a training method and a device of a period prediction model, a period prediction method and equipment, relating to the technical field of machine learning, wherein the method comprises the following steps: calculating a historical order behavior sequence of a historical user and an actual repurchase period of historical articles included in a historical order according to historical user data; constructing a data set according to the historical articles, the actual repurchase period, the historical order behavior sequence and the historical user portrait in the historical user data; inputting historical articles, historical order behavior sequences and historical user figures included in the data set into a period prediction model to be trained to obtain a prediction repurchase period of the historical articles; and constructing a first loss function according to the actual repurchase period and the predicted repurchase period in the data set, and training the to-be-trained periodic prediction model by using the first loss function to obtain a trained periodic prediction model. The method improves the accuracy of the periodic prediction model.

Description

Periodic prediction model training method and device, and periodic prediction method and equipment
Technical Field
The embodiment of the disclosure relates to the technical field of machine learning, and in particular relates to a training method of a period prediction model, a training device of the period prediction model, a period prediction method, a computer-readable storage medium and an electronic device.
Background
In the existing periodic prediction model, it can be implemented by adopting a DNN (Deep Neural Networks) model with a three-layer fully-connected Neural network structure. Specifically, in the training process, the user information features and the corresponding item information features (e.g., item identifiers, item prices, and item numbers) may be used as input of the DNN model, and the repurchase period of the user for the items may be obtained through calculation of the neural network.
Meanwhile, when the DNN model is trained, a loss function can be constructed according to an output result of the user-commodity repurchase period model and the repurchase period real value, and the loss function is optimized according to the minimum value to update the network weight parameters, so that a trained period prediction model is obtained.
However, in the above training method for the period prediction model, the historical order behavior sequence of the user is not considered, so that the accuracy of the output result of the repurchase period model is low, and the accuracy of the model is low.
Therefore, it is desirable to provide a new training method and apparatus for the period prediction model.
It is to be noted that the information invented in the background section above is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
An object of the present disclosure is to provide a method and an apparatus for training a period prediction model, a period prediction method, a computer-readable storage medium, and an electronic device, which overcome, at least to some extent, the problem of low accuracy of the period prediction model due to limitations and disadvantages of the related art.
According to an aspect of the present disclosure, there is provided a method for training a period prediction model, including:
calculating a historical order behavior sequence of a historical user and an actual repurchase period of historical articles included in a historical order according to historical user data;
constructing a data set according to the historical articles, the actual repurchase period, the historical order behavior sequence and the historical user portrait in the historical user data;
inputting historical articles, historical order behavior sequences and historical user figures included in the data set into a period prediction model to be trained to obtain a prediction repurchase period of the historical articles;
and constructing a first loss function according to the actual repurchase period and the predicted repurchase period in the data set, and training the to-be-trained periodic prediction model by using the first loss function to obtain a trained periodic prediction model.
In an exemplary embodiment of the present disclosure, calculating a historical order activity sequence of a historical user from historical user data includes:
acquiring historical user data of a historical user in a first preset time period according to a user identifier of the historical user;
extracting historical articles included in the historical user data, and performing aggregation processing on the historical articles according to category identifications of the historical articles to obtain categories of different levels to which the historical articles belong;
summing the number of the historical articles to obtain the purchase number of the historical articles, and calculating the time position characteristics of the historical articles according to the initial purchase time and the final purchase time of the historical articles;
and generating the historical order behavior sequence according to the categories, purchase quantities and time and position characteristics of different levels to which the historical articles belong.
In an exemplary embodiment of the present disclosure, calculating an actual repurchase period of historical items included in a historical order from historical user data includes:
extracting a first purchase time node of a historical item included in the historical order and a last purchase time node corresponding to the first purchase time node from the historical user data;
calculating the current purchase cycle of the historical item according to the first purchase time node and the last purchase time node corresponding to the first purchase time node;
and carrying out normalization processing on the current purchasing period to obtain the actual purchasing period of the historical articles.
In an exemplary embodiment of the present disclosure, the periodic prediction model to be trained includes a first word embedding layer, a second word embedding layer, an attention mechanism layer, and a logistic regression layer;
inputting historical articles, historical order behavior sequences and historical user figures included in the data set into a period prediction model to be trained to obtain a prediction repurchase period of the historical articles, wherein the period prediction model comprises:
the historical object and the historical order behavior sequence are coded by the first word embedding layer to obtain object characteristics and behavior sequence characteristics, and the historical user portrait is coded by the second word embedding layer to obtain user characteristics;
processing the behavior sequence features and the article features by using the attention mechanism layer to obtain a repurchase behavior vector of the historical user to the historical articles;
and performing logistic regression processing on the repurchase behavior vector, the article characteristics and the user characteristics by using the logistic regression layer to obtain the predicted repurchase period.
In an exemplary embodiment of the present disclosure, processing the behavior sequence feature and the article feature to obtain a repurchase behavior vector of the historical user on the historical article includes:
performing a first operation on the behavior sequence characteristic and the article characteristic to obtain a first output result; wherein the first operation comprises an inner product operation and a subtraction operation;
splicing the first output result, the behavior sequence characteristics and the article characteristics to obtain a first splicing result;
processing the first splicing result by utilizing a first multilayer fully-connected neural network included in the attention mechanism layer to obtain the attention weight of the historical item;
and carrying out weighted summation on the attention weight and the item characteristics to obtain the repurchase behavior vector.
In an exemplary embodiment of the present disclosure, the training method of the period prediction model further includes:
coding categories, purchase quantity and time position characteristics of different levels to which the historical articles belong based on Word2vec to obtain a first sub-vector, a second sub-vector and a third sub-vector;
performing feature splicing on the first sub-vector, the second sub-vector and the third sub-vector to obtain an order sequence of the historical user, and performing accompanying covering on any sub-vector in the order sequence to obtain a sequence to be processed;
predicting the sequence to be processed through a Bert model to be trained to obtain a first prediction result, and constructing a second loss function for the Bert model through the first prediction result and the covered sub-vectors;
and training the Bert model to be trained by using the second loss function, and fusing the trained Bert model into a second word embedding layer to obtain the first word embedding layer.
In an exemplary embodiment of the present disclosure, the Bert model includes a plurality of transform models;
predicting the sequence to be processed through a Bert model to be trained to obtain a first prediction result, wherein the method comprises the following steps:
inputting the sequence to be processed into a first Transformer model to generate a first text semantic vector, and inputting the first text semantic vector into other Transformer models to obtain text semantic vectors corresponding to other Transformer models; wherein, in the other Transformer models, the output of the previous Transformer model is the input of the next Transformer model corresponding to the output of the previous Transformer model;
and calculating the importance degree of each Transformer model to the sequence to be processed, and obtaining the first prediction result according to each importance degree and each text semantic vector.
In an exemplary embodiment of the present disclosure, performing logistic regression processing on the repurchase behavior vector, the item feature, and the user feature to obtain the predicted repurchase period includes:
splicing and tiling the repurchase behavior vector, the article characteristics and the user characteristics to obtain a second splicing result;
projecting the second splicing result to a high-dimensional space by using a second multilayer fully-connected neural network included in the logistic regression layer to obtain a high-dimensional projection result;
and carrying out nonlinear activation on the high-dimensional projection result to obtain the prediction repurchase period.
According to an aspect of the present disclosure, there is provided a period prediction method including:
acquiring target user data of a target user according to a user identifier of the target user, and calculating a target order behavior sequence of the target user according to the target user data;
determining a target object from the target order, and inputting the target object, a target order behavior sequence and a target user figure included in the target user data into a trained period prediction model to obtain a repeat purchasing period of the target object by the target user; the trained periodic prediction model is obtained by training a periodic prediction model to be trained through any one of the above training methods of the periodic prediction model;
and calculating the next recommendation time of the target item based on the re-purchase period and the last purchase time of the target user for the target item, and recommending the target item based on the next recommendation time.
According to an aspect of the present disclosure, there is provided a training apparatus of a period prediction model, including:
the first calculation module is used for calculating a historical order behavior sequence of a historical user and an actual repurchase cycle of historical articles included in a historical order according to historical user data;
the data set construction module is used for constructing a data set according to the historical articles, the actual repurchase period, the historical order behavior sequence and the historical user portrait in the historical user data;
the repurchase cycle prediction module is used for inputting historical articles, historical order behavior sequences and historical user figures included in the data set into a cycle prediction model to be trained to obtain the predicted repurchase cycle of the historical articles;
and the period prediction model training module is used for constructing a first loss function according to the actual repurchase period and the predicted repurchase period in the data set, and training the period prediction model to be trained by using the first loss function to obtain the trained period prediction model.
According to an aspect of the present disclosure, there is provided a period prediction apparatus including:
the second calculation module is used for acquiring target user data of a target user according to the user identification of the target user and calculating a target order behavior sequence of the target user according to the target user data;
the repurchase cycle prediction module is used for determining a target object from the target order, and inputting the target object, a target order behavior sequence and a target user portrait included in the target user data into a trained cycle prediction model to obtain the repurchase cycle of the target object by the target user; the trained periodic prediction model is obtained by training a periodic prediction model to be trained through any one of the above training methods of the periodic prediction model;
and the item recommending module is used for calculating the next recommending time of the target item based on the re-purchasing period and the last purchasing time of the target user for the target item, and recommending the target item based on the next recommending time.
According to an aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of training a cycle prediction model according to any one of the above and a method of predicting a cycle according to the above.
According to an aspect of the present disclosure, there is provided an electronic device including:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to execute the method for training the cycle prediction model and the cycle prediction method via executing the executable instructions.
According to the training method of the periodic prediction model provided by the embodiment of the disclosure, on one hand, as the historical order behavior sequence is considered in the training process of the periodic prediction model, the problem that in the prior art, as the historical order behavior sequence of a user is not considered, the accuracy of the output result of the repeated purchase periodic model is lower, and the accuracy of the model is lower is solved; on the other hand, the historical order behavior sequence of the historical user and the actual repurchase period of the historical articles included in the historical order are calculated according to the historical user data; constructing a data set according to historical articles, an actual repurchase period, a historical order behavior sequence and a historical user portrait in historical user data; inputting historical articles, historical order behavior sequences and historical user figures included in the data set into a period prediction model to be trained to obtain a prediction repurchase period of the historical articles; and finally, constructing a first loss function according to the actual repurchase period and the predicted repurchase period in the data set, and training the to-be-trained period prediction model by using the first loss function to obtain the trained period prediction model, so that the fitting capability of the period prediction model is improved, and the accuracy of the period prediction model is further improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty.
Fig. 1 schematically illustrates a flow chart of a method of training a periodic prediction model according to an example embodiment of the present disclosure.
FIG. 2 schematically illustrates an example of a mechanism of a cyclic prediction model according to an example embodiment of the present disclosure.
Fig. 3 schematically illustrates a flowchart of a method for inputting historical articles, historical order behavior sequences, and historical user figures included in the data set into a period prediction model to be trained to obtain a predicted repurchase period of the historical articles according to an exemplary embodiment of the present disclosure.
Fig. 4 schematically illustrates a flow chart of a method for generating a first word embedding layer according to an example embodiment of the present disclosure.
FIG. 5 schematically illustrates a structural example diagram of a Bert model according to an example embodiment of the present disclosure.
FIG. 6 schematically illustrates a flow chart of another method of training a periodic prediction model according to an example embodiment of the present disclosure.
Fig. 7 schematically illustrates a flow chart of a cycle prediction method according to an example embodiment of the present disclosure.
Fig. 8 schematically illustrates a block diagram of a training apparatus for a period prediction model according to an example embodiment of the present disclosure.
Fig. 9 schematically illustrates a block diagram of a period prediction apparatus according to an example embodiment of the present disclosure.
Fig. 10 schematically illustrates an electronic device for implementing the above-described training method of the period prediction model and the period prediction method according to an example embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and the like. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
With the development of the e-commerce platform becoming mature, the e-commerce increasingly attaches importance to each customer for fine operation, mainly enhances the viscosity of old users, and adopts a method of mining new users as assistance, so that the method gradually becomes a necessary condition for the continuous and stable growth of the e-commerce platform; therefore, it is an indispensable means for implementing this condition to recommend products accurately for the user and enhance the user experience. The problem of repurchase is one of the user experience problems in the recommendation system, and needs to be solved urgently.
Specifically, in the re-purchasing problem, the recommendation system tends to recommend similar commodities recently purchased by the user in the e-commerce scene, for example, the user often feeds back that commodities such as a range hood and an electric vehicle are recently purchased when shopping on the e-commerce platform, but the e-commerce platform continues to recommend related commodities such as the range hood and the electric vehicle, and the related commodities can be stably reproduced, so that the user experience is seriously influenced, and the user loss is easily caused.
A common approach to solving the problem of repurchase is to construct a repurchase cycle portrait of the user. The repurchase cycle refers to the time interval of repurchase of a user to a certain type of goods, for example, if a certain user purchases milk once in 30 days, the repurchase cycle of the user to milk is 30 days. The recommendation system solves the problem of repurchase in two stages of recall and sorting respectively. In the recalling stage, filtering recently bought commodities by using a user repurchase period; in the sequencing stage, a repurchase period is used as a fine model characteristic, the machine learning model is input for training, a repurchase date of a user is close to the commodity according to the repurchase period, and the repurchase date of the recently purchased commodity is reduced, so that the sequencing result is influenced, and the user experience is improved.
The conventional re-purchasing cycle portraits may commonly include: and calculating the user repurchase period based on normal distribution. Specifically, the method comprises the steps of firstly, conducting descending order arrangement on historical order information of the purchased products according to a user, and calculating the time difference value of every two adjacent purchases of the purchased products by the user; calculating the mean and variance of the time difference values according to the purchase interval; calculating a screening interval through the mean value and the variance of the time difference value, wherein the screening interval is [ mean value-variance, mean value + variance ]; eliminating data of which the time difference does not belong to the screening interval to obtain the screened time difference; and obtaining the repurchase period of the repurchase commodities of the user by averaging the time difference values.
However, although the scheme based on normal distribution considers the historical order intervals, the scheme is limited by a statistical model, and similar commodities cannot be counted, for example, the commodities are washing powder and laundry detergent, and the statistical model can be used as two kinds of commodities, so that the expression capability of the statistical model is relatively deficient; in addition, in the existing scheme, time intervals are used as basic data when the real repurchase period of the user is calculated, the purchase quantity of the user is not considered, and the prediction result is prone to being inaccurate. Taking milk as an example, the time interval between the purchase of two milk containers and the purchase of five milk containers, if both are taken as the interval of a single repurchase of milk by the user, may result in the basic data being inaccurate. Meanwhile, the stocking behavior of the user has a great influence on the next purchasing time of the user, and the prediction result is not considered to be deviated.
Based on this, the present exemplary embodiment first provides a training method of a period prediction model, which may be operated in a server, a server cluster, a cloud server, or the like; of course, those skilled in the art may also operate the method of the present disclosure on other platforms as needed, which is not particularly limited in the exemplary embodiment. Referring to fig. 1, the method for training the periodic prediction model may include the following steps:
step S110, calculating a historical order behavior sequence of a historical user and an actual repurchase cycle of historical articles included in a historical order according to historical user data;
s120, constructing a data set according to the historical articles, the actual repurchase period, the historical order behavior sequence and the historical user portrait in the historical user data;
s130, inputting historical articles, historical order behavior sequences and historical user figures included in the data set into a period prediction model to be trained to obtain a prediction repurchase period of the historical articles;
step S140, a first loss function is constructed according to the actual repurchase period and the forecast repurchase period in the data set, and the first loss function is utilized to train the periodic forecast model to be trained, so that the trained periodic forecast model is obtained.
In the training method of the periodic prediction model, on one hand, the historical order behavior sequence is considered in the training process of the periodic prediction model, so that the problem that in the prior art, the accuracy of the output result of the repeated purchase periodic model is low and the accuracy of the model is low because the historical order behavior sequence of a user is not considered is solved; on the other hand, the historical order behavior sequence of the historical user and the actual repurchase period of the historical articles included in the historical order are calculated according to the historical user data; constructing a data set according to historical articles, an actual repurchase period, a historical order behavior sequence and a historical user portrait in historical user data; inputting historical articles, historical order behavior sequences and historical user figures included in the data set into a period prediction model to be trained to obtain a prediction repurchase period of the historical articles; and finally, constructing a first loss function according to the actual repurchase period and the predicted repurchase period in the data set, and training the to-be-trained period prediction model by using the first loss function to obtain the trained period prediction model, so that the fitting capability of the period prediction model is improved, and the accuracy of the period prediction model is further improved.
Hereinafter, a training method of the periodic prediction model according to the exemplary embodiment of the present disclosure will be explained and explained in detail with reference to the drawings.
First, the objects of the exemplary embodiments of the present disclosure are explained and illustrated. Specifically, in order to solve the defects of the prior art, the disclosure provides an implementation scheme of a user repurchase period prediction method based on an Attention mechanism, and the user-commodity repurchase period is predicted in a refined manner, so that the problem of user experience caused by recommending that a user has bought commodities recently in a recommendation system is solved. The technical scheme is characterized by taking a commodity sequence, a purchase quantity sequence and a purchase time sequence under the near-three calendar history of a user as features, and extracting feature semantic information such as commodities, purchase quantity, purchase time and the like based on a pre-training method; then, in the integral model, the personalized repurchase habit of the user is learned based on a Self-Attention mechanism, the purchase information related to the target commodity in the historical purchase sequence of the user is extracted based on an Attention mechanism, and the purchase information, the user portrait and the target commodity are input into an MLP network together, so that the repurchase period of the user is predicted, and the user experience is improved on the basis of improving the accuracy of the period prediction model.
In a training method of a period prediction model provided in an exemplary embodiment of the present disclosure:
in step S110, a historical order behavior sequence of the historical user and an actual repurchase cycle of the historical items included in the historical order are calculated according to the historical user data.
In this exemplary embodiment, first, a historical order behavior sequence of the historical user is calculated according to the historical user data, which may specifically include: firstly, acquiring historical user data of a historical user in a first preset time period according to a user identifier of the historical user; secondly, extracting historical articles included in the historical user data, and performing aggregation processing on the historical articles according to category identification of the historical articles to obtain categories of different levels to which the historical articles belong; then, carrying out summation operation on the quantity of the historical articles to obtain the purchase quantity of the historical articles, and calculating the time position characteristics of the historical articles according to the initial purchase time and the final purchase time of the historical articles; and finally, generating the historical order behavior sequence according to the categories, purchase quantities and time and position characteristics of different levels to which the historical articles belong.
For example, historical user data of the historical user in the last three years (1095 days) may be obtained according to a user identifier of the historical user (the user identifier may be a phone number, a mailbox, a name, or the like, which is not particularly limited in this example); then, extracting historical items included in the historical user data, namely historical items purchased by the historical user in the last three years, constructing a user purchase sequence based on a day dimension, and aggregating commodity data under the same category purchased by the user on the same day, wherein the specific mode is that aggregation (group by) is performed on commodities purchased by the user on the same day by using cid4, cid3, cid2 and cid1 as aggregation fields, so that categories of different levels to which the historical items belong are obtained. Wherein, cid4, cid3, cid2 and cid1 are category identifiers of commodities and respectively correspond to a fourth-level category, a third-level category, a second-level category and a first-level category; for example, taking a certain hair clip as an example, cid4, cid3, cid2 and cid1 corresponding to the article are respectively a broken hair clip, a hair accessory and jewelry. Further, summing the number of the historical articles to obtain the purchase number of the historical articles; meanwhile, for the time-position feature (i.e. purchase time feature), the current purchase date may be differentiated from the minimum purchase date of the training data, so as to obtain a time-position (position) feature, whose range is [0,1095 ]; and finally, generating a historical order behavior sequence according to the categories, purchase quantities and time and position characteristics of different levels to which the historical articles belong.
Next, the actual repurchase period of the historical items included in the historical order is calculated from the historical user data. Specifically, the method may include: firstly, extracting a first purchase time node of a historical item included in the historical order and a last purchase time node corresponding to the first purchase time node from the historical user data; secondly, calculating the current purchase cycle of the historical item according to the first purchase time node and the last purchase time node corresponding to the first purchase time node; and finally, carrying out normalization processing on the current purchasing period to obtain the actual purchasing period of the historical articles. Specifically, in the model training process, a next repurchase interval in a random prediction historical user purchase sequence can be taken as a target, a training sample extraction rule randomly selects a repurchase commodity in the historical user purchase sequence as a historical item (target item), the repurchase _ date occurrence time and the time interval of last purchase of the cid4 type historical item are taken as real repurchase intervals (label), and the user purchase sequence is cut off to the front of the repurchase _ date; then, the real repurchase interval is normalized to obtain a real value (actual repurchase period) y of the training sample. The specific normalization processing formula can be shown as the following formula (1):
Figure BDA0003329251550000111
wherein max is the maximum value in label and min is the minimum value in label.
In step S120, a data set is constructed according to the historical articles, the actual repurchase period, the historical order behavior sequence and the historical user representation in the historical user data.
Specifically, after the actual repurchase period and the historical order behavior sequence are obtained, a data set can be constructed according to the historical articles, the actual repurchase period, the historical order behavior sequence and the user portrait; and the data samples in the dataset are scaled 8: 1: 1, 8 of which were used for model training, 1 for model validation, and 1 for model test evaluation. Wherein the user representation may include gender, age, occupation, etc. of the historical user.
In step S130, the historical article, the historical order behavior sequence, and the historical user image included in the data set are input into a cycle prediction model to be trained, so as to obtain a predicted repeat purchasing cycle of the historical article.
In the present exemplary embodiment, first, the period prediction model is explained and explained. Specifically, referring to fig. 2, the period prediction model may include an input layer 210, a first word embedding layer 220, a second word embedding layer 230, an attention mechanism layer 240, a logistic regression layer 250, and an output layer 260; the input layer is connected with the first word embedding layer and the second word embedding layer, the first word embedding layer is connected with the logistic regression layer through the attention mechanism layer, and the second word embedding layer is connected with the output layer through the logistic regression layer.
Next, referring to fig. 3, inputting the historical article, the historical order behavior sequence, and the historical user representation included in the data set into a period prediction model to be trained to obtain a predicted repurchase period of the historical article, may include the following steps:
and S310, encoding the historical object and the historical order behavior sequence by using the first word embedding layer to obtain object characteristics and behavior sequence characteristics, and encoding the historical user portrait by using the second word embedding layer to obtain user characteristics.
In the present exemplary embodiment, first, the generation process of the first word embedding layer is explained and explained. Specifically, referring to fig. 4, the generating process of the first word embedding layer may include the following steps:
step S410, encoding categories, purchase quantity and time position characteristics of different levels to which the historical articles belong based on Word2vec to obtain a first sub-vector, a second sub-vector and a third sub-vector;
step S420, performing feature splicing on the first sub-vector, the second sub-vector and the third sub-vector to obtain an order sequence of the historical user, and performing accompanying covering on any sub-vector in the order sequence to obtain a sequence to be processed;
step S430, predicting the sequence to be processed through a Bert model to be trained to obtain a first prediction result, and constructing a second loss function for the Bert model through the first prediction result and the covered sub-vectors; wherein the Bert model comprises a plurality of transform models;
specifically, predicting the sequence to be processed through a Bert model to be trained to obtain a first prediction result, which may include: firstly, inputting the sequence to be processed into a first Transformer model to generate a first text semantic vector, and inputting the first text semantic vector into other Transformer models to obtain text semantic vectors corresponding to other Transformer models; wherein, in the other Transformer models, the output of the previous Transformer model is the input of the next Transformer model corresponding to the output of the previous Transformer model; secondly, calculating the importance degree of each Transformer model to the sequence to be processed, and obtaining the first prediction result according to each importance degree and each text semantic vector.
Step S440, training the Bert model to be trained by using the second loss function, and fusing the trained Bert model into a second word embedding layer to obtain the first word embedding layer.
Hereinafter, steps S410 to S440 will be explained and explained. Specifically, the pre-training is to obtain a pre-training model irrelevant to a specific task from large-scale data through an auto-supervised learning method, and introduce pre-training to obtain the embedding vectors represented by feature semantics such as cid4, cid3, cid2, cid1, purchase quantity, purchase time position and the like. In the present exemplary embodiment, the pre-training may be completed based on a Bert model including a plurality of transform models, wherein the architecture diagram of the Bert model may be as shown in fig. 5, and in the Bert model, 12 transform models may be included, for example, transform 1, transform 2, … …, transform Encoder L, and the like.
Further, since the cid4 is sparse, the data volume is as high as hundreds of thousands, and the Transformer is difficult to complete pre-training under the existing machine condition (4-card GPU), in the present exemplary embodiment, the Transformer is pre-trained in a word2Vec + Transformer two-stage pre-training manner, so that the problem of sparsity of the cid4 is alleviated, and the pre-training speed is increased. Specifically, firstly, training the cid4 sequence, cid3 sequence, cid2 sequence, cid1 sequence, purchase quantity sequence and purchase time position sequence of the articles purchased by the user based on Word2vec to obtain a first sub-vector corresponding to cid4, cid3, cid2 and cid1, a second sub-vector corresponding to purchase quantity and a third sub-vector corresponding to time position; secondly, because the embedding based on Word2vec training can only aggregate similar features within a limited window size, more context information is lost, commodity attributes are not utilized for prediction, and attribute information of the user is lacked; therefore, the embedding vector obtained by Word2vec can be used as the initial input embedding in the transform model, and then the second stage of pre-training is performed to obtain a better feature semantic representation (embedding).
For example, a first sub-vector corresponding to the cid4 sequence, cid3 sequence, cid2 sequence, cid1 sequence, a second sub-vector corresponding to the purchase quantity sequence, and a third sub-vector corresponding to the time position sequence may be feature-spliced to obtain an order sequence of the historical user, wherein each purchase record of the user will include cid1, cid2, cid3, cid4, purchase quantity, and purchase time features; further, an MLM training method is adopted to train the model. The specific principle of the MLM is as follows: inputting a user order sequence into a Transformer model, randomly covering any characteristics (characteristics comprise cid1, cid2, ci3, cid4, purchase quantity, time position characteristics and the like) of a (mask) purchase record by an MLM training method to obtain a sequence to be processed, and then predicting the covered characteristics in the sequence to be processed by using the model to obtain a first prediction result; constructing a loss function based on the prediction result and the actually covered characteristics so as to complete the training of the Bert model to be trained; and finally, fusing the trained Bert model into the second word embedding layer to obtain the first word embedding layer.
It should be added here that the training method may use not only the latest purchase record to predict, but also other features of the current purchase record (cid1, cid2, cid3, cid4, etc.), so that the embedding of different features can be aligned in semantic space, and further the accuracy of the behavior sequence features is improved, thereby improving the accuracy of the periodic prediction model. In addition, in the example, the pretrained Bert model is introduced into the first word embedding layer fused into the second word embedding layer, so that each item in the historical purchase sequence acting on the historical user can be weighted, for example, for a commodity "shirt" in the sequence, when the embedding representation of the shirt is learned, the characteristics of the purchased relevant items such as a T-shirt, a vest and the like should be weighted, so that the semantic information of the "shirt" can be learned better, and due to the addition of the characteristics of the purchase time and the purchase quantity, the personalized repurchase information of the user for the "shirt" item can be learned, and the learning capability of the model is enhanced.
And finally, after the first word embedding layer is obtained, the historical object and the historical order behavior sequence can be coded by using the first word embedding layer to obtain object characteristics and behavior sequence characteristics, and the historical user portrait is coded by using the second word embedding layer to obtain user characteristics. It should be added here that the second word Embedding layer described here may be a common word Embedding layer, that is, a conventional Embedding layer.
And step S320, processing the behavior sequence characteristics and the article characteristics by using the attention mechanism layer to obtain a purchase-resuming behavior vector of the historical user for the historical article.
In an exemplary embodiment of the present disclosure, first, a first operation is performed on the behavior sequence feature and the article feature to obtain a first output result; wherein the first operation comprises an inner product operation and a subtraction operation; secondly, splicing the first output result, the behavior sequence characteristics and the article characteristics to obtain a first splicing result; then, processing the first splicing result by utilizing a first multilayer fully-connected neural network included in the attention mechanism layer to obtain the attention weight of the historical item; and finally, carrying out weighted summation on the attention weight and the article characteristics to obtain the repurchase behavior vector.
Specifically, firstly, performing inner product and subtraction operation on the behavior sequence characteristics and the article characteristics to obtain a first output result; and splicing the first output result, the behavior sequence characteristics and the article characteristics together, inputting the first output result, the behavior sequence characteristics and the article characteristics into a first multilayer fully-connected neural network (MLP) together, so as to learn the attribute weight w, and finally obtaining the repurchase behavior vector related to the current commodity in the purchase sequence by adopting weighted sum selling. Wherein, the weighted sum firing formula can be shown as the following formula (2):
Figure BDA0003329251550000151
wherein v isaEmbedding vector (item feature) representing historical item, e1,e2,...,enItem embedding vector (behavior sequence feature) representing second word embedding layer output, a (e)j,va) Indicating the attention mechanism layer attention operation, wjThe learned attention weight is shown, and U (A) shows the repurchase behavior vector of the historical user to the historical article.
It should be added here that the Attention (Attention) mechanism layer can focus well on the products that the user has historically purchased and that are related to the current product. For example, when calculating the re-purchase cycle of the user 'computer' goods, the characteristics of the related goods such as notebook computers, desktop computers and the like purchased before the user should be weighted; the purchasing actions such as clothes, snacks, etc. should be relatively reduced. The Attention mechanism is intended to focus on historical purchasing behavior associated with the target item.
And step S330, performing logistic regression processing on the repurchase behavior vector, the article characteristics and the user characteristics by using the logistic regression layer to obtain the predicted repurchase period.
In this example embodiment, first, the repurchase behavior vector, the article features, and the user features are spliced and tiled to obtain a second splicing result; secondly, projecting the second splicing result to a high-dimensional space by utilizing a second multilayer fully-connected neural network included in the logistic regression layer to obtain a high-dimensional projection result; and finally, carrying out nonlinear activation on the high-dimensional projection result to obtain the prediction repurchase period.
Specifically, the recurrence behavior vector u (a) output by the Attention layer in the logistic regression layer, and the embedding vector (article feature) v of the historical articleaAnd carrying out splicing and tiling operation on user portrait vectors (user characteristics), then projecting the user portrait vectors to a high-dimensional space through a second multilayer fully-connected neural network (MLP), carrying out nonlinear activation through an activation function relu, and finally obtaining a model output result y through a Sigmoid functionpredI.e. the forecast repurchase period.
In step S140, a first loss function is constructed according to the actual repurchase period and the predicted repurchase period in the data set, and the first loss function is used to train the to-be-trained periodic prediction model, so as to obtain a trained periodic prediction model.
Specifically, a first MAPE loss function may be constructed according to the actual repurchase period and the predicted repurchase period, and then the period prediction model to be trained is trained through the first MAPE loss function. Wherein the loss function can be shown as the following equation (3):
Figure BDA0003329251550000161
where L is the first MAPE loss function, yiThe real value of the ith training sample, namely the actual repurchase period,
Figure BDA0003329251550000162
and N is the total number of samples, namely the number of historical articles.
Further, after the trained periodic prediction model is obtained, the trained periodic prediction model needs to be subjected to effect evaluation. Specifically, in the effect evaluation phase, ypredFirstly, a final repurchase period prediction result period is obtained through inverse normalization, wherein the inverse normalization formula is ypred(max-min) + min, where max is the maximum value in label, min is the minimum value in label, ypredAnd D, outputting the Rgressor layer in the step D, namely predicting the repurchase period.
Meanwhile, after model prediction and inverse normalization are carried out on the test set, indexes such as MAPE and SMAPE are adopted to comprehensively evaluate the effect of the model. And accumulating the model evaluation results for multiple times, and calculating the average index of the model. In the off-line experiment of the repeated purchase period, the SMAPE evaluated by the test set is 0.198, the MAPE evaluated by the test set is 0.1392, and the effect is very obvious. When the online model updating method is actually used online, when indexes of the model are at an average level or higher than the average level, the model file can be updated to the online model library regularly. And if the model evaluation index is lower than the average level of the model, the model evaluation index is not updated. The training and evaluation period of the off-line model is on a weekly level, i.e., the model effect is trained and evaluated weekly.
Hereinafter, the training method of the periodic prediction model according to the exemplary embodiment of the present disclosure is further explained and explained with reference to fig. 6. Referring to fig. 6, the method for training the period prediction model may include the following steps:
step S601, the Embedding layer firstly converts the input historical articles, the historical purchase sequence of the user (including characteristics of commodities, purchase time, purchase quantity and the like), and the user portrait (sex, age and the like) into an Embedding vector;
step S602, inputting the imbedding vector of the target commodity and the imbedding vector of the historical purchase sequence of the user into an attention network together to obtain the repurchase habit of the historical user to the historical articles;
step S603, splicing the historical articles, the repurchase habits and the embedding vectors of the user portrait, and inputting the spliced historical articles, the repurchase habits and the embedding vectors into a Regressor layer together, so as to obtain the predicted repurchase period of the user;
step S604, a first loss function is constructed according to the prediction repurchase period and the actual repurchase period, and a to-be-trained period prediction model is trained based on the first loss function, so that a trained period prediction model is obtained.
In the training method of the periodic prediction model based on the Attention mechanism provided by the exemplary embodiment of the present disclosure, on the one hand, the unique characteristics of the purchased periodic portrait are designed as follows: in addition to the conventional characteristics of cid4 sequence, cid3 sequence, cid2 sequence, cid1 sequence, user portrait characteristics and the like, a purchase quantity sequence and a time position sequence are added, so that a repurchase interval is accurately predicted, and the influence on a repurchase period caused by similar commodities and stock stocking problems is solved; on the other hand, in order to enhance generalization capability, a training method for randomly predicting the next repurchase interval in the user historical purchase sequence as a training target is adopted, so that the fitting capability of the model is improved.
The embodiment of the disclosed example also provides a period prediction method. Referring to fig. 7, the period prediction method may include the steps of:
step S710, acquiring target user data of a target user according to a user identifier of the target user, and calculating a target order behavior sequence of the target user according to the target user data;
step S720, determining a target object from the target order, and inputting the target object, a target order behavior sequence and a target user portrait included in the target user data into a trained period prediction model to obtain a re-purchasing period of the target object by the target user; the trained periodic prediction model is obtained by training a periodic prediction model to be trained through the training method of the periodic prediction model;
step S730, calculating the next recommended time of the target item based on the re-purchase period and the last purchase time of the target item by the target user, and recommending the target item based on the next recommended time.
In the period prediction method shown in fig. 7, on one hand, the target order behavior sequence is considered in the period prediction process, so that the problem that the accuracy of the prediction result of the repeat purchasing period is low because the target order behavior sequence of the user is not considered in the prior art is solved; on the other hand, the next recommendation time of the target object can be calculated based on the re-purchase period and the last purchase time and purchase quantity of the target object by the target user, and the target object is recommended based on the next recommendation time, so that the accuracy of a recommendation result is improved, and the user experience is improved.
The embodiment of the disclosure also provides a training device of the period prediction model. Referring to fig. 8, the training apparatus for the period prediction model may include a first calculation module 810, a data set construction module 820, a repurchase period prediction module 830, and a period prediction model training module 840. Wherein:
the first calculation module 810 may be configured to calculate a historical order behavior sequence of a historical user and an actual repurchase period of historical items included in a historical order according to historical user data;
the data set construction module 820 can be used for constructing a data set according to the historical articles, the actual repurchase period, the historical order behavior sequence and the historical user representation in the historical user data;
the repurchase period prediction module 830 may be configured to input the historical articles, the historical order behavior sequences, and the historical user images included in the data set into a period prediction model to be trained, so as to obtain a predicted repurchase period of the historical articles;
the period prediction model training module 840 may be configured to construct a first loss function according to the actual repurchase period and the predicted repurchase period in the data set, and train the period prediction model to be trained by using the first loss function to obtain a trained period prediction model.
In an exemplary embodiment of the present disclosure, calculating a historical order activity sequence of a historical user from historical user data includes:
acquiring historical user data of a historical user in a first preset time period according to a user identifier of the historical user;
extracting historical articles included in the historical user data, and performing aggregation processing on the historical articles according to category identifications of the historical articles to obtain categories of different levels to which the historical articles belong;
summing the number of the historical articles to obtain the purchase number of the historical articles, and calculating the time position characteristics of the historical articles according to the initial purchase time and the final purchase time of the historical articles;
and generating the historical order behavior sequence according to the categories, purchase quantities and time and position characteristics of different levels to which the historical articles belong.
In an exemplary embodiment of the present disclosure, calculating an actual repurchase period of historical items included in a historical order from historical user data includes:
extracting a first purchase time node of a historical item included in the historical order and a last purchase time node corresponding to the first purchase time node from the historical user data;
calculating the current purchase cycle of the historical item according to the first purchase time node and the last purchase time node corresponding to the first purchase time node;
and carrying out normalization processing on the current purchasing period to obtain the actual purchasing period of the historical articles.
In an exemplary embodiment of the present disclosure, the periodic prediction model to be trained includes a first word embedding layer, a second word embedding layer, an attention mechanism layer, and a logistic regression layer;
inputting historical articles, historical order behavior sequences and historical user figures included in the data set into a period prediction model to be trained to obtain a prediction repurchase period of the historical articles, wherein the period prediction model comprises:
the historical object and the historical order behavior sequence are coded by the first word embedding layer to obtain object characteristics and behavior sequence characteristics, and the historical user portrait is coded by the second word embedding layer to obtain user characteristics;
processing the behavior sequence features and the article features by using the attention mechanism layer to obtain a repurchase behavior vector of the historical user to the historical articles;
and performing logistic regression processing on the repurchase behavior vector, the article characteristics and the user characteristics by using the logistic regression layer to obtain the predicted repurchase period.
In an exemplary embodiment of the present disclosure, processing the behavior sequence feature and the article feature to obtain a repurchase behavior vector of the historical user on the historical article includes:
performing a first operation on the behavior sequence characteristic and the article characteristic to obtain a first output result; wherein the first operation comprises an inner product operation and a subtraction operation;
splicing the first output result, the behavior sequence characteristics and the article characteristics to obtain a first splicing result;
processing the first splicing result by utilizing a first multilayer fully-connected neural network included in the attention mechanism layer to obtain the attention weight of the historical item;
and carrying out weighted summation on the attention weight and the item characteristics to obtain the repurchase behavior vector.
In an exemplary embodiment of the present disclosure, the training device of the period prediction model may further include:
the encoding module can be used for encoding categories, purchase quantities and time position characteristics of different levels to which the historical articles belong based on Word2vec to obtain a first sub-vector, a second sub-vector and a third sub-vector;
the feature splicing module can be used for performing feature splicing on the first sub-vector, the second sub-vector and the third sub-vector to obtain an order sequence of the historical user, and covering any sub-vector in the order sequence along with the order sequence to obtain a sequence to be processed;
the loss function building module can be used for predicting the sequence to be processed through a Bert model to be trained to obtain a first prediction result, and building a second loss function for the Bert model through the first prediction result and the covered sub-vectors;
the Bert model training module may be configured to train the Bert model to be trained by using the second loss function, and fuse the trained Bert model to a second word embedding layer to obtain the first word embedding layer.
In an exemplary embodiment of the present disclosure, the Bert model includes a plurality of transform models;
predicting the sequence to be processed through a Bert model to be trained to obtain a first prediction result, wherein the method comprises the following steps:
inputting the sequence to be processed into a first Transformer model to generate a first text semantic vector, and inputting the first text semantic vector into other Transformer models to obtain text semantic vectors corresponding to other Transformer models; wherein, in the other Transformer models, the output of the previous Transformer model is the input of the next Transformer model corresponding to the output of the previous Transformer model;
and calculating the importance degree of each Transformer model to the sequence to be processed, and obtaining the first prediction result according to each importance degree and each text semantic vector.
In an exemplary embodiment of the present disclosure, performing logistic regression processing on the repurchase behavior vector, the item feature, and the user feature to obtain the predicted repurchase period includes:
splicing and tiling the repurchase behavior vector, the article characteristics and the user characteristics to obtain a second splicing result;
projecting the second splicing result to a high-dimensional space by using a second multilayer fully-connected neural network included in the logistic regression layer to obtain a high-dimensional projection result;
and carrying out nonlinear activation on the high-dimensional projection result to obtain the prediction repurchase period.
The embodiment of the disclosed example also provides a period prediction device. Referring to fig. 9, the period prediction apparatus may include a second calculation module 910, a repurchase period prediction module 920, and an item recommendation module 930. Wherein:
the second calculating module 910 may be configured to obtain target user data of a target user according to a user identifier of the target user, and calculate a target order behavior sequence of the target user according to the target user data;
a repurchase period prediction module 920, configured to determine a target item from the target order, and input the target item, a target order behavior sequence, and a target user representation included in the target user data into a trained period prediction model, so as to obtain a repurchase period of the target item by the target user; the trained periodic prediction model is obtained by training a periodic prediction model to be trained through any one of the above training methods of the periodic prediction model;
the item recommendation module 930 may be configured to calculate a next recommendation time of the target item based on the re-purchase period and a last purchase time of the target item by the target user, and recommend the target item based on the next recommendation time.
The specific details of the training device of the period prediction model and each module in the period prediction device have been described in detail in the training method of the corresponding period prediction model and the period prediction method, and therefore are not described herein again.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Moreover, although the steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that the steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 1000 according to this embodiment of the disclosure is described below with reference to fig. 10. The electronic device 1000 shown in fig. 10 is only an example and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 10, the electronic device 1000 is embodied in the form of a general purpose computing device. The components of the electronic device 1000 may include, but are not limited to: the at least one processing unit 1010, the at least one memory unit 1020, a bus 1030 connecting different system components (including the memory unit 1020 and the processing unit 1010), and a display unit 1040.
Wherein the storage unit stores program code that is executable by the processing unit 1010 to cause the processing unit 1010 to perform steps according to various exemplary embodiments of the present disclosure described in the above section "exemplary methods" of the present specification. For example, the processing unit 1010 may execute step S110 as shown in fig. 1: calculating a historical order behavior sequence of a historical user and an actual repurchase period of historical articles included in a historical order according to historical user data; step S120: constructing a data set according to the historical articles, the actual repurchase period, the historical order behavior sequence and the historical user portrait in the historical user data; step S130: inputting historical articles, historical order behavior sequences and historical user figures included in the data set into a period prediction model to be trained to obtain a prediction repurchase period of the historical articles; step S140: and constructing a first loss function according to the actual repurchase period and the predicted repurchase period in the data set, and training the to-be-trained periodic prediction model by using the first loss function to obtain a trained periodic prediction model.
The processing unit 1010 may perform step S710 as shown in fig. 7: acquiring target user data of a target user according to a user identifier of the target user, and calculating a target order behavior sequence of the target user according to the target user data; step S720: determining a target object from the target order, and inputting the target object, a target order behavior sequence and a target user figure included in the target user data into a trained period prediction model to obtain a repeat purchasing period of the target object by the target user; the trained periodic prediction model is obtained by training a periodic prediction model to be trained through the training method of the periodic prediction model; step S730: and calculating the next recommendation time of the target item based on the re-purchase period and the last purchase time of the target user for the target item, and recommending the target item based on the next recommendation time.
The storage unit 1020 may include readable media in the form of volatile memory units, such as a random access memory unit (RAM)10201 and/or a cache memory unit 10202, and may further include a read-only memory unit (ROM) 10203.
The memory unit 1020 may also include a program/utility 10204 having a set (at least one) of program modules 10205, such program modules 10205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 1030 may be any one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, and a local bus using any of a variety of bus architectures.
The electronic device 1000 may also communicate with one or more external devices 1100 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 1000, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 1000 to communicate with one or more other computing devices. Such communication may occur through input/output (I/O) interfaces 1050. Also, the electronic device 1000 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the internet) via the network adapter 1060. As shown, the network adapter 1060 communicates with the other modules of the electronic device 1000 over the bus 1030. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the disclosure described in the "exemplary methods" section above of this specification, when the program product is run on the terminal device.
According to the program product for implementing the above method of the embodiments of the present disclosure, it may employ a portable compact disc read only memory (CD-ROM) and include program codes, and may be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Furthermore, the above-described figures are merely schematic illustrations of processes included in methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (13)

1. A method for training a periodic prediction model, comprising:
calculating a historical order behavior sequence of a historical user and an actual repurchase period of historical articles included in a historical order according to historical user data;
constructing a data set according to the historical articles, the actual repurchase period, the historical order behavior sequence and the historical user portrait in the historical user data;
inputting historical articles, historical order behavior sequences and historical user figures included in the data set into a period prediction model to be trained to obtain a prediction repurchase period of the historical articles;
and constructing a first loss function according to the actual repurchase period and the predicted repurchase period in the data set, and training the to-be-trained periodic prediction model by using the first loss function to obtain a trained periodic prediction model.
2. The method for training the cycle prediction model according to claim 1, wherein calculating the historical order behavior sequence of the historical users according to the historical user data comprises:
acquiring historical user data of a historical user in a first preset time period according to a user identifier of the historical user;
extracting historical articles included in the historical user data, and performing aggregation processing on the historical articles according to category identifications of the historical articles to obtain categories of different levels to which the historical articles belong;
summing the number of the historical articles to obtain the purchase number of the historical articles, and calculating the time position characteristics of the historical articles according to the initial purchase time and the final purchase time of the historical articles;
and generating the historical order behavior sequence according to the categories, purchase quantities and time and position characteristics of different levels to which the historical articles belong.
3. A method for training a cycle prediction model according to claim 1, wherein calculating an actual repurchase cycle of historical items included in a historical order based on historical user data comprises:
extracting a first purchase time node of a historical item included in the historical order and a last purchase time node corresponding to the first purchase time node from the historical user data;
calculating the current purchase cycle of the historical item according to the first purchase time node and the last purchase time node corresponding to the first purchase time node;
and carrying out normalization processing on the current purchasing period to obtain the actual purchasing period of the historical articles.
4. The training method of the periodic prediction model according to claim 1, wherein the periodic prediction model to be trained comprises a first word embedding layer, a second word embedding layer, an attention mechanism layer and a logistic regression layer;
inputting historical articles, historical order behavior sequences and historical user figures included in the data set into a period prediction model to be trained to obtain a prediction repurchase period of the historical articles, wherein the period prediction model comprises:
the historical object and the historical order behavior sequence are coded by the first word embedding layer to obtain object characteristics and behavior sequence characteristics, and the historical user portrait is coded by the second word embedding layer to obtain user characteristics;
processing the behavior sequence features and the article features by using the attention mechanism layer to obtain a repurchase behavior vector of the historical user to the historical articles;
and performing logistic regression processing on the repurchase behavior vector, the article characteristics and the user characteristics by using the logistic regression layer to obtain the predicted repurchase period.
5. The method for training the period prediction model according to claim 4, wherein the step of processing the behavior sequence features and the item features to obtain a purchase-resuming behavior vector of the historical user for the historical item comprises:
performing a first operation on the behavior sequence characteristic and the article characteristic to obtain a first output result; wherein the first operation comprises an inner product operation and a subtraction operation;
splicing the first output result, the behavior sequence characteristics and the article characteristics to obtain a first splicing result;
processing the first splicing result by utilizing a first multilayer fully-connected neural network included in the attention mechanism layer to obtain the attention weight of the historical item;
and carrying out weighted summation on the attention weight and the item characteristics to obtain the repurchase behavior vector.
6. The method for training a periodic prediction model according to claim 4, further comprising:
coding categories, purchase quantity and time position characteristics of different levels to which the historical articles belong based on Word2vec to obtain a first sub-vector, a second sub-vector and a third sub-vector;
performing feature splicing on the first sub-vector, the second sub-vector and the third sub-vector to obtain an order sequence of the historical user, and performing accompanying covering on any sub-vector in the order sequence to obtain a sequence to be processed;
predicting the sequence to be processed through a Bert model to be trained to obtain a first prediction result, and constructing a second loss function for the Bert model through the first prediction result and the covered sub-vectors;
and training the Bert model to be trained by using the second loss function, and fusing the trained Bert model into a second word embedding layer to obtain the first word embedding layer.
7. The method for training a cycle prediction model according to claim 6, wherein the Bert model comprises a plurality of transform models;
predicting the sequence to be processed through a Bert model to be trained to obtain a first prediction result, wherein the method comprises the following steps:
inputting the sequence to be processed into a first Transformer model to generate a first text semantic vector, and inputting the first text semantic vector into other Transformer models to obtain text semantic vectors corresponding to other Transformer models; wherein, in the other Transformer models, the output of the previous Transformer model is the input of the next Transformer model corresponding to the output of the previous Transformer model;
and calculating the importance degree of each Transformer model to the sequence to be processed, and obtaining the first prediction result according to each importance degree and each text semantic vector.
8. The method for training the period prediction model according to claim 4, wherein performing logistic regression processing on the repurchase behavior vector, the item feature and the user feature to obtain the prediction repurchase period comprises:
splicing and tiling the repurchase behavior vector, the article characteristics and the user characteristics to obtain a second splicing result;
projecting the second splicing result to a high-dimensional space by using a second multilayer fully-connected neural network included in the logistic regression layer to obtain a high-dimensional projection result;
and carrying out nonlinear activation on the high-dimensional projection result to obtain the prediction repurchase period.
9. A cycle prediction method, comprising:
acquiring target user data of a target user according to a user identifier of the target user, and calculating a target order behavior sequence of the target user according to the target user data;
determining a target object from the target order, and inputting the target object, a target order behavior sequence and a target user figure included in the target user data into a trained period prediction model to obtain a repeat purchasing period of the target object by the target user; wherein the trained periodic prediction model is obtained by training the periodic prediction model to be trained through the training method of the periodic prediction model according to any one of claims 1 to 8;
and calculating the next recommendation time of the target item based on the re-purchase period and the last purchase time of the target user for the target item, and recommending the target item based on the next recommendation time.
10. An apparatus for training a periodic prediction model, comprising:
the first calculation module is used for calculating a historical order behavior sequence of a historical user and an actual repurchase cycle of historical articles included in a historical order according to historical user data;
the data set construction module is used for constructing a data set according to the historical articles, the actual repurchase period, the historical order behavior sequence and the historical user portrait in the historical user data;
the repurchase cycle prediction module is used for inputting historical articles, historical order behavior sequences and historical user figures included in the data set into a cycle prediction model to be trained to obtain the predicted repurchase cycle of the historical articles;
and the period prediction model training module is used for constructing a first loss function according to the actual repurchase period and the predicted repurchase period in the data set, and training the period prediction model to be trained by using the first loss function to obtain the trained period prediction model.
11. A cycle prediction apparatus, comprising:
the second calculation module is used for acquiring target user data of a target user according to the user identification of the target user and calculating a target order behavior sequence of the target user according to the target user data;
the repurchase cycle prediction module is used for determining a target object from the target order, and inputting the target object, a target order behavior sequence and a target user portrait included in the target user data into a trained cycle prediction model to obtain the repurchase cycle of the target object by the target user; the trained periodic prediction model is obtained by training a periodic prediction model to be trained through any one of the above training methods of the periodic prediction model;
and the item recommending module is used for calculating the next recommending time of the target item based on the re-purchasing period and the last purchasing time of the target user for the target item, and recommending the target item based on the next recommending time.
12. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method of training a cycle prediction model according to any one of claims 1 to 8 and a method of predicting a cycle according to claim 9.
13. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of training of the cycle prediction model of any of claims 1-8 and the method of cycle prediction of claim 9 via execution of the executable instructions.
CN202111272810.9A 2021-10-29 2021-10-29 Periodic prediction model training method and device, and periodic prediction method and equipment Pending CN113780479A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111272810.9A CN113780479A (en) 2021-10-29 2021-10-29 Periodic prediction model training method and device, and periodic prediction method and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111272810.9A CN113780479A (en) 2021-10-29 2021-10-29 Periodic prediction model training method and device, and periodic prediction method and equipment

Publications (1)

Publication Number Publication Date
CN113780479A true CN113780479A (en) 2021-12-10

Family

ID=78873577

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111272810.9A Pending CN113780479A (en) 2021-10-29 2021-10-29 Periodic prediction model training method and device, and periodic prediction method and equipment

Country Status (1)

Country Link
CN (1) CN113780479A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115102779A (en) * 2022-07-13 2022-09-23 中国电信股份有限公司 Prediction model training and access request decision method, device and medium
CN116108145A (en) * 2023-04-12 2023-05-12 山景智能(北京)科技有限公司 Wind control analysis method and device based on pre-training

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115102779A (en) * 2022-07-13 2022-09-23 中国电信股份有限公司 Prediction model training and access request decision method, device and medium
CN115102779B (en) * 2022-07-13 2023-11-07 中国电信股份有限公司 Prediction model training and access request decision method, device and medium
CN116108145A (en) * 2023-04-12 2023-05-12 山景智能(北京)科技有限公司 Wind control analysis method and device based on pre-training

Similar Documents

Publication Publication Date Title
US20180165745A1 (en) Intelligent Recommendation Method and System
CN111523976A (en) Commodity recommendation method and device, electronic equipment and storage medium
CN111046294A (en) Click rate prediction method, recommendation method, model, device and equipment
CN113256367B (en) Commodity recommendation method, system, equipment and medium for user behavior history data
CN110008973B (en) Model training method, method and device for determining target user based on model
CN112365283B (en) Coupon issuing method and device, terminal equipment and storage medium
CN113780479A (en) Periodic prediction model training method and device, and periodic prediction method and equipment
US20230028266A1 (en) Product recommendation to promote asset recycling
CN113781149A (en) Information recommendation method and device, computer-readable storage medium and electronic equipment
CN111695024A (en) Object evaluation value prediction method and system, and recommendation method and system
CN111461757B (en) Information processing method and device, computer storage medium and electronic equipment
CN113065882A (en) Commodity processing method and device and electronic equipment
CN115935185A (en) Training method and device for recommendation model
CN113763019A (en) User information management method and device
CN115797005A (en) Prediction model training method, prediction model training device, prediction model commodity recommendation method, prediction model training device, commodity recommendation device, electronic equipment and medium
CN111680213B (en) Information recommendation method, data processing method and device
CN113469482A (en) Method, apparatus, and computer-readable storage medium for data analysis
CN113763095B (en) Information recommendation method and device and model training method and device
CN107644102B (en) Data feature construction method and device, storage medium and electronic equipment
CN113850654A (en) Training method of item recommendation model, item screening method, device and equipment
CN111325614B (en) Recommendation method and device of electronic object and electronic equipment
CN111026973B (en) Commodity interest degree prediction method and device and electronic equipment
CN113139115A (en) Information recommendation method, search method, device, client, medium and equipment
CN116186541A (en) Training method and device for recommendation model
CN113837843A (en) Product recommendation method, device, medium and electronic equipment

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