A service recommendation method and device based on user trajectory
By using a service recommendation method based on user trajectory and employing vector representation and importance determination models, the problem of inaccurate trajectory prediction in existing technologies is solved, achieving more accurate user trajectory prediction and personalized service recommendation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2022-11-15
- Publication Date
- 2026-06-16
AI Technical Summary
Existing user trajectory prediction methods cannot effectively distinguish between valuable and worthless trajectories, resulting in inaccurate prediction results, and they also ignore the influence of social relationship factors.
By acquiring the first and second historical trajectory data of the target user, vector representations are extracted using methods such as Word2Vec. Combined with LSTM and importance determination models, a trajectory prediction model is trained, and the softmax function is used to analyze future trajectory information and recommend relevant services.
It improves the accuracy of user trajectory prediction, enabling users to plan routes in advance, discover potential customers and business needs, and provide better services.
Smart Images

Figure CN115935085B_ABST
Abstract
Description
Technical Field
[0001] This article relates to the field of fintech, and in particular to a service recommendation method and device based on user trajectory. Background Technology
[0002] Location-based user movement trajectory prediction is an important technology. In daily life, people constantly move from one place to another, but their movement patterns vary and are influenced by factors such as holidays, weather, and individual mood.
[0003] The earliest methods for collecting trajectory data primarily relied on questionnaires. However, questionnaires are costly, inefficient, and difficult to use for recording user trajectories over extended periods. Current technologies for predicting user trajectories involve building mobile behavior prediction models. Specifically, this involves first identifying predefined movement mechanisms, such as periodic or sequential patterns, from user trajectories, and then predicting the next user's location based on these extracted patterns. This method extracts statistical features from user movement behavior (e.g., location, time, number of times a user visits a particular trajectory point), but ignores the influence of social factors. Furthermore, while some trajectories in a user's historical behavior are valuable, others are meaningless. Pattern-based methods cannot distinguish between valuable and meaningless trajectories, nor can they eliminate meaningless ones, leading to inaccurate or unreliable predictions.
[0004] To address the problem of inaccurate user trajectory prediction results in current technologies, a service recommendation method and device based on user trajectory is needed. Summary of the Invention
[0005] To address the problems of the prior art, this embodiment provides a service recommendation method based on user trajectory.
[0006] This embodiment provides a service recommendation method based on user trajectory, including: acquiring target user trajectory data, the target user trajectory data including first historical trajectory data and second historical trajectory data; extracting vector representations of the first historical trajectory data from the first historical trajectory data to obtain first historical trajectory information; determining second historical trajectory information based on the importance of each trajectory point in the second historical trajectory data; inputting the first historical trajectory information and the second historical trajectory information into a pre-trained trajectory prediction model to obtain future trajectory information; determining the user's future trajectory based on the future trajectory information; and recommending services to the user based on the user's future trajectory.
[0007] According to one aspect of the embodiments herein, the training process of the importance determination model includes: acquiring historical user trajectory sample data, the historical user trajectory sample data including first historical trajectory sample data and second historical trajectory sample data; and pre-establishing an initial importance determination model according to the following formula: ;in, Indicates the first trajectory points The initial importance, and Let be the parameter matrix, containing the parameters to be trained. For the first historical trajectory sample data A number of sample trajectory points are used; the loss function of the initial trajectory prediction model is constructed using the following formula:
[0008] ,in, For similarity measurement function, x The importance value determines the prediction results of the initial model, i.e., the initial importance value. , This represents the positive samples corresponding to the training data. For the negative samples corresponding to the training data, Q Indicates the number of negative samples. S The loss function is represented; based on the second historical trajectory sample data and the loss function, an initial importance determination model is trained to obtain the importance determination model.
[0009] According to one aspect of the embodiments herein, the training process of the trajectory prediction model includes: extracting first historical trajectory sample information from user historical trajectory sample data; determining second historical trajectory sample information based on the importance of each trajectory point in the second historical trajectory sample data; and pre-establishing an initial trajectory prediction model according to the following formula: ;
[0010] Where n is a positive integer not greater than 3. The initial information for the future trajectory predicted by the initial trajectory prediction model. This refers to the raw information of the future trajectory calculated based on the first historical trajectory information sample data and the second historical trajectory information sample data. The matrix to be trained, Let be the vector to be trained. This represents the information of the first historical trajectory sample. For the second historical trajectory sample information, construct the loss function using the following formula:
[0011] ,middle, Here, x is the similarity metric function, representing the prediction result of the initial trajectory prediction model, i.e., the initial information of the future trajectory. , This represents the positive samples corresponding to the training data. The negative samples are the training data; based on the first historical trajectory sample information, the second historical trajectory sample information, and the loss function, the initial trajectory prediction model is trained to obtain the trajectory prediction model.
[0012] According to one aspect of the embodiments herein, determining a user's future trajectory includes: analyzing multiple classification probability values of each trajectory point in the future trajectory information using a softmax function; selecting the trajectory point corresponding to the highest probability value as the final trajectory point of the future trajectory information; and determining the user's future trajectory based on the final trajectory point and a preset trajectory table, wherein the preset trajectory table records the mapping relationship between each final trajectory point and the actual geographical location.
[0013] According to one aspect of the embodiments herein, recommending services to the user includes: determining whether the user's future trajectory is related to the service; if the user's future trajectory is related to the service, pushing service recommendation information to the user according to a preset time period; if the user's future trajectory is not related to the service, not pushing service recommendation information to the user.
[0014] According to one aspect of the embodiments herein, obtaining the target user trajectory data further includes: processing the target user trajectory data into time series data.
[0015] This embodiment also provides a service recommendation device based on user trajectory. The device includes: a data acquisition unit for acquiring target user trajectory data, the target user trajectory data including first historical trajectory data and second historical trajectory data; a first historical trajectory information extraction unit for extracting vector representations of the first historical trajectory data from the first historical trajectory data to obtain first historical trajectory information; a second historical trajectory information extraction unit for determining second historical trajectory information based on the importance of each trajectory point in the second historical trajectory data; a future trajectory information determination unit for inputting the first historical trajectory information and the second historical trajectory information into a pre-trained trajectory prediction model to obtain future trajectory information; a future trajectory determination unit for determining the user's future trajectory based on the future trajectory information; and a service recommendation unit for recommending services to the user based on the user's future trajectory.
[0016] This embodiment also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the service recommendation method based on user trajectory.
[0017] This embodiment provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the service recommendation method based on user trajectories.
[0018] This article suggests that by predicting people's movement trajectories, users can plan their routes in advance, identify potential customers and their business needs early, and thus provide them with better advice and services. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments or prior art described herein, the accompanying drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this article. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 The diagram shown is a flowchart of a service recommendation method based on target user trajectories, as described in this embodiment.
[0021] Figure 2 The diagram shown is a flowchart of a method for determining second historical trajectory information according to an embodiment of this paper;
[0022] Figure 3 The diagram shown is a flowchart of a method for training an importance determination model according to an embodiment of this paper.
[0023] Figure 4 The diagram shown is a flowchart of a method for determining a training trajectory prediction model according to an embodiment of this paper.
[0024] Figure 5 The diagram shown is a flowchart of a method for determining the future trajectory of a target user according to an embodiment of this paper.
[0025] Figure 6 The diagram shown is a flowchart of a method for recommending services to target users according to an embodiment of this article;
[0026] Figure 7 The diagram shown is a structural schematic of a service recommendation device based on target user trajectory according to an embodiment of this paper.
[0027] Figure 8 The diagram shown is a schematic representation of the specific structure of the service recommendation device based on the target user trajectory in this embodiment.
[0028] Figure 9 The diagram shown is a structural schematic of a computer device according to an embodiment of this article.
[0029] Explanation of symbols in the attached drawings:
[0030] 701. Data Acquisition Unit;
[0031] 702. First historical trajectory information extraction unit;
[0032] 703. Second historical trajectory information extraction unit;
[0033] 7031. Importance Determination Module;
[0034] 7032. Importance determination model training module;
[0035] 704. Future trajectory information determination unit;
[0036] 7041. Trajectory prediction model training module;
[0037] 705. Future trajectory determination unit;
[0038] 706. Service Recommendation Unit;
[0039] 902. Computer equipment;
[0040] 904, Processor;
[0041] 906. Memory;
[0042] 908. Drive mechanism;
[0043] 910. Input / Output Module;
[0044] 912. Input devices;
[0045] 914. Output devices;
[0046] 916. Presentation equipment;
[0047] 918. Graphical User Interface;
[0048] 920. Network interface;
[0049] 922. Communication link;
[0050] 924. Communication bus. Detailed Implementation
[0051] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments herein will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments herein, and not all of the embodiments. Based on the embodiments herein, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this document.
[0052] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings herein are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, apparatus, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0053] This specification provides the operational steps of the methods described in the embodiments or flowcharts, but based on conventional or non-inventive labor, more or fewer operational steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only possible execution order. In actual system or device products, the methods shown in the embodiments or drawings can be executed sequentially or in parallel.
[0054] It should be noted that the service recommendation method based on user trajectory presented in this paper can be used in the financial field, but this paper does not limit the application areas of the service recommendation method and device based on user trajectory.
[0055] Figure 1 The diagram shown is a flowchart of a service recommendation method based on user trajectory according to an embodiment of this paper, which specifically includes the following steps:
[0056] Step 101: Obtain target user trajectory data, which includes first historical trajectory data and second historical trajectory data. In daily life, people constantly move from one place to another, with varied and complex movement trajectories, different movement patterns, and are influenced by factors such as holidays, weather, and mood. Statistical studies by scholars have found that user movement behavior has significant stability and high regularity, with over 90% of user movement patterns being predictable.
[0057] In this specification, the target user is the user whose future trajectory is to be predicted, and the trajectory data of the target user is trajectory data that occurred within a historical period. Specifically, the first historical trajectory data is trajectory data from a period that is relatively distant from the current time; the second historical trajectory data is trajectory data from a period that is relatively recent from the current time. For example, if the historical period is 30 days prior to the current time, the first historical trajectory data could be trajectory data from the 20th to the 30th day prior to the current time; the second historical trajectory data could be trajectory data from the current time to the 10th day prior to the current time.
[0058] In some embodiments of this specification, the target user trajectory data is data related to locations visited by the user, and the target user trajectory data corresponds to trajectory points of specific geographic spatial locations. In some embodiments of this specification, user location information over a past period can be collected based on user authorization from different online software, mini-programs, or applications to determine the longitude and latitude of locations visited by the user.
[0059] User trajectories are collected according to a certain collection period. The collected user trajectory data is transformed into a sequence, where each point in the sequence is represented by the aforementioned tuples, triples, or quadruples. Specifically, each user trajectory data point of the target user can be represented by a single tuple, for example, ,in, Represents the longitude of the trajectory point. The latitude of the trajectory point is represented. Furthermore, a unique identifier can be assigned to the user; the unique identifier, precision, and latitude are defined as a set of user trajectory data. Each user trajectory data point of the target user can also be represented by a triple, for example, .in, This represents the user's identity information. Furthermore, the real-time time of the collected user trajectory data can be added to the triple to form a quaternion representing the user trajectory data. For example, ,in t Indicates time.
[0060] This step of acquiring user trajectory data also includes processing the target user trajectory data into time series data, which can be represented as an ordered sequence that changes over time. When user trajectory data is presented in the form of tuples and triplets, the trajectory data is simultaneously stored in the time series according to the collection order during user trajectory acquisition, so that the collected tuple and triplet user trajectories are arranged in chronological order. When user trajectory data is presented in the form of quadruplets, the user trajectory data is directly processed into time series data based on the time information in the user trajectory data. This specification describes the sequence after user trajectory data conversion using triplets and quadruplets as examples.
[0061] In some embodiments of this specification, trajectory data of the target user is collected at certain time intervals. The collection period can be 1 hour, 2 hours, 6 hours, etc. This step does not limit the length of the period for collecting the target user's trajectory data.
[0062] Step 102: Extract the vector representation of the first historical trajectory data from the first historical trajectory data to obtain the first trajectory information. In some embodiments of this specification, Word2Vec, Globe, ELMo, BERT, RoBERTa, DistillBERT, etc., can be used to obtain the embedded representation of the first historical trajectory data. That is, each trajectory point in the first historical trajectory data is represented as a vector, thereby obtaining the trajectory point vector sequence of the target user over a period of time. Specifically, BERT can be used to embed the trajectory data of the target user. That is, each trajectory point is represented as a vector.
[0063] Furthermore, this step utilizes LSTM to extract the vector sequence of each trajectory point in the first historical trajectory data, and updates it by training the LSTM. The LSTM algorithm is a temporal recurrent neural network suitable for processing and predicting events with long intervals and delays in time series. The LSTM output yields the first trajectory information. The first historical trajectory information is a vector containing the historical trajectory information extracted from the first historical trajectory data. In this step, the first historical trajectory information is denoted as... For example, [0.456, 0.123, 0.124]. In this specification, the first historical trajectory information is data in the form of a multi-dimensional vector, obtained by training an LSTM algorithm.
[0064] Step 103: Determine the second historical trajectory information based on the importance of each trajectory point in the second historical trajectory data. In this specification, user trajectories that are too far removed from the current time or too early have a relatively small impact on the predicted user trajectory results. Therefore, the target user's trajectory is divided. Specifically, the first historical trajectory data includes regions that the user was previously interested in, but these regions or content may change over time, and the target user may no longer be interested in them. The second historical trajectory data includes regions that the user is currently or recently interested in. Each piece of second historical trajectory data for the target user has significant reference value for predicting the target user's future trajectory.
[0065] Therefore, the importance of each trajectory point in the second historical trajectory data is determined, and the second historical trajectory information is determined based on the importance of each trajectory point. The second historical trajectory information is also represented by a vector, for example, [0.82, 0.22, 0.562]. In this specification, the second historical trajectory information is data in multi-dimensional vector form, obtained by training the importance determination model and the vector representation of the trajectory points. For a detailed description of training the importance determination model, please refer to [link to relevant documentation]. Figure 3 .
[0066] Step 104: Input the first historical trajectory information and the second historical trajectory information into the pre-trained trajectory prediction model to obtain future trajectory information. In this step, the first historical trajectory information, the second historical trajectory information, and the trajectory prediction model are combined to predict the future trajectory information of the target user. A description of training the trajectory prediction model in this step is provided below. Figure 4 In this step, the trajectory prediction model outputs future trajectory information for the target user, which may include trajectory information for one trajectory point or trajectory information for multiple trajectory points.
[0067] Step 105: Determine the user's future trajectory based on the future trajectory information. Corresponding to the first and second historical trajectory information, the future trajectory information in this step is also data in vector form, for example, [0.62, 0.235, 0.224]. In this specification, the future trajectory information is data in multi-dimensional vector form, obtained by training an estimation and prediction model. The vector-form future trajectory information is transformed to determine the user's future trajectory, that is, the places or geographical locations the user may visit in the future.
[0068] Step 106: Recommend services to the user based on the user's future trajectory. In this step, based on the user's future trajectory, determine whether the locations the user might visit in the future are related to the business service. If they are related to the business service, recommend service-related information to the user; if they are not related to the business service, do not recommend service-related information to the user.
[0069] Figure 2 The diagram shown is a flowchart of a method for determining second historical trajectory information according to an embodiment of this paper, which specifically includes the following steps:
[0070] Step 201: Input the vector representation of each trajectory point in the second historical trajectory information into a pre-trained importance determination model to obtain the importance of each trajectory point in the second historical trajectory data. In this step, the importance of each trajectory point is determined by... Specifically, during the training process of the importance determination model, the importance of the second historical trajectory data is pre-determined based on the business importance. In some embodiments of this specification, some trajectory data in the user's historical trajectory data is valuable or important to the business, for example, the user went to a bank or a sales center. In other embodiments of this specification, some trajectory data in the user's historical trajectory data is meaningless to the business, for example, the user went home or went to the cafeteria. Unlike manually assigning importance to all trajectory points in the target user's trajectory data, this step can use the importance determination model, combined with factors such as user preferences and user social relationships, to calculate the importance of each trajectory point in the target user's second historical trajectory data.
[0071] Step 202: Determine the second historical trajectory information based on the sum of the products of the importance of each trajectory point and the vector representation of each trajectory point.
[0072] In this step, the second historical trajectory information is determined according to the following formula: ,in, The calculated second historical trajectory information is given by j, which represents the j-th trajectory point, and m, which represents the total number of trajectory points. Indicates the first in the sequence The importance of each trajectory point This indicates the second historical trajectory data TC. Each trajectory point in the second historical trajectory data is multiplied by its importance, and the sum of these products is used to determine the second historical trajectory information. For example, if the second historical trajectory corresponds to trajectory data from the last five days, with 24 trajectory points collected each day, then m is 120. According to step 201, the importance of each of the 120 trajectory points is obtained, and the second historical trajectory information for these 120 points is determined according to the formula in step 202. The second historical trajectory information is represented by a vector.
[0073] Figure 3 The diagram shown is a flowchart of a method for training an importance determination model according to an embodiment of this paper, which includes the following steps:
[0074] Step 301: Obtain historical user trajectory sample data, which includes historical trajectory sample data and second historical trajectory sample data. In this step, the obtained historical user trajectory sample data differs from the target user's trajectory data. The historical user trajectory sample data can be historical trajectory data from multiple users or a large number of users, and is used as sample data for training the model. Furthermore, the historical user trajectory sample data is also divided into first historical trajectory sample data and second historical trajectory sample data based on time proximity.
[0075] Step 302: Establish an initial model for importance determination. The initial model for importance determination is expressed by the following formula:
[0076] ;in, Indicates the first trajectory points The initial importance, and Let be the parameter matrix, containing the parameters to be trained. The first in the second historical trajectory sample data Each sample trajectory point. In this step, through... The formula is used to construct the importance determination initial model, and the output of the initial model is the importance of the sample trajectory points corresponding to the sample trajectory data. In this step, the attention mechanism is used to obtain the importance / attention value of each sample trajectory point in the second historical trajectory sample data, and the final result is obtained by summing the product of the importance of each trajectory point and its vector.
[0077] Step 303: Construct the loss function for the initial model based on importance. The formula for the loss function is as follows:
[0078] ,in, Let x be the similarity metric function, representing the importance that determines the prediction result of the initial model, i.e., the initial importance. , This represents the positive samples corresponding to the training data. For the negative samples corresponding to the training data, Q Indicates the number of negative samples. S This represents the loss function. In this step, using the idea of contrastive learning, each training data point corresponds to a correct result, called a positive sample, which in this step represents the true value of importance. Several incorrect results are then randomly sampled, called negative samples, which in this step represent the error values of importance. The training objective is to ensure that the correlation between positive samples and the prediction results of the initial importance model is as high as possible, greater than the correlation between negative samples and the prediction results of the initial importance model. The training of the initial importance model utilizes contrastive learning to construct positive and negative samples, learning information between different trajectory points, distinguishing between true and incorrect trajectories, and effectively improving the accuracy of model training.
[0079] Step 304: Based on the second historical trajectory sample data and the loss function, train an initial importance determination model to obtain the importance determination model. Specifically, input the second historical trajectory sample data into the initial importance determination model to obtain the initial importance output by the model. Then, combining the loss function, based on the difference between the initial importance and the true importance value, train the training parameters in the initial importance determination model until the loss function converges to a certain range. Thus, the importance determination model is trained.
[0080] Figure 4 The diagram shown is a flowchart of a method for determining a training trajectory prediction model according to an embodiment of this paper, which specifically includes the following steps:
[0081] Step 401: Extract the first historical trajectory sample information from the user's historical trajectory sample data. This step is similar to step 102, obtaining the first historical trajectory sample information by extracting the vector representation of the first historical trajectory sample data from the user's historical trajectory sample data.
[0082] Step 402: Determine the second historical trajectory sample information based on the importance of each trajectory point in the second historical trajectory sample data. This step determines the importance of trajectory points by referring to the description in step 302, determining the initial model based on the importance, and then determining the importance of each trajectory point in the second historical trajectory sample data. The second historical trajectory sample information can be obtained by summing the products of the importance of each trajectory point in the second historical sample data and the vector representation of each trajectory point.
[0083] Step 403: Establish an initial trajectory prediction model in advance. The formula for the initial trajectory prediction model is as follows:
[0084] ;
[0085] ,in, n It is a positive integer not greater than 3. W n Indicates the first n A matrix to be trained, The initial information for the future trajectory predicted by the initial trajectory prediction model. This refers to the raw information of the future trajectory calculated based on the first historical trajectory information sample data and the second historical trajectory information sample data. The matrix to be trained, Let be the vector to be trained. b n Indicates the first n A vector to be trained, This represents the information of the first historical trajectory sample. This is the second historical trajectory sample information. In this step, the first and second historical sample trajectory information are integrated into a matrix form, and then combined with the matrix to be trained. Multiply and combine with the vector to be trained. To obtain the raw information of the predicted future trajectory. The original information of the future trajectory. Substituting the initial model into the trajectory prediction model, the initial information of the future trajectory is output. In subsequent steps, the initial information of the future trajectory is obtained by training the initial model of trajectory prediction.
[0086] Step 404: Construct the loss function for the initial trajectory prediction model. The formula for the initial trajectory prediction model is as follows: ,in, For similarity measurement function, x The importance value determines the prediction results of the initial model, i.e., the initial importance value. , This represents the positive samples corresponding to the training data. These are the negative samples corresponding to the training data. The concept for constructing the loss function in this step is similar to that in step 303, and will not be elaborated upon here.
[0087] Step 405: Based on the first historical trajectory sample information, the second historical trajectory sample information, and the loss function, train the initial trajectory prediction model to obtain the trajectory prediction model. Specifically, input the second historical trajectory sample data into the initial trajectory prediction model to obtain the initial trajectory information for the future trajectory. Combined with the loss function, based on the difference between the estimated initial trajectory information and the true value of the future trajectory information, train the training parameters in the initial trajectory prediction model until the loss function converges to a certain range. Thus, the trajectory prediction model is trained. This invention extracts historical information from user trajectory information, uses a self-designed neural network to remove meaningless information from the trajectory information, and utilizes the idea of contrastive learning to construct a loss function to train the model, which can greatly improve the accuracy of the prediction results.
[0088] Figure 5 The diagram shown is a flowchart of a method for determining the future trajectory of a target user according to an embodiment of this paper, which includes the following steps:
[0089] Step 501: Analyze the multiple classification probability values of each trajectory point in the future trajectory information using the softmax function. Based on the trajectory prediction model determined in the preceding steps, the output future trajectory information may include different predicted values.
[0090] In some embodiments of this specification, the future trajectory information output by the trajectory prediction model can be the trajectory information of a single trajectory point at a future time. In other embodiments of this specification, the future trajectory information output by the trajectory prediction model can be the trajectory information of multiple trajectory points over a future period. Furthermore, in this step, the future trajectory information output by the trajectory prediction model is data in vector form. Therefore, correspondingly, the softmax function is used to classify the future trajectory information output by the trajectory prediction model to obtain the results of trajectory points belonging to different categories. For example, if the future trajectory information output by the trajectory prediction model is the future trajectory information of a single trajectory point at a future time, the probability values predicted by the softmax function for the future trajectory information of the trajectory point are 0.6, 0.3, and 0.2, respectively, where each probability value corresponds to the trajectory point belonging to three different coordinate triplets. For example, the triplet corresponding to a probability value of 0.6 is (0001, 23.212, 52.254); the triplet corresponding to a probability value of 0.3 is (0001, 28.369, 34.869); and the triplet corresponding to a probability value of 0.2 is (0001, 31.257, 33.262). As another example, the softmax function predicts the future trajectory information of another potential trajectory point with probability values of 0.7, 0.15, 0.1, and 0.05, where each probability value corresponds to the trajectory point belonging to four different coordinate quadruples. The quaternion corresponding to a probability value of 0.7 is (0001, 23.211, 68.321, 2022081801); the quaternion corresponding to a probability value of 0.15 is (0001, 26.365, 23.254, 2022081802); the quaternion corresponding to a probability value of 0.1 is (0001, 20.224, 23.369, 2022081803); and the quaternion corresponding to a probability value of 0.05 is (0001, 18.693, 41.235, 2022081804).
[0091] Step 502: Select the trajectory point corresponding to the highest probability value as the final trajectory point for future trajectory information. For example, in the embodiment of step 501, the highest probability value is 0.6, and the triple corresponding to this probability value is used as the final trajectory point for future estimated information.
[0092] Step 503: Determine the user's future trajectory based on the final trajectory points and the preset trajectory table, where the preset trajectory table records the mapping relationship between each final trajectory point and its actual geographical location. The final trajectory points determined in Step 502 are in the form of an array of triples. In this step, it is necessary to further convert the triple representation of the final trajectory points into a specific location corresponding to the spatial geographical location. Based on the preset trajectory table, the mapping relationship between the triples corresponding to the final trajectory points determined in Step 502 and the actual geographical locations recorded in the preset trajectory table is used to determine the real location corresponding to the triples of the final trajectory points. For example, if the location corresponding to the triple (0001,23,52) of the final trajectory point is a bank, then the bank is the predicted future trajectory of the target user.
[0093] Figure 6 The diagram shown is a flowchart of a method for recommending services to target users according to an embodiment of this paper, which specifically includes the following steps:
[0094] Step 601: Determine whether the user's future trajectory is related to the service. Based on the relationship between the target user's future trajectory determined in step 503 and the company's business services, subsequent steps will determine whether to provide the user with services such as route planning or activity recommendations.
[0095] Step 602: If the target user's future trajectory is related to the service, push service recommendation information to the target user according to a preset time period. Specifically, natural language processing algorithms can be used to extract keywords from the target user's future trajectory and match them with the enterprise's preset business keywords. For example, if the target user's future trajectory is determined to be related to a bank by extracting keywords, and it is determined that the similarity between the target user's future trajectory and the enterprise's business keywords is high, then the target user's future trajectory is determined to be related to the service, and service recommendation information or route planning information is pushed to the target user at certain time intervals. Furthermore, the target user can be identified as a potential user to support other business needs.
[0096] Step 603: If the target user's future trajectory is unrelated to the service, then no service recommendation information will be pushed to the user. For example, if the target user's future trajectory is determined to be the cafeteria by extracting keywords, and it is determined that the similarity between the target user's future trajectory and the company's business keywords is low, then the target user's future trajectory is determined to be unrelated to the service, and no information will be provided to the target user.
[0097] like Figure 7 The diagram shown is a schematic representation of a service recommendation device based on a target user trajectory according to an embodiment of this paper. The basic structure of the user trajectory-based service recommendation device is illustrated in this diagram. The functional units and modules can be implemented in software, or using general-purpose chips or specific chips. The device specifically includes:
[0098] Data acquisition unit 701 is used to acquire target user trajectory data, the target user trajectory data including first historical trajectory data and second historical trajectory data;
[0099] The first historical trajectory information extraction unit 702 is used to extract the vector representation of the first historical trajectory data from the first historical trajectory data to obtain the first historical trajectory information.
[0100] The second historical trajectory information extraction unit 703 is used to determine the second historical trajectory information based on the importance of each trajectory point in the second historical trajectory data.
[0101] The future trajectory information determination unit 704 is used to input the first historical trajectory information and the second historical trajectory information into a pre-trained trajectory prediction model to obtain future trajectory information;
[0102] The future trajectory determination unit 705 is used to determine the user's future trajectory based on future trajectory information;
[0103] The service recommendation unit 706 is used to recommend services to the user based on the user's future trajectory.
[0104] This solution uses user data left in various software applications as trajectory information, greatly facilitating the collection of user trajectory data and enabling real-time updates. This invention utilizes LSTM to extract historical information from user trajectory data, removing meaningless information, and employs contrastive learning to construct a loss function to train the model, significantly improving the accuracy of prediction results. This invention can help users plan routes in advance, and also help bank staff identify potential customers and their business needs early, thereby providing them with better advice and services.
[0105] As one embodiment of this article, reference may also be made to, for example, Figure 8 The diagram shown is a schematic representation of the specific structure of the service recommendation device based on user trajectory in this embodiment.
[0106] As an embodiment of this article, the second historical trajectory information extraction unit 703 further includes: an importance determination module 7031, which is used to input the vector representation of each trajectory point in the second historical trajectory information into a pre-trained importance determination model to obtain the importance of each trajectory point in the second historical trajectory data;
[0107] Importance determination model training module 7032, used to train the importance determination model;
[0108] As one embodiment of this document, the future trajectory information determination unit 704 further includes:
[0109] The trajectory prediction model training module 7041 is used to train the trajectory prediction model.
[0110] like Figure 9 The diagram illustrates a computer device provided in this embodiment. The apparatus described herein can be the computer device in this embodiment, performing the methods described above. The computer device 902 may include one or more processors 904, such as one or more central processing units (CPUs), each of which can implement one or more hardware threads. The computer device 902 may also include any memory 906 for storing information of any kind, such as code, settings, data, etc. Non-limitingly, for example, the memory 906 may include any type of RAM, any type of ROM, flash memory, hard disk, optical disk, etc. More generally, any memory can use any technology to store information. Further, any memory can provide volatile or non-volatile retention of information. Further, any memory can represent a fixed or removable component of the computer device 902. In one case, when the processor 904 executes associated instructions stored in any memory or combination of memories, the computer device 902 can perform any operation of the associated instructions. The computer device 902 also includes one or more drive mechanisms 908 for interacting with any memory, such as hard disk drive mechanisms, optical disk drive mechanisms, etc.
[0111] Computer device 902 may also include an input / output module 910 (I / O) for receiving various inputs (via input device 912) and providing various outputs (via output device 914). A specific output mechanism may include a presentation device 916 and an associated graphical user interface (GUI) 918. In other embodiments, the input / output module 910 (I / O), input device 912, and output device 914 may be omitted, and the device may function solely as a computer device within a network. Computer device 902 may also include one or more network interfaces 920 for exchanging data with other devices via one or more communication links 922. One or more communication buses 924 couple the components described above together.
[0112] Communication link 922 can be implemented in any way, such as via a local area network (LAN), a wide area network (WAN) (e.g., the Internet), a point-to-point connection, or any combination thereof. Communication link 922 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.
[0113] Corresponding to Figures 1 to 6In addition to the methods described above, this embodiment also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the above-described methods.
[0114] This embodiment also provides a computer-readable instruction, wherein when a processor executes the instruction, the program therein causes the processor to perform the following: Figures 1 to 6 The method of demonstration.
[0115] It should be understood that in the various embodiments of this document, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this document.
[0116] It should also be understood that, in the embodiments herein, the term "and / or" is merely a description of the relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following associated objects have an "or" relationship.
[0117] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this document.
[0118] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0119] In the embodiments provided herein, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through some interfaces, devices, or units, or they may be electrical, mechanical, or other forms of connection.
[0120] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments described herein, depending on actual needs.
[0121] Furthermore, the functional units in the various embodiments of this document can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0122] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this paper, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this paper. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0123] This document uses specific embodiments to illustrate the principles and implementation methods of this document. The descriptions of the embodiments above are only for the purpose of helping to understand the methods and core ideas of this document. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this document. Therefore, the content of this specification should not be construed as a limitation of this document.
Claims
1. A service recommendation method based on user trajectory, characterized in that, The method includes: acquiring target user trajectory data, wherein the target user trajectory data includes first historical trajectory data and second historical trajectory data; The vector representation of the first historical trajectory data is extracted from the first historical trajectory data to obtain the first historical trajectory information; The second historical trajectory information is determined based on the importance of each trajectory point in the second historical trajectory data; The first historical trajectory information and the second historical trajectory information are input into a pre-trained trajectory prediction model to obtain future trajectory information; Determine the user's future trajectory based on future trajectory information; Based on the user's future trajectory, services are recommended to the user; The process of determining the second historical trajectory information based on the importance of each trajectory point in the second historical trajectory data includes: The vector representations of each trajectory point in the second historical trajectory information are input into a pre-trained importance determination model to obtain the importance of each trajectory point in the second historical trajectory data. The second historical trajectory information is determined by summing the products of the importance of each trajectory point and the vector representation of each trajectory point; The training process of the importance determination model includes: Acquire historical sample data of user trajectory, which includes first historical trajectory sample data and second historical trajectory sample data; The initial model is determined by pre-establishing importance using the following formula: ;in, Indicates the first trajectory points The initial importance, and Let be the parameter matrix, containing the parameters to be trained. For the first historical trajectory sample data One sample trajectory point; The loss function for the initial trajectory prediction model is constructed using the following formula: ,in, Let x be the similarity metric function, representing the importance that determines the prediction result of the initial model, i.e., the initial importance. , This represents the positive samples corresponding to the training data. For the negative samples corresponding to the training data, Q represents the number of negative samples, and S represents the loss function; Based on the second historical trajectory sample data and the loss function, an initial importance determination model is trained to obtain the importance determination model.
2. The service recommendation method based on user trajectory according to claim 1, characterized in that, The training process of the trajectory prediction model includes: Extract the first historical trajectory sample information from the user's historical trajectory sample data; The information of the second historical trajectory sample is determined based on the importance of each trajectory point in the second historical trajectory sample data; An initial trajectory prediction model is pre-established based on the following formula: ; , Construct the loss function using the following formula: ,in, Here, x is the similarity metric function, representing the prediction result of the initial trajectory prediction model, i.e., the initial information of the future trajectory. , This represents the positive samples corresponding to the training data. Let W be the negative sample corresponding to the training data, and let W be the matrix to be trained. n Let b represent the nth matrix to be trained. n Let b represent the nth vector, b represent the vector to be trained, and L represent the initial information of the future trajectory predicted by the initial trajectory prediction model. h L represents the first historical trajectory sample information. c L represents the second historical trajectory sample information. o The raw information of the future trajectory calculated based on the first historical trajectory information sample data and the second historical trajectory information sample data; Based on the first historical trajectory sample information, the second historical trajectory sample information, and the loss function, an initial trajectory prediction model is trained to obtain the trajectory prediction model.
3. The service recommendation method based on user trajectory according to claim 1, characterized in that, Determining a user's future trajectory includes: The softmax function is used to analyze multiple classification probability values of each trajectory point in the future trajectory information; Select the trajectory point corresponding to the highest probability value as the final trajectory point for future trajectory information; Based on the final trajectory points and the preset trajectory table, the future trajectory of the target user is determined, wherein the preset trajectory table is used to record the mapping relationship between each final trajectory point and the actual geographical location.
4. The service recommendation method based on user trajectory according to claim 1, characterized in that, The service recommended to the user includes: Determine whether the target user's future trajectory is related to the service; If the future trajectory of the target user is related to the service, service recommendation information will be pushed to the target user according to a preset time period; If the target user's future trajectory is not related to the service, then no service recommendation information will be pushed to the user.
5. The service recommendation method based on user trajectory according to claim 1, characterized in that, The acquisition of target user trajectory data also includes: processing the target user trajectory data into time series data.
6. A service recommendation device based on user trajectory, characterized in that, The device includes: A data acquisition unit is used to acquire target user trajectory data, the target user trajectory data including first historical trajectory data and second historical trajectory data; The first historical trajectory information extraction unit is used to extract the vector representation of the first historical trajectory data from the first historical trajectory data to obtain the first historical trajectory information. The second historical trajectory information extraction unit is used to determine the second historical trajectory information based on the importance of each trajectory point in the second historical trajectory data. The future trajectory information determination unit is used to input the first historical trajectory information and the second historical trajectory information into a pre-trained trajectory prediction model to obtain future trajectory information; The future trajectory determination unit is used to determine the user's future trajectory based on future trajectory information. A service recommendation unit is used to recommend services to the user based on the user's future trajectory; The second historical trajectory information extraction unit is specifically used for: The vector representations of each trajectory point in the second historical trajectory information are input into a pre-trained importance determination model to obtain the importance of each trajectory point in the second historical trajectory data. The second historical trajectory information is determined by summing the products of the importance of each trajectory point and the vector representation of each trajectory point; The training process of the importance determination model includes: Acquire historical sample data of user trajectory, which includes first historical trajectory sample data and second historical trajectory sample data; The initial model is determined by pre-establishing importance using the following formula: ;in, Indicates the first trajectory points The initial importance, and Let be the parameter matrix, containing the parameters to be trained. For the first historical trajectory sample data One sample trajectory point; The loss function for the initial trajectory prediction model is constructed using the following formula: ,in, Let x be the similarity metric function, representing the importance that determines the prediction result of the initial model, i.e., the initial importance. , This represents the positive samples corresponding to the training data. For the negative samples corresponding to the training data, Q represents the number of negative samples, and S represents the loss function; Based on the second historical trajectory sample data and the loss function, an initial importance determination model is trained to obtain the importance determination model.
7. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 5.