Model feature processing method and apparatus
By receiving feature processing requests in the recommendation model, generating and updating feature arrays, signing and determining feature vectors, the problems of low feature processing efficiency and high storage pressure are solved, achieving more efficient feature processing and storage optimization.
Patent Information
- Application Number
- CN202310281709.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-20
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2043-03-20
AI Technical Summary
Existing recommendation models suffer from low feature processing efficiency and high online database storage pressure, making it impossible to introduce class features in online scenarios, which limits the flexibility and effectiveness of recommendation models.
By receiving feature processing requests, determining model features and updating them based on a pre-created variable array, generating a model feature array, reading feature variable values to sign them, obtaining feature signatures, and determining feature vectors for calculating recommendation scores, feature processing efficiency is improved and storage efficiency is optimized.
It improves the efficiency of model feature preprocessing, reduces database storage pressure, and enhances the flexibility and processing efficiency of recommendation models.
Smart Images

Figure CN116431906B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method for processing model features. This application also relates to a model feature processing apparatus, a computing device, and a computer-readable storage medium. Background Technology
[0002] With the development of the internet, the application of various recommendation models is becoming increasingly widespread. In this process, the number of model features involved in recommendation models is constantly increasing, resulting in long preprocessing times for these features in practical applications. Currently, to improve the efficiency of feature processing in recommendation models, recommendation results for each user can be generated offline and pre-stored in an online database. Then, the pre-stored data can be directly retrieved and recommended to users in the online environment. However, the sheer scale of the user and recommendation result combinations that need to be stored puts a strain on the online database. Furthermore, the inability to incorporate online scenario-based features limits the flexibility and effectiveness of the recommendation model. Therefore, a solution to these problems is urgently needed. Summary of the Invention
[0003] In view of this, embodiments of this application provide a model feature processing method. This application also relates to a model feature processing apparatus, a computing device, and a computer-readable storage medium, to solve the problems of low feature processing efficiency and high online database storage pressure in the prior art.
[0004] According to a first aspect of the embodiments of this application, a model feature processing method is provided, including:
[0005] Determine model features in response to feature processing requests;
[0006] The pre-created variable array is updated based on the model features, and a model feature array is generated based on the update results;
[0007] Read the feature variable values corresponding to the model features from the model feature array, and obtain the feature signature corresponding to the model features by signing the feature variable values;
[0008] Based on the feature signature, the feature vector corresponding to the model feature is determined, wherein the feature vector is used to calculate the recommendation score of the information to be recommended.
[0009] According to a second aspect of the embodiments of this application, a model feature processing apparatus is provided, comprising:
[0010] The determination module is configured to determine model features in response to feature processing requests;
[0011] The generation module is configured to update a pre-created variable array based on the model features, and generate a model feature array based on the update results;
[0012] The signature module is configured to read the feature variable values corresponding to the model features from the model feature array, and obtain the feature signature corresponding to the model features by signing the feature variable values;
[0013] The vector determination module is configured to determine the feature vector corresponding to the model feature based on the feature signature, wherein the feature vector is used to calculate the recommendation score of the information to be recommended.
[0014] According to a third aspect of the embodiments of this application, a computing device is provided, including a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor executes the computer instructions to implement the steps of the model feature processing method.
[0015] According to a fourth aspect of the embodiments of this application, a computer-readable storage medium is provided that stores computer instructions which, when executed by a processor, implement the steps of the model feature processing method.
[0016] The model feature processing method provided in this application aims to improve the processing efficiency of model features. It receives a feature processing request and determines model features in response to the request. Based on the model features, it updates a pre-created variable array and generates a model feature array based on the update result. This allows the acquired model features to be stored in the variable array. The method reads the feature variable values corresponding to the model features from the model feature array and obtains the feature signature corresponding to the model features by signing the feature variable values. Then, it determines the feature vector corresponding to the model features based on the feature signature. The feature vector is used to calculate the recommendation score of the information to be recommended. This method achieves the determination of the required feature inputs for the model through the calculated feature signature of the model features, improving the preprocessing efficiency of model features. Furthermore, during the model feature processing, it directly accesses and stores the feature variables in the pre-created variable array, improving the space allocation efficiency and storage efficiency of model features, further enhancing the processing efficiency of model features. Attached Figure Description
[0017] Figure 1 This is a schematic diagram of a model feature processing method provided in an embodiment of this application;
[0018] Figure 2 This is an interactive schematic diagram of a model feature processing method provided in an embodiment of this application;
[0019] Figure 3This is a flowchart of a model feature processing method provided in an embodiment of this application;
[0020] Figure 4 This is a schematic diagram of model preprocessing in a model feature processing method provided in an embodiment of this application;
[0021] Figure 5 This is a schematic diagram illustrating the creation of combined features in a model feature processing method provided in an embodiment of this application;
[0022] Figure 6 This is a schematic diagram of a variable array in a model feature processing method provided in an embodiment of this application;
[0023] Figure 7 This is a schematic diagram illustrating the calculation of a feature signature in a model feature processing method provided in an embodiment of this application;
[0024] Figure 8 This is a flowchart illustrating a model feature processing method for an advertising creative recommendation scenario provided in one embodiment of this application.
[0025] Figure 9 This is a schematic diagram of the structure of a model feature processing device provided in an embodiment of this application;
[0026] Figure 10 This is a structural block diagram of a computing device provided in one embodiment of this application. Detailed Implementation
[0027] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.
[0028] The terminology used in one or more embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this application. The singular forms “a,” “the,” and “the” used in one or more embodiments of this application and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” used in one or more embodiments of this application refers to and includes any or all possible combinations of one or more associated listed items.
[0029] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this application, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0030] First, the terms and concepts involved in one or more embodiments of this application will be explained.
[0031] Model service: The process of deploying models in an online environment and performing model inference in real time based on user requests.
[0032] Model inference: Using machine learning models to predict unknown data points.
[0033] Characteristics: An abstract expression of information related to a certain process.
[0034] Feature combination: A new feature generated by merging two discrete features and the cross-combination of features.
[0035] Feature signature: The result obtained after encoding non-numerical features.
[0036] Embedding: Its main function is to transform sparse vectors into dense vectors, making them easier for upper-layer deep neural networks to process. Embedding uses a low-dimensional dense vector to represent an "object". Embedding vectors can express certain features of the corresponding object, and the distance between vectors reflects the similarity between objects.
[0037] See Figure 1The diagram illustrates how, to improve the efficiency of model feature processing, a feature processing request is received, and model features are determined in response. Based on the model features, a pre-created variable array is updated, and a model feature array is generated according to the update result. This allows the acquired model features to be stored in the variable array. The feature variable values corresponding to the model features are read from the model feature array, and a feature signature is obtained by signing the feature variable values. Then, a feature vector corresponding to the model feature is determined based on the feature signature. The feature vector is used to calculate the recommendation score of the information to be recommended. This achieves the determination of the required feature inputs for the model through the calculated feature signatures of the model features, improving the preprocessing efficiency of model features. Furthermore, during model feature processing, the characteristic variables in the pre-created variable array are directly accessed, improving the space allocation efficiency and storage efficiency of model features, further enhancing the processing efficiency of model features.
[0038] In practical applications, taking the online deployment of deep learning models as an example, using a deep learning model as a recommendation model, the embodiments in this specification are as follows: Figure 2 As shown, upon receiving an online request (such as a recommendation request), the system acquires the model features required by the online model service and calculates a feature signature for each feature. Then, using this feature signature as a key, it retrieves the corresponding feature vector from the online storage service. After obtaining the corresponding feature vector, it inputs the feature vector into the deep learning model for recommendation processing, obtaining the deep learning model's score for the information to be recommended.
[0039] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0040] This application provides a model feature processing method, and also relates to a model feature processing apparatus, a computing device, and a computer-readable storage medium, which will be described in detail in the following embodiments.
[0041] Figure 3 The flowchart illustrates a model feature processing method according to an embodiment of this application, applied to a server, and specifically includes the following steps:
[0042] Step 302: Determine model features in response to feature processing request.
[0043] Specifically, a feature processing request is a request to process the model features of an algorithm model, used to pre-acquire and compute the input features required by the deep learning model.
[0044] In practical implementation, for online model services, to reduce the computational load and minimize latency issues encountered by users, this embodiment pre-acquires the features required for model inference online and preprocesses these features. The preprocessed results are then used by the online model service for model processing to obtain the final model result.
[0045] In practical implementation, considering that the number of model features may be quite large, creating the variables required in the process of acquiring model features would reduce the efficiency of feature acquisition. Therefore, in this embodiment, before determining model features in response to a feature processing request, the process further includes:
[0046] Obtain the feature processing script;
[0047] By executing the feature processing script, an initial array of variables and a feature processing program are created.
[0048] Specifically, a feature processing script refers to a pre-coded script used to acquire and process model features. This script is written in a scripting language, abstracting the basic functionalities required for feature acquisition and computation into function operators, and providing a unified API (Application Programming Interface) for invocation. The algorithm does not need to concern itself with the internal implementation details of the functions, and performance optimizations and upgrades of the operators are imperceptible to the algorithm. This allows algorithm engineers to write high-performance feature acquisition and computation code based on a fast operator invocation method. Specifically, the scripting language corresponding to the feature processing script can be a custom scripting language. Since using a scripting language for feature processing during online feature processing will reduce the efficiency of feature processing, in the embodiments of this specification, during the execution of the feature processing script, a feature processing program written in another, more efficient programming language will be generated based on the feature processing script.
[0049] Correspondingly, a feature processing program refers to a program created based on a feature processing script to acquire and process model features. In practice, to avoid temporarily compiling and executing the feature processing program during feature acquisition, the feature processing program can be a program object stored in memory, such as a C++ object or a Java object.
[0050] In practical applications, C++ is typically used as the programming language for code development to improve the processing efficiency of online model services. However, algorithm developers for these models usually only have basic experience with C++. Therefore, redeveloping a C++ version of the feature preprocessing code before the model goes live would significantly increase the workload, and the code quality could not be guaranteed. Therefore, this embodiment provides a scripting language for algorithm developers to write feature processing scripts for feature acquisition and calculation. This feature processing script can be updated to the server along with the model. When the online model service detects an update to the server-side model, it will download the updated model and its corresponding feature processing script to its local machine and replace the old model after successful loading. This process eliminates the need to redeploy a new version of the model, ensuring hot updates of the online model.
[0051] Correspondingly, the initial variable array refers to a pre-created template used to provide an array of variables required during feature processing. In practice, during the line-by-line parsing of the feature processing script, the variables used in each line are created, and static variables are assigned values. Each feature processing script can be represented as a C++ object, which stores the addresses of its input and output variables in the variable array. When each statement in the feature processing script is executed, the addresses of its input and output variables can be directly accessed, allowing direct manipulation of the variables without the need to create them again.
[0052] Before each execution of the feature processing script, all variables in the variable array are iterated through, and the states of Session and Temp type variables are invalidated for subsequent calculations. Variables generated by executing the feature processing script form the variable array. A C++ object manages all variables used during the execution of this feature processing script in the form of a variable pool (variable array). These variables can be divided into three types based on their lifecycle: Static type variables are static variables, whose values do not change after initialization; Session type variables are request variables, which remain unchanged in each feature processing request; and Temp type variables are temporary variables, which are deleted after one use. Furthermore, this custom scripting language supports basic operations: algorithmic operations, relational operations, logical operations, loop statements, control statements, etc. It also supports user-defined functions: providing a unified interface, users only need to provide the required operation code, which can be implemented with simple C++ code.
[0053] For example: when the feature processing script is written in a custom scripting language, obtain the feature processing script D1 written in the custom scripting language, and by executing the feature processing script D1, create an initial variable array to store the variables used in the execution of the feature processing script, and create a feature processing program P stored in memory. The feature processing program P is a C++ object.
[0054] In summary, by pre-executing the feature processing script and creating an initial variable array, the variables required for subsequent feature processing are pre-created, avoiding the need to create variables temporarily during feature processing. Furthermore, by creating a feature processing program, the direct use of the programming language corresponding to the feature processing program is avoided, thus lowering the barrier to developing feature acquisition code.
[0055] During model deployment, considering that online model services may offer various model usage services, this embodiment, in order to improve model deployment efficiency, further includes the following step before determining model features in response to a feature processing request:
[0056] Obtain the model configuration file;
[0057] Parse the model configuration file to obtain the model structure information;
[0058] A recommendation model is generated based on the aforementioned model structure information.
[0059] Specifically, a model configuration file is a pre-created file used to configure the recommendation model. This configuration file contains descriptive information about the model structure. Therefore, by parsing this configuration file, the model structure information can be obtained. This model structure information includes: the number of layers in the model, the model parameters, mapping functions, and other information.
[0060] Correspondingly, a recommendation model refers to analyzing relevant information about the user and the items to be recommended, filtering them using recommendation algorithms, finding recommended items that the user may be interested in (such as advertisements, videos, websites, etc.), and finally recommending them to the user.
[0061] Based on this, after parsing the model configuration file and obtaining the model structure information, the initial recommendation model (a simplified recommendation model without usage configuration) can be configured based on this model structure information. Furthermore, the model substructures corresponding to the model structure information (used to assemble the structure of the recommendation model) can be extracted from the model library (used to store various model substructures) based on this model structure information, and the extracted model substructures can be assembled to obtain the recommendation model.
[0062] It should be noted that this recommendation model can capture hidden information from massive amounts of input data. Therefore, before obtaining this recommendation model, rich features can be introduced as training samples, and the recommendation results can be used as the sample labels corresponding to the training samples to train the initial model, thereby improving the model's prediction performance until a deep model that meets the training cutoff condition is obtained. The model layer number, model parameters, and other information of this deep model are recorded, and a model configuration file is generated based on this information.
[0063] For example: obtain the model configuration file D2 used to configure the recommendation model, parse the model configuration file D2 to obtain the model file information: the number of model layers N, and the mapping function F1, then configure the initial recommendation model as a recommendation model M with N model layers and carrying the mapping function F1 based on the number of model layers N.
[0064] In summary, creating recommendation models based on model configuration files avoids directly publishing complete recommendation models, thus improving the flexibility and efficiency of recommendation model deployment.
[0065] Furthermore, since the features required by the recommendation model (i.e., model features) are also determined after the recommendation model is configured, in order to further improve the efficiency of model feature preprocessing, this embodiment further includes the following steps before determining model features in response to a feature processing request:
[0066] Obtain the feature vector file;
[0067] Read the correspondence between the preset feature signature and the preset feature vector in the feature vector file, and store the correspondence in the vector database.
[0068] Specifically, a feature vector file refers to a pre-created file containing the correspondence between preset feature signatures and preset feature vectors corresponding to the recommendation model. The preset feature signature refers to the feature signature pre-set for the model features of the recommendation model. The preset feature vector refers to the vector representation of the model features of the recommendation model pre-created. Correspondingly, a vector database refers to a database that stores the correspondence between preset feature signatures and preset feature vectors. This database can be an HBase database, a Redis database, an Oracle database, etc., without limitation. This vector database provides a query service for feature vectors based on feature signatures.
[0069] For example: obtain a pre-created feature vector file D3, read the correspondence between the preset feature signature and the preset feature vector contained in the feature vector file D3, and store the correspondence in the Redis database.
[0070] In summary, by acquiring feature vector files and pre-storing the correspondence between preset feature signatures and preset feature vectors in a vector database, the corresponding vector representation can be queried based on the feature signature of the model feature during the feature acquisition process. This avoids calculating the vector representation of the model feature during the feature acquisition process and improves the efficiency of model feature preprocessing.
[0071] Specifically, such as Figure 4 As shown, for deep model A, before deployment, it is necessary to prepare a model structure description file (i.e., model configuration file), a feature processing script, and a vector mapping (embedding) file (i.e., feature vector file). The model structure description file is used for online model configuration; the feature processing script is used for online preprocessing of the model's input features; and the vector mapping file is stored in an online database, allowing the corresponding feature vectors to be retrieved via feature signatures.
[0072] In practical applications, to improve the processing efficiency of online algorithm models, C++ is typically used for feature acquisition and computation. However, when algorithm engineers develop in C++, code quality is difficult to guarantee, and subsequent maintenance is challenging. While direct development by C++ developers can ensure code quality, the large amount of repetitive code consumes significant time, and the resulting code expansion hinders later maintenance. Therefore, to lower the programming barrier for algorithm engineers and improve the efficiency of feature processing, this specification demonstrates the invocation of a feature processing program obtained after converting the encoding language, and the processing of model features through the execution of the feature processing program. The specific implementation of determining model features in response to feature processing requests is shown below:
[0073] In response to a feature processing request, the feature processing program corresponding to the feature processing request is determined and invoked, wherein the feature processing program is obtained by converting the feature processing script corresponding to the feature processing request into a programming language;
[0074] By executing the feature processing procedure, the model features corresponding to the feature processing request are determined.
[0075] Specifically, the feature processing script corresponding to the feature processing request is pre-translated into a programming language to obtain the feature processing program. This can be understood as converting part or all of the feature processing script into a programming language by executing the script to obtain the feature processing program. During the conversion process, the syntax tree can be called line by line to parse the feature processing script and obtain the feature processing program.
[0076] After creating a feature processing program and receiving a feature processing request, the corresponding feature processing program is determined. Specifically, this can be based on the model information or program information carried in the feature processing request, and on a pre-defined correspondence between the model information or program information and the feature processing program. Further, the determined feature processing program is invoked and executed. Specifically, executing the feature processing program refers to executing the sequence of program instructions within it. During execution, the model features required by the deep learning model corresponding to the feature processing request are determined.
[0077] Therefore, when feature processing is required, a feature processing request is typically submitted to the server. Upon receiving the request, the server directly invokes the feature processing program corresponding to the request, which is obtained through programming language conversion. The server then executes the feature processing program to acquire and calculate model features, obtaining the feature processing results, and finally performs model processing based on these results.
[0078] Following the previous example, based on the received feature processing request Q, the corresponding feature processing program P is determined according to the model identifier M carried in the feature processing request, and the feature processing program P is called. The model features of the recommended model M are determined by executing the feature processing program P.
[0079] In this embodiment, based on the deep learning model being a recommendation model and having obtained the user information and recommendation information corresponding to the feature processing request through parsing, the step of determining the model features corresponding to the feature processing request by executing the feature processing program includes:
[0080] The user information and the information to be recommended are configured into the feature processing program, and the model features are determined by executing the configured feature processing program.
[0081] Specifically, configuring user information and information to be recommended into the feature processing program can be understood as using user information and information to be recommended as input to the feature processing program, so that they can be processed during the execution of the feature processing program to obtain the model features required by the recommendation model.
[0082] Furthermore, considering that if a single feature is used as the input to the recommendation model (i.e., only a single feature is used for training during the recommendation model training process), the model accuracy may not meet expectations. Therefore, in order to improve the recommendation accuracy of the recommendation model, in this embodiment, the determination of model features in response to the feature acquisition request is specifically implemented as follows:
[0083] Receive feature processing request;
[0084] Determine at least two initial features corresponding to the feature processing request;
[0085] The feature elements in each initial feature are combined according to a preset feature combination strategy to obtain combined features;
[0086] At least two initial features and the combined features are used as the model features.
[0087] Specifically, initial features refer to features that reflect a single dimension, such as initial user features and / or initial recommendation features. Combined features, on the other hand, are features formed by combining two or more initial features. In practice, increasing the dimensionality of features through feature combination can lead to better model accuracy.
[0088] Correspondingly, a feature element refers to the element contained within a feature. In practical applications, there are features that contain a single feature element, as well as features that contain multiple feature elements. For example, the feature "gender" will ultimately only have one value, either "male" or "female," so it's easy to understand that the feature "gender" contains only one feature element. In real life, there are also features that have multiple possible values simultaneously. For example, the feature value of "user's current location" can be composed of three feature elements: {"country A", "province B", and "city C"}.
[0089] Correspondingly, a preset feature combination strategy refers to a pre-set strategy for combining feature elements from initial features. Specifically, this preset feature combination strategy can be to select at least one feature element from any two initial features for combination. Alternatively, it can be to select one feature element from each initial feature for combination. For example, if there are three initial features A, B, and C, the resulting new combined features will contain three elements belonging to A, B, and C respectively. Therefore, based on permutation and combination knowledge, features A, B, and C have six possible combinations: {a1, b1, c1}, {a2, b1, c1}, {a3, b1, c1}, {a1, null, c1}, {a2, null, c1}, and {a3, null, c1}.
[0090] Furthermore, the preset feature combination strategy can also be other strategies, which are not limited here. Based on the creation of combined features according to the preset feature combination strategy, at least two initial features and the combined features are used as model features of the recommendation model.
[0091] Based on this, upon receiving a feature processing request, the initial feature corresponding to the feature processing request is first determined, that is, the initial feature is extracted from the information associated with the feature processing request. Then, the feature elements in the initial feature are combined to create a combined feature, so as to obtain the feature dimension of the feature through the combination of feature elements. Finally, the initial feature and the combined feature are used together as the model features obtained for the recommendation model for subsequent feature processing.
[0092] In summary, based on the initial features corresponding to the feature processing request, the feature elements of the initial features are combined to generate combined features, and the initial features and combined features are used as model features. This increases the feature dimension of the model features and improves the prediction accuracy of the recommendation model.
[0093] Furthermore, based on the deep learning model as a recommendation model, it is necessary to obtain the user information to be recommended, as well as the related recommendation information of that user, and further extract relevant initial features from this information to ensure the completeness of the initial feature acquisition and the accuracy of the features required by the recommendation model. In this embodiment, determining at least two initial features corresponding to the feature acquisition request also includes:
[0094] The feature processing request is parsed to determine the user information and recommendation information corresponding to the feature processing request;
[0095] At least one initial user feature is extracted from the user information, and at least one initial recommendation feature is extracted from the information to be recommended, and the at least one initial user feature and the at least one initial recommendation feature are used as at least two initial features.
[0096] Specifically, user information refers to information about the user to be recommended, such as the user's age, gender, and location. Recommendation information refers to information about the object (item, video, advertisement, etc.) to be recommended to the user. Initial user characteristics refer to features associated with the user, such as age, gender, and location. Initial recommendation features refer to features associated with the object to be recommended; for example, if the object to be recommended is a product, the product's color, style, and purpose are initial recommendation features. If the object to be recommended is a video, the video's name and main actors are initial recommendation information.
[0097] Based on this, by parsing the feature processing request after receiving it, we can determine the information directly carried in the request, or the related information that can be further obtained based on the carried information. In specific implementation, the user information and the information to be recommended can be the information directly carried in the feature processing request, or the corresponding user information can be obtained based on, for example, a user identifier carried in the feature processing request, and / or the corresponding information to be recommended can be obtained based on, for example, an identifier carried in the feature processing request. Based on determining the user information and the information to be recommended corresponding to the feature processing request, initial user features and initial recommendation features are extracted from the user information and the information to be recommended, respectively, as initial features.
[0098] For example, receiving an online feature processing request Q for a recommendation model, parsing the request to determine the user's gender and location, as well as the color and name of the recommended item 1 and recommended item 2. From the user information, extract gender ({female}) and location ({"Country A", "Province B", "City C") as initial user features. From the recommended item information, extract the color ({red, green}) and name ({A1}) of item 1 as initial recommendation features, and from the recommended item information, extract the color ({yellow, green}) and name ({A2}) of item 2 as initial recommendation features. Then, use both the initial user features and the initial recommendation features as initial features IF, and select one feature element from each initial feature IF to create a combined feature CF. Finally, use the initial feature IF and the combined feature CF as the model features MF corresponding to the recommendation model M.
[0099] In summary, after receiving a feature processing request, the system determines the user information and the information to be recommended corresponding to the feature processing request, and extracts the initial user features and initial recommendation features required by the recommendation model, thus ensuring the completeness of the required features for feature acquisition.
[0100] Furthermore, considering the large number of initial features to be combined and / or the large element data of each initial feature, constructing all combined features using enumeration would result in low efficiency. To improve the efficiency of combined feature creation, in this embodiment, the feature elements in each initial feature are combined according to a preset feature combination strategy to obtain combined features. The specific implementation is as follows:
[0101] Determine the number of features for at least two initial features, and the number of elements in each feature element of each initial feature;
[0102] An initial matrix is created based on the number of features and the number of elements;
[0103] The initial matrix is updated using the feature elements arranged in a preset feature order and the preset element order of the feature elements in at least two initial features to obtain a feature element matrix;
[0104] The matrix elements in each column of the feature element matrix are combined to obtain the combined features.
[0105] Specifically, the number of features refers to the number of initial features. The number of elements refers to the number of feature elements contained in the initial features. In practical applications, after obtaining the initial features, the number of features and the number of elements in each initial feature are fixed. An initial matrix is created by using the number of features as the number of rows and the sum of the number of elements in each initial feature as the number of columns. The initial matrix is a matrix with a fixed number of rows and columns, and the initial values of the matrix elements in this initial matrix are 0 or empty.
[0106] Based on the initial matrix, the initial matrix is updated using the feature elements of each initial feature. Specifically, first, each row of the initial matrix corresponds to an initial feature according to the preset feature arrangement order (i.e., the pre-set arrangement order of the initial features). Then, in each row, the matrix elements in the initial matrix are assigned values sequentially according to the preset element arrangement order (i.e., the pre-set arrangement order of the feature elements contained in the initial features). Furthermore, for each row of matrix elements, if the number of matrix elements in a row exceeds the number of feature elements contained in the corresponding initial feature, the assignment of values to the feature elements in the corresponding initial feature of that row can be completed once, and then the assignment can continue from the first feature element in that initial feature until all matrix elements in that row have been assigned values.
[0107] Specifically, since the number of features and the number of elements in each initial feature are known, let the number of features be denoted as N, and the number of elements in each initial feature as M. i Let i represent the i-th initial feature. Each initial feature must provide one element to form a new combined feature. Then, the new combined features contain M{combinations} = N elements, and the number of possible combined features is... Therefore, an N×N {combination} matrix can be generated. Each row of this matrix is filled with a corresponding feature until the empty positions in that row are filled.
[0108] After assigning values to the entire initial matrix, a feature element matrix (i.e., a matrix containing the feature elements of the initial features) is obtained. The matrix elements in each column of the feature element matrix are then combined to generate the corresponding combined features for each column. For example, if the feature element matrix contains 6 columns, 6 combined features are generated, such as the final combined feature in the original text form "Shanghai_32_4m". These generated combined features are then used as part of the model's features.
[0109] Specifically, such as Figure 5 As shown, initial feature A includes 3 feature elements: a1, a2, a3. Initial feature B includes 2 feature elements: b1, null; initial feature C includes 1 feature element c1. Based on the number of initial features (3) and the total number of elements in each initial feature (3+2+1=6), a 3*6 initial matrix is constructed. Following the order of initial features A, B, and C, the 3 feature elements of initial feature A are repeatedly filled into the first row of the initial matrix in the order a1, a2, a3; the 2 feature elements of initial feature B are repeatedly filled into the second row of the initial matrix in the order b1, null; and the 1 feature element of initial feature C is filled into the third row of the initial matrix. This generates the following... Figure 5 The feature element matrix shown is used to generate 6 combined features by combining the matrix elements in each column of the feature element matrix.
[0110] It should be noted that for a trained recommendation model, the model features required for model inference do not change during the model's lifecycle. Therefore, the computational cost of this algorithm comes only from copying the array.
[0111] In summary, generating combined features by constructing matrices avoids the need to enumerate feature elements using computational resources, thus reducing the computational overhead of combined features.
[0112] Step 304: Update the pre-created variable array based on the model features, and generate a model feature array based on the update results.
[0113] Specifically, based on the aforementioned determination of model features, to facilitate subsequent processing of these features, they need to be stored in a pre-created variable array. This avoids the need to temporarily create feature variables to store feature values during the feature determination process. The variable array refers to a pre-created array that provides the variables required for feature processing.
[0114] In practical implementation, based on the creation of the initial variable array described above, considering that multiple feature processing requests may be received for the same deep learning model, and the next feature processing request may be received before the previous one is completed, it is necessary to avoid the previous feature processing request occupying the variable array pre-created based on the feature processing script during the feature acquisition process, thus causing the next feature processing request to be in a waiting state. Therefore, before executing step 304, the initial variable array needs to be copied to obtain a duplicate variable array, which will then be used as the variable array. Here, the duplicate variable array refers to a copy of the initial variable array. Based on the obtained duplicate variable array (variable array), all variables are stored and managed through this variable array during the execution of the feature processing program.
[0115] In practical applications, updating a pre-created variable array based on the model features refers to assigning values to the array elements of the variable array using the acquired model features during feature processing. It should be noted that this step can be performed after determining any model feature, updating the corresponding array element to obtain the updated variable array, i.e., the model feature array.
[0116] Furthermore, considering that the variable array may contain a large number of array elements, in order to improve the generation efficiency of the model feature array, in this embodiment, the pre-created variable array is updated based on the model features, and the model feature array is generated according to the update result. The specific implementation is as follows:
[0117] Determine the feature variables corresponding to the model features in a pre-created variable array, and the hash function of the hash table corresponding to the variable array;
[0118] Based on the hash function, hash calculation is performed on the feature variables corresponding to the model features to obtain the hash values corresponding to the feature variables;
[0119] Based on the hash value, query the hash table to obtain the storage location information of the feature variable in the variable array;
[0120] Using the model features, the feature variables corresponding to the storage location information in the variable array are assigned values to obtain the model feature array.
[0121] Specifically, feature variables refer to pre-created variables in a variable array used to store model features. A hash table is a pre-created data structure used to record the storage location of feature variables in the variable array. A hash table can be understood as a data structure that allows direct access based on a key value. For example, given a table M, if there exists a function f(key), and for any given key value (such as a feature variable), substituting it into the function yields the address of the record containing that key in the table, then table M is called a hash table, function f(key) is called a hash function, and the value of f(key) is the hash value.
[0122] Correspondingly, storage location information refers to information describing the storage location of the feature variable in the variable array. This storage location information can be the subscript corresponding to the feature variable in the variable array, or it can be information such as the position offset of the feature variable in the variable array; there are no restrictions here.
[0123] Therefore, after determining the model features, these features need to be stored in a variable array. To accelerate the efficiency of storing or retrieving model features, a hash table can be used to pre-store the storage location information of the feature variables corresponding to the model features in the variable array. After determining the model features, a hash calculation can be performed on the feature variables corresponding to the model features. The hash value obtained from the hash calculation is then used to look up the storage location information of the corresponding feature variable in the hash table. Based on this storage location information, the feature value of the model feature is assigned to the corresponding feature variable in the variable array. This allows for subsequent operations such as obtaining and calculating the model features by reading the feature variable values in the variable array, thereby obtaining its corresponding feature signature.
[0124] Taking the initial user characteristic: gender {female} as an example, based on the correspondence between the preset model characteristics and variable names, the feature variable corresponding to the model characteristic gender is determined to be var_10. The hash function corresponding to the hash table M of the variable array is determined to be f(key). Then, based on this hash function, the feature variable "var_10" is hashed to obtain the hash value H. Then, based on the hash value H, the hash table M is queried to find that the index of the feature variable var_10 in the variable array is 0. The feature value of the model characteristic gender: female, is then assigned to the feature variable var_10 at index 0 in the variable array, resulting in the assigned model feature array. Specifically, this variable array can be as follows: Figure 6As shown, the variable array includes feature variables var_10, tmp_1, var_21, and tmp_13. After assigning values to these feature variables, they are represented as var_10_val, tmp_1_val, var_21_val, and tmp_13_val.
[0125] In summary, by creating a long array as a variable array to store feature variables and using a hash table to store the position of each variable in the variable array, the query of feature variables can be completed in O(1) time complexity, reducing the time consumption of model feature storage, query and calculation operations.
[0126] Step 306: Read the feature variable value corresponding to the model feature from the model feature array, and obtain the feature signature corresponding to the model feature by signing the feature variable value.
[0127] Specifically, based on the model feature array obtained above, and considering the diversity of model features, and the fact that most model features are non-numerical, directly determining feature vectors based on model features would consume a significant amount of computational and time costs. Therefore, in this embodiment, the feature variable values corresponding to the model features are signed to obtain feature signatures of the same type, and subsequent feature vectors are determined based on these feature signatures, thereby improving the efficiency of feature vector determination.
[0128] Feature variable values refer to the values that a feature variable takes. Feature signatures are strings that identify model features, obtained by encoding and converting feature variable values. In practical applications, feature vectors are typically used as input to deep learning models (recommendation models). Therefore, the acquired model features need to be converted into feature vectors through signature calculation before being input into the recommendation model for processing.
[0129] In practice, there are various signature algorithms for converting feature variable values into feature vectors, such as hash calculations or calculations using user-defined functions. MurmurHash3 is a non-cryptographic hash algorithm. Compared to other hash functions, MurmurHash3 exhibits better random distribution characteristics for keys with strong regularity, and can produce 32-bit or 128-bit hash values. It is widely used in various distributed systems, such as Kafka, Redis, and HBase. Thanks to the advantages of this hash algorithm, this algorithm can generate feature signatures quickly and with high quality, and the generated feature signatures have a low repetition rate.
[0130] In practical implementation, when the initial features contain multiple feature elements, the feature elements can be concatenated before signature calculation to facilitate signature calculation. In this embodiment, the calculation of the feature signature corresponding to any initial feature in the model features is specifically implemented as follows:
[0131] Read the initial feature variable values corresponding to the initial feature variables in the model feature array;
[0132] The feature elements in the initial feature variable values are concatenated to obtain the concatenated features;
[0133] The concatenated features are hashed to obtain the feature signature corresponding to the initial features.
[0134] Specifically, the initial feature variable refers to the feature variable corresponding to the initial feature. Correspondingly, the initial feature variable value refers to the value taken by the initial feature variable. When the initial feature contains multiple feature elements, these elements are concatenated in a preset order. During the concatenation process, to avoid interference between feature elements, preset delimiters (such as underscores, hyphens, commas, etc.) can be used to separate and connect the feature elements. Correspondingly, the concatenated feature refers to the feature generated after concatenating the feature elements from the initial feature.
[0135] Based on this, after storing the initial features, when calculating the feature signature for the initial features, the initial feature variable values corresponding to the initial features are read first. Then, the feature elements in the initial feature variable values are concatenated. This is because when the initial features contain multiple feature elements, it is necessary to concatenate the feature elements to form a complete feature representation (i.e., concatenated feature). Next, a hash calculation is performed on the concatenated feature to convert it into a string, which is then used to query the feature vector corresponding to the initial features.
[0136] like Figure 7 As shown in (a), the feature elements in the initial feature are copied element by element and separated by a delimiter to generate a concatenated feature. The concatenated feature is then processed by the MurmurHash3 (Murmur hash) algorithm to obtain the feature signature corresponding to the concatenated feature.
[0137] Taking the initial feature IF as "Location: {"Country A", "Province B", "City C"}" as an example, the initial feature variable corresponding to this initial feature IF is var_21. The initial variable value corresponding to the initial feature variable var_21 in the model feature array is "{"Country A", "Province B", "City C"}". Then, the three feature elements "Country A", "Province B", and "City C" in the initial variable value are concatenated with underscores as separators to obtain the concatenated feature: Country A_Province B_City C. Then, MurmurHash3 hash calculation is performed on the concatenated feature "Country A_Province B_City C" to obtain the feature signature S2 corresponding to the initial feature "Location: {"Country A", "Province B", "City C"}".
[0138] It should be noted that if the initial feature contains only one feature element, then the feature elements are concatenated to obtain the concatenated feature, which is the value of the initial feature variable itself.
[0139] In summary, concatenating the feature elements in the initial feature and then performing hash calculation to obtain the feature signature reduces the difficulty of feature signature calculation and improves the calculation efficiency of feature signature.
[0140] In addition to the initial features mentioned above, the model features also include combined features. In this embodiment, the calculation of the feature signature corresponding to any combined feature in the model features is specifically implemented as follows:
[0141] Read the combined feature variable values of the combined feature variables corresponding to the combined features in the model feature array;
[0142] Obtain the feature element matrix corresponding to the combined feature variable values;
[0143] The matrix elements in each row of the feature element matrix are concatenated to obtain at least one concatenated row element;
[0144] Perform hash calculation on each concatenated element in a row to obtain the row feature signature corresponding to each concatenated element;
[0145] The row feature signatures corresponding to each row concatenation element are combined to generate a signature array, and the signature array is used as the feature signature corresponding to the combined feature.
[0146] Specifically, a combined feature variable refers to the feature variable corresponding to a combination of features. Correspondingly, a combined feature variable value refers to the value taken by the combined feature variable. It should be noted that both the combined feature variable value and the initial feature variable value are considered feature variable values. Correspondingly, a row concatenation element refers to the concatenated element obtained by concatenating the elements of any row in the feature element matrix. For example, if the feature element matrix contains 3 rows, then 3 concatenated elements are generated. During the concatenation process, the aforementioned separators can be used. Correspondingly, a row feature signature refers to the feature signature obtained by hashing the concatenated elements of the corresponding row. A signature array refers to the array obtained by combining the feature signatures corresponding to each row in the feature element matrix.
[0147] After reading the combined feature variable values and determining the feature element matrix corresponding to those combined feature variable values, such as... Figure 7 As shown in (b), the 3*6 feature element matrix contains six combined features: F1, F2, F3, F4, F5, and F6. The six matrix elements in each row are concatenated based on a delimiter to obtain row concatenation elements. The row concatenation element for the first row is: a1_a2_a3_a1_a2_a3. Hash calculations are then performed on the corresponding row concatenation elements for the three rows to obtain the row feature signature for each row concatenation element. These three row feature signatures are then combined into a signature array.
[0148] Based on this, after storing the combined features, when calculating the feature signature for the combined features, the combined feature variable values corresponding to the combined features are first read. Then, the corresponding feature element matrix is obtained through the combined feature variable values, and the signature is calculated based on the feature element matrix. Specifically, the matrix elements of each row in the feature element matrix are first concatenated, and then the concatenated row elements are hashed to generate the feature signature corresponding to each row element, i.e., the row feature signature. The generated row feature signatures are then combined to generate a signature array, and based on the generated signature array, the signature array is used as the feature signature of the combined features, so as to query the feature vector corresponding to the combined features.
[0149] It should be noted that after obtaining the feature signatures corresponding to the initial features and the combined features, the feature signatures corresponding to the initial features and the combined features are combined together (for example, into a combined array), and the array is deduplicated. Then, the feature vector corresponding to the deduplicated feature signature is queried. In specific implementation, since the feature signatures corresponding to the combined features are a signature array, each row of feature signatures in the signature array can be assigned to a separate array element in the combined array, or all row feature signatures in the signature array can be used as a single array element in the combined array. The specific configuration can be determined according to the actual application requirements, and no restrictions are imposed here.
[0150] In summary, by generating corresponding row feature signatures based on each row of the feature element matrix, and then combining the row feature signatures into a feature signature corresponding to the combined feature, the calculation of the feature signature corresponding to the combined feature is realized, and the computational efficiency is improved.
[0151] Besides online methods, feature signatures can also be obtained offline. Since offline signature acquisition doesn't require direct feedback to the user, the computational efficiency requirements are lower than online methods. Therefore, scripting languages like Python can be used for feature signing and feature vector acquisition offline. The reason offline and online feature signatures may differ lies in the precision differences in the storage and calculation of floating-point values between Python and C++ code. Therefore, even Python and C++ code implemented based on the same pseudocode may yield different results after final execution.
[0152] Furthermore, the use of Python code for feature acquisition and computation offline, compared to C++ code online, increases the development workload for deploying the model online. Additionally, the inherent differences between Python and C++ code make it extremely difficult to pinpoint the cause of problems when discrepancies occur between offline and online feature signatures.
[0153] By using a custom scripting language, features can be quickly acquired using Python during offline development. Then, a script generated by the custom language can call a binary file generated by C++ code to calculate the feature signature. The difference in precision between Python and C++ in storing floating-point numbers can be resolved by converting the floating-point numbers to strings.
[0154] Step 308: Determine the feature vector corresponding to the model feature based on the feature signature, wherein the feature vector is used to calculate the recommendation score of the information to be recommended.
[0155] Specifically, based on the feature signature obtained above, the corresponding feature vector is then determined, and a recommendation score is calculated based on this feature vector for the information to be recommended. The recommendation score refers to the score obtained by assigning a value to the information to be recommended. When there are multiple pieces of information to be recommended, each piece of information can correspond to a recommendation score. The higher the recommendation score, the more recommendable the information is.
[0156] Furthermore, based on the aforementioned storage of the correspondence between preset model features and preset feature signatures in a vector database, the step of querying the feature vector corresponding to the model feature based on the feature signature is specifically implemented by querying the feature vector corresponding to the feature signature in the vector database. This enables online querying of the feature vector corresponding to the model feature.
[0157] In this embodiment, after determining the feature vector corresponding to the model feature based on the feature signature, the method further includes:
[0158] By executing the feature processing program, the feature variable values of the feature variables in the model feature array are read;
[0159] A signature is calculated based on the value of the feature variable to obtain the feature signature corresponding to the model feature;
[0160] Based on the feature signature, query the feature vector corresponding to the model feature;
[0161] The feature vector is input into the recommendation model corresponding to the feature processing request for processing to obtain the recommendation score corresponding to the information to be recommended.
[0162] The recommendation result predicted by the recommendation model is selected from the information with the highest recommendation score.
[0163] Based on this, after constructing the model feature array, the feature variable values of the feature variables in the model feature array can be directly read, and the feature signature corresponding to the model feature can be obtained based on the read feature variable values. This feature signature can then be used to query the feature vector. The queried feature vector is then input into the recommendation model for recommendation prediction, obtaining the recommendation score for each piece of information to be recommended. Based on the recommendation score, the information with the highest recommendation score is selected and recommended to the user.
[0164] Continuing with the previous example, after assigning a value to the feature variable var_10, if the feature variable value of var_10 is read as "female", then a hash calculation is performed on the feature variable value "female" to obtain the feature signature S corresponding to the model feature "gender: female". Based on this feature signature S, the feature vector FE corresponding to the model feature "gender: female" is retrieved from the Redis database. After obtaining the feature vectors corresponding to all model features, the obtained feature vectors are input into the recommendation model for processing, resulting in a recommendation score of 60 for item 1 and a recommendation score of 80 for item 2.
[0165] In summary, by reading the feature variable values from the feature array of the model, calculating signature features based on the feature variable values, querying feature vectors based on the signature features, and then inputting the queried feature vectors into the model, the preprocessing of model features required by the recommendation model is realized, and the efficiency of model feature preprocessing is improved.
[0166] The model feature processing method provided in this application aims to improve the processing efficiency of model features. It receives feature processing requests and determines model features in response to these requests. Based on the model features, a pre-created variable array is updated, and a model feature array is generated according to the update results. This allows the acquired model features to be stored in the variable array. The method reads the feature variable values corresponding to the model features from the model feature array and obtains the feature signature corresponding to the model features by signing the feature variable values. Then, based on the feature signature, the feature vector corresponding to the model features is determined, improving the efficiency of feature vector determination. The feature vector is used to calculate the recommendation score of the information to be recommended. This method achieves the determination of the required feature inputs for the model through the calculated feature signature of the model features, improving the preprocessing efficiency of model features. Furthermore, during the model feature processing, the characteristic variables in the pre-created variable array are directly accessed, improving the space allocation efficiency and storage efficiency of model features, further enhancing the processing efficiency of model features.
[0167] The following is in conjunction with the appendix Figure 8 Taking the application of the model feature processing method provided in this application in the advertising creative recommendation scenario as an example, the model feature processing method will be further explained. Among them, Figure 8 This paper presents a flowchart illustrating a model feature processing method for advertising creative recommendation scenarios, according to an embodiment of this application. The method specifically includes the following steps:
[0168] Step 802: Obtain the model configuration file, feature processing script, and feature vector file.
[0169] Step 804: Parse the model configuration file to obtain model structure information, and generate an advertising creative recommendation model based on the model structure information.
[0170] Step 806: Create an array of variables and a feature processing program by executing the feature processing script.
[0171] Specifically, the feature processing program is obtained by converting some or all of the command lines in the feature processing script into a programming language.
[0172] Step 808: Read the correspondence between the preset feature signature and the preset feature vector in the feature vector file, and store the correspondence in the vector database.
[0173] Step 810: Receive ad creative recommendation requests submitted by users.
[0174] Specifically, the ad creative recommendation request can be understood as including the aforementioned feature processing request, and requesting ad creative recommendations based on the feature processing.
[0175] Step 812: Parse the ad creative recommendation request to determine the user information corresponding to the ad creative recommendation request and the ad creative information to be recommended.
[0176] Step 814: Configure the user information and the ad creative information to be recommended to the feature processing program. By executing the configured feature processing program, extract at least one initial user feature from the user information and at least one initial recommendation feature from the ad creative information to be recommended. Use at least one initial user feature and at least one initial recommendation feature as at least two initial features.
[0177] Step 816: Extract feature elements from at least two initial features for each initial feature.
[0178] Step 818: Determine the number of features for at least two initial features, and the number of elements in each initial feature's feature elements.
[0179] Step 820: Create an initial matrix based on the number of features and the number of elements.
[0180] Step 822: Update the initial matrix using the feature elements according to the preset feature arrangement order and the preset element arrangement order of the feature elements in at least two initial features to obtain the feature element matrix.
[0181] Step 824: Combine the matrix elements in each column of the feature element matrix to obtain combined features, and use at least two initial features and the combined features as model features.
[0182] Step 826: Update the pre-created variable array based on the model features, and generate the model feature array based on the update results.
[0183] Step 828: Read the feature variable values of the feature variables in the model feature array.
[0184] Step 830: Perform signature calculation based on the feature variable values to obtain the feature signature corresponding to the model features.
[0185] Step 832: Query the feature vector corresponding to the feature of the model based on the feature signature.
[0186] Specifically, steps 814 to 832 above can be implemented while the feature processing program is in execution state.
[0187] Step 834: Input the feature vector into the recommendation model corresponding to the ad creative recommendation request for processing, and obtain the recommendation score corresponding to the ad creative information to be recommended.
[0188] The model feature processing method provided in this application aims to improve the processing efficiency of model features. It receives feature processing requests and determines model features in response to these requests. Based on the model features, a pre-created variable array is updated, and a model feature array is generated according to the update results. This allows the acquired model features to be stored in the variable array. The method reads the feature variable values corresponding to the model features from the model feature array and obtains the feature signature corresponding to the model features by signing the feature variable values. Then, based on the feature signature, the feature vector corresponding to the model features is determined, improving the efficiency of feature vector determination. The feature vector is used to calculate the recommendation score of the information to be recommended. This method achieves the determination of the required feature inputs for the model through the calculated feature signature of the model features, improving the preprocessing efficiency of model features. Furthermore, during the model feature processing, the characteristic variables in the pre-created variable array are directly accessed, improving the space allocation efficiency and storage efficiency of model features, further enhancing the processing efficiency of model features.
[0189] Corresponding to the above method embodiments, this application also provides embodiments of a model feature processing device. Figure 9 A schematic diagram of a model feature processing device according to an embodiment of this application is shown. Figure 9 As shown, the device includes:
[0190] The determination module 902 is configured to determine model features in response to a feature processing request;
[0191] The generation module 904 is configured to update a pre-created variable array based on the model features and generate a model feature array based on the update result;
[0192] The signature module 906 is configured to read the feature variable value corresponding to the model feature from the model feature array, and obtain the feature signature corresponding to the model feature by signing the feature variable value;
[0193] The vector determination module 908 is configured to determine the feature vector corresponding to the model feature based on the feature signature, wherein the feature vector is used to calculate the recommendation score of the information to be recommended.
[0194] Optionally, the determining module 902 is further configured to:
[0195] The first receiving module is configured to receive feature processing requests;
[0196] The feature determination module is configured to determine at least two initial features corresponding to the feature processing request;
[0197] The combination module is configured to combine the feature elements in each initial feature according to a preset feature combination strategy to obtain a combined feature; and to use at least two initial features and the combined feature as model features.
[0198] Optionally, the feature determination module is further configured to:
[0199] The feature processing request is parsed, and the user information associated with the feature processing request and the information to be recommended are determined based on the parsing result;
[0200] At least one initial user feature is extracted from the user information, and at least one initial recommendation feature is extracted from the information to be recommended, and the at least one initial user feature and the at least one initial recommendation feature are used as at least two initial features.
[0201] Optionally, the combination module is configured to be further configured to:
[0202] Determine the number of features for at least two initial features, and the number of elements in each feature element of each initial feature;
[0203] An initial matrix is created based on the number of features and the number of elements;
[0204] The initial matrix is updated using the feature elements arranged in a preset feature order and the preset element order of the feature elements in at least two initial features to obtain a feature element matrix;
[0205] The matrix elements in each column of the feature element matrix are combined to obtain the combined features.
[0206] Optionally, the generation module 904 is further configured to:
[0207] Determine the feature variables corresponding to the model features in a pre-created variable array, and the hash function of the hash table corresponding to the variable array;
[0208] Based on the hash function, hash calculation is performed on the feature variables corresponding to the model features to obtain the hash values corresponding to the feature variables;
[0209] Based on the hash value, query the hash table to obtain the storage location information of the feature variable in the variable array;
[0210] Using the model features, the feature variables corresponding to the storage location information in the variable array are assigned values to obtain the model feature array.
[0211] Optionally, the calculation of the feature signature corresponding to any initial feature in the model features includes:
[0212] Read the initial feature variable values of the initial feature variables corresponding to the initial features in the model feature array;
[0213] The feature elements in the initial feature variable values are concatenated to obtain the concatenated features;
[0214] The concatenated features are hashed to obtain the feature signature corresponding to the initial features.
[0215] Optionally, the calculation of the feature signature corresponding to any combined feature in the model features includes:
[0216] Read the combined feature variable values of the combined feature variables corresponding to the combined features in the model feature array;
[0217] Obtain the feature element matrix corresponding to the combined feature variable values;
[0218] The matrix elements in each row of the feature element matrix are concatenated to obtain at least one concatenated row element;
[0219] Perform hash calculation on each concatenated element in a row to obtain the row feature signature corresponding to each concatenated element;
[0220] The row feature signatures corresponding to each row concatenation element are combined to generate a signature array, and the signature array is used as the feature signature corresponding to the combined feature.
[0221] Optionally, the determining module 902 is further configured to:
[0222] In response to a feature processing request, the feature processing program corresponding to the feature processing request is determined and invoked, wherein the feature processing program is obtained by converting the feature processing script corresponding to the feature processing request into a programming language;
[0223] By executing the feature processing procedure, the model features corresponding to the feature processing request are determined.
[0224] Optionally, the model feature processing device further includes:
[0225] The script acquisition module is configured to acquire feature processing scripts.
[0226] The script execution module is configured to create an initial array of variables and the feature processing program by executing the feature processing script;
[0227] The copying module is configured to copy the initial variable array to obtain a copy variable array, and use the copy variable array as a variable array.
[0228] Optionally, the model feature processing device further includes:
[0229] The module for retrieving configuration files is configured to retrieve model configuration files.
[0230] The file parsing module is configured to parse the model configuration file to obtain model structure information;
[0231] The model generation module is configured to generate a recommendation model based on the model structure information.
[0232] Correspondingly, the model feature processing device further includes:
[0233] The processing module is configured to input the feature vector into the recommendation model for processing to obtain the recommendation score corresponding to the information to be recommended.
[0234] Optionally, the model feature processing device further includes:
[0235] The function is configured to retrieve a vector file, specifically a feature vector file.
[0236] The storage module is configured to read the correspondence between preset feature signatures and preset feature vectors in the feature vector file, and store the correspondence in the vector database;
[0237] Accordingly, the vector determination module 908 is further configured as follows:
[0238] Query the feature vector corresponding to the feature signature in the vector database.
[0239] In summary, the model feature processing apparatus provided in this application, in order to improve the processing efficiency of model features, receives feature processing requests and determines model features in response to the requests; updates a pre-created variable array based on the model features, and generates a model feature array based on the update results. This achieves the storage of acquired model features in the variable array, reads the feature variable values corresponding to the model features from the model feature array, obtains the feature signature corresponding to the model features by signing the feature variable values, and then determines the feature vector corresponding to the model features based on the feature signature. This improves the efficiency of feature vector determination. The feature vector is used to calculate the recommendation score of the information to be recommended. This achieves the determination of the feature input required by the model through the calculated feature signature of the model features, improving the preprocessing efficiency of model features. In addition, during the model feature processing, the feature variables in the pre-created variable array are directly accessed, improving the space allocation efficiency and storage efficiency of model features, and further improving the processing efficiency of model features.
[0240] The above is a schematic scheme of a model feature processing device according to this embodiment. It should be noted that the technical solution of this model feature processing device and the technical solution of the above-described model feature processing method belong to the same concept. For details not described in detail in the technical solution of the model feature processing device, please refer to the description of the technical solution of the above-described model feature processing method.
[0241] Figure 10 A structural block diagram of a computing device 1000 according to an embodiment of this application is shown. The components of the computing device 1000 include, but are not limited to, a memory 1010 and a processor 1020. The processor 1020 is connected to the memory 1010 via a bus 1030, and a database 1050 is used to store data.
[0242] The computing device 1000 also includes an access device 1040, which enables the computing device 1000 to communicate via one or more networks 1060. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 1040 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.
[0243] In one embodiment of this application, the aforementioned components of the computing device 1000 and Figure 10 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 10 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this application. Those skilled in the art can add or replace other components as needed.
[0244] The computing device 1000 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 1000 can also be a mobile or stationary server.
[0245] The processor 1020 executes the computer instructions to implement the steps of the model feature processing method.
[0246] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the model feature processing method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the model feature processing method described above.
[0247] An embodiment of this application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the steps of the model feature processing method described above.
[0248] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the model feature processing method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the model feature processing method described above.
[0249] The foregoing has described specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0250] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0251] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0252] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0253] The preferred embodiments disclosed above are merely illustrative of this application. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this application. These embodiments are selected and specifically described in this application to better explain the principles and practical applications of this application, thereby enabling those skilled in the art to better understand and utilize this application. This application is limited only by the claims and their full scope and equivalents.
Claims
1. A model feature processing method, characterized in that, Applied to the server side, including: Determine model features in response to feature processing requests; The pre-created variable array is updated based on the model features, and a model feature array is generated based on the update results; Read the feature variable values corresponding to the model features from the model feature array, and obtain the feature signature corresponding to the model features by signing the feature variable values; Based on the feature signature, the feature vector corresponding to the model feature is determined, wherein the feature vector is used to calculate the recommendation score of the information to be recommended; This also includes: Receive feature processing request; Determine at least two initial features corresponding to the feature processing request; The determination of at least two initial features corresponding to the feature processing request includes: The feature processing request is parsed, and the user information associated with the feature processing request and the information to be recommended are determined based on the parsing result; At least one initial user feature is extracted from the user information, and at least one initial recommendation feature is extracted from the information to be recommended, and the at least one initial user feature and the at least one initial recommendation feature are used as at least two initial features.
2. The method according to claim 1, characterized in that, The process of determining model features in response to a feature processing request includes: The feature elements in each initial feature are combined according to a preset feature combination strategy to obtain combined features; At least two initial features and the combined features are used as model features.
3. The method according to claim 2, characterized in that, The step of combining the feature elements in each initial feature according to a preset feature combination strategy to obtain combined features includes: Determine the number of features for at least two initial features, and the number of elements in each feature element of each initial feature; An initial matrix is created based on the number of features and the number of elements; The initial matrix is updated using the feature elements arranged in a preset feature order and the preset element order of the feature elements in at least two initial features to obtain a feature element matrix; The matrix elements in each column of the feature element matrix are combined to obtain the combined features.
4. The method according to claim 3, characterized in that, The step of updating the pre-created variable array based on the model features and generating a model feature array based on the update result includes: Determine the feature variables corresponding to the model features in a pre-created variable array, and the hash function of the hash table corresponding to the variable array; Based on the hash function, hash calculation is performed on the feature variables corresponding to the model features to obtain the hash values corresponding to the feature variables; Based on the hash value, query the hash table to obtain the storage location information of the feature variable in the variable array; Using the model features, the feature variables corresponding to the storage location information in the variable array are assigned values to obtain the model feature array.
5. The method according to claim 2, characterized in that, The calculation of the feature signature corresponding to any initial feature in the model features includes: Read the initial feature variable values of the initial feature variables corresponding to the initial features in the model feature array; The feature elements in the initial feature variable values are concatenated to obtain the concatenated features; The concatenated features are hashed to obtain the feature signature corresponding to the initial features.
6. The method according to claim 2, characterized in that, The calculation of the feature signature corresponding to any combination feature in the model features includes: Read the combined feature variable values of the combined feature variables corresponding to the combined features in the model feature array; Obtain the feature element matrix corresponding to the combined feature variable values; The matrix elements in each row of the feature element matrix are concatenated to obtain at least one concatenated row element; Perform hash calculation on each concatenated element in a row to obtain the row feature signature corresponding to each concatenated element; The row feature signatures corresponding to each row concatenation element are combined to generate a signature array, and the signature array is used as the feature signature corresponding to the combined feature.
7. The method according to claim 1, characterized in that, The process of determining model features in response to a feature processing request includes: In response to a feature processing request, the feature processing program corresponding to the feature processing request is determined and invoked, wherein the feature processing program is obtained by converting the feature processing script corresponding to the feature processing request into a programming language; By executing the feature processing procedure, the model features corresponding to the feature processing request are determined.
8. The method according to claim 7, characterized in that, Before determining model features in response to a feature processing request, the method further includes: Obtain the feature processing script; By executing the feature processing script, an initial array of variables and the feature processing program are created; Before updating the pre-created variable array based on the model features and generating the model feature array based on the update result, the process further includes: The initial variable array is copied to obtain a copy variable array, and the copy variable array is used as the variable array.
9. The method according to any one of claims 1 to 8, characterized in that, Before determining model features in response to a feature processing request, the method further includes: Obtain the model configuration file; Parse the model configuration file to obtain the model structure information; A recommendation model is generated based on the aforementioned model structure information; After determining the feature vector corresponding to the model feature based on the feature signature, the method further includes: The feature vector is input into the recommendation model for processing to obtain the recommendation score corresponding to the information to be recommended.
10. The method according to claim 1, characterized in that, Before determining model features in response to a feature processing request, the method further includes: Obtain the feature vector file; Read the correspondence between preset feature signatures and preset feature vectors in the feature vector file, and store the correspondence in the vector database; Accordingly, determining the feature vector corresponding to the model feature based on the feature signature includes: Query the feature vector corresponding to the feature signature in the vector database.
11. A model feature processing device, characterized in that, Applied to the server side, including: The determination module is configured to determine model features in response to feature processing requests; The generation module is configured to update a pre-created variable array based on the model features, and generate a model feature array based on the update results; The signature module is configured to read the feature variable values corresponding to the model features from the model feature array, and obtain the feature signature corresponding to the model features by signing the feature variable values; The vector determination module is configured to determine the feature vector corresponding to the model feature based on the feature signature, wherein the feature vector is used to calculate the recommendation score of the information to be recommended; This also includes: Receive feature processing request; Determine at least two initial features corresponding to the feature processing request; The determination of at least two initial features corresponding to the feature processing request includes: The feature processing request is parsed, and the user information associated with the feature processing request and the information to be recommended are determined based on the parsing result; At least one initial user feature is extracted from the user information, and at least one initial recommendation feature is extracted from the information to be recommended, and the at least one initial user feature and the at least one initial recommendation feature are used as at least two initial features.
12. A computing device, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, characterized in that, When the processor executes the computer instructions, it implements the steps of the method according to any one of claims 1-10.
13. A computer-readable storage medium storing computer instructions, characterized in that, When executed by a processor, the computer instructions implement the steps of the method according to any one of claims 1-10.
14. A computer program product comprising computer instructions, characterized in that, When executed by a processor, the computer instructions implement the steps of the method according to any one of claims 1-10.
Citation Information
Patent Citations
Method for training and updating machine learning model and corresponding device
CN111144582A
Feature management method and system for recommendation model
CN112182359A