Generation method and device of gender determination model, electronic equipment and medium
By converting sparse resource browsing data into dense data and generating a gender determination model, the problem of low gender determination accuracy in the existing technology is solved, and higher gender determination accuracy and easy sample acquisition are achieved.
Patent Information
- Application Number
- CN202310316274.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-16
- Publication Date
- 2024-09-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The accuracy of gender determination models in the existing technology is low, especially when the user does not provide or provides false gender information, it is difficult to achieve accurate gender determination.
By obtaining sparse resource browsing data, convert it into dense resource category data, generate a gender determination model based on this data, and use natural language processing models such as BERT for training to improve the accuracy of gender determination.
It improves the discrimination accuracy of the gender determination model, reduces the difficulty of sample acquisition, achieves higher gender representation capabilities, and improves the accuracy of gender determination.
Smart Images

Figure CN118673206A
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular, to a method for generating a gender determination model, a device for generating a gender determination model, an electronic device, and a computer-readable storage medium. Background Art
[0002] With the popularization of Internet technology, service providers can push different browsing resources to different users based on Internet technology, and pushing based on user characteristics can achieve accurate delivery of resources. Among them, the user's gender is one of the important user characteristics, and users of different genders have significantly different interests. Therefore, the user's gender is of great significance in the field of browsing resource push.
[0003] However, many users often do not provide gender information or provide false gender information for personal privacy reasons. Therefore, how to determine the user's gender is an urgent problem to be solved.
[0004] In some related technologies, the user's gender is determined by obtaining the background data of the terminal used by the user, such as the usage time and number of times of different applications, and then using a machine learning model; in some other related technologies, the user's gender is determined based on the user's user profile picture and user name. However, the accuracy of gender determination in the above related technologies is low. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a method and device for generating a gender determination model, an electronic device, and a computer-readable storage medium, thereby improving the accuracy of gender determination at least to a certain extent.
[0006] According to a first aspect of the present application, a method for generating a gender determination model is provided, comprising:
[0007] Get sparse resource browsing data;
[0008] Converting the resource browsing data into dense resource category data;
[0009] A gender determination model is generated according to the resource category data.
[0010] According to a second aspect of the present application, a device for generating a gender determination model is provided, comprising:
[0011] Data acquisition module, used to obtain sparse resource browsing data;
[0012] A data conversion module, used for converting the resource browsing data into dense resource category data;
[0013] The model generation module is used to generate a gender determination model according to the resource category data.
[0014] According to a third aspect of the present application, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned methods by executing the executable instructions.
[0015] According to a fourth aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, any one of the methods described above is implemented.
[0016] The exemplary embodiments of the present application may have some or all of the following beneficial effects:
[0017] In the method for generating a gender determination model provided by the exemplary embodiment of the present application, sparse resource browsing data is obtained, and then the resource browsing data is converted into dense resource category data, and finally, a gender determination model is generated based on the resource category data. On the one hand, compared with the related technology that uses user attributes (such as user name, user avatar) as samples of the gender determination model, the present application can convert the originally sparse resource browsing data into dense data as samples of the gender determination model. Compared with user attributes, dense resource browsing data has a higher gender representation ability, and thus can solve the problem of low accuracy of the gender determination model generated based on user attributes, that is, the present application can improve the discrimination accuracy of the gender determination model; on the other hand, using sparse resource browsing data as raw data can improve the simplicity of raw data acquisition and reduce the difficulty of sample acquisition of the gender determination model.
[0018] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 The following schematically shows a system architecture diagram of an application scenario provided by an embodiment of the present application;
[0021] Figure 2 The flowchart schematically shows a method for generating a gender determination model according to an embodiment of the present application;
[0022] Figure 3 A flowchart of converting resource browsing data into dense resource category data according to an embodiment of the present application is schematically shown;
[0023] Figure 4 The structure diagram of the Word2vec model provided according to the embodiment of the present application is schematically shown;
[0024] Figure 5 A flowchart for generating a gender determination model based on resource category data provided in accordance with an embodiment of the present application is schematically shown;
[0025] Figure 6 The structure diagram of the Bert model provided according to the embodiment of the present application is schematically shown;
[0026] Figure 7 The flowchart for generating the first gender discrimination result provided in accordance with the embodiment of the present application is schematically shown;
[0027] Figure 8 A flowchart for generating a target gender discrimination result corresponding to target browsing data provided in accordance with an embodiment of the present application is schematically shown;
[0028] Fig. 9 The flowchart of the gender determination method provided in the embodiment of the present application is schematically shown;
[0029] Fig.10 A block diagram schematically shows a device for generating a gender determination model according to an embodiment of the present application;
[0030] Fig.11 The structural diagram of the computer system of the electronic device provided according to the embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0031] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present application will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical solutions of the present application may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present application.
[0032] In addition, the accompanying drawings are only schematic illustrations of the present application and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0033] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this application are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0034] Figure 1 A schematic diagram of a system architecture according to an application scenario provided in an embodiment of the present application is schematically shown.
[0035] like Figure 1 As shown, the system architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The terminal devices 101, 102, 103 may be various electronic devices with display screens, including but not limited to desktop computers, portable computers, smart phones, tablet computers, etc. Applications may be installed and run on the terminal devices 101, 102, 103, and users may obtain services provided by the applications through the terminal devices. It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.
[0036] For example, in an exemplary embodiment, the gender determination model may be stored in the server 105, and the user runs an application on the terminal devices 101, 102, and 103 to perform resource browsing operations such as advertisement browsing and shopping website browsing. The terminal devices 101, 102, and 103 obtain the resource browsing data of the user during the resource browsing operation, and then send the resource browsing data to the server 105 through the network 104. After receiving the resource browsing data, the server 105 converts the resource browsing data into dense resource category data, and finally generates a gender determination model based on the resource category data.
[0037] In an exemplary embodiment, the gender determination model may be stored in the server 105, and the user runs an application on the terminal devices 101, 102, and 103 to perform resource browsing operations. The terminal devices 101, 102, and 103 obtain the target browsing data of the user during the resource browsing operation, and then send the target browsing data to the server 105 through the network 104. After receiving the target browsing data, the server 105 generates a first gender determination result corresponding to the target browsing data through the gender determination model.
[0038] However, it is easy for those skilled in the art to understand that the above application scenarios are only used as examples and are not limited to this in the present exemplary embodiment.
[0039] The technical solution of the exemplary embodiment of the present application is described in detail below:
[0040] This exemplary embodiment provides a method for generating a gender determination model. The method for generating a gender determination model can be applied to the above-mentioned server or the above-mentioned terminal device; it can also be applied to the above-mentioned terminal device and the above-mentioned server at the same time; this is not particularly limited in this exemplary embodiment. Figure 2 As shown, the method for generating the gender determination model may include the following steps:
[0041] Step S210, obtaining sparse resource browsing data.
[0042] Step S220: convert the resource browsing data into dense resource category data.
[0043] Step S230: Generate a gender determination model based on the resource category data.
[0044] It is understandable that with the popularization of the Internet and mobile Internet, users can enjoy a variety of resource browsing services based on Internet technology, such as advertising browsing, shopping website browsing, etc., and service providers that provide resource browsing services often push different information to different users based on the user characteristics of the user, in order to improve the user experience and the matching of resources to users. Among them, the user's gender is one of the most important user characteristics. Taking advertising browsing as an example, in the push scenario of Internet online advertising, gender, as a basic and important information in the targeting process, is crucial to the matching rate and conversion rate of advertising. For example, most medical beauty advertisements are pushed to women, while most game advertisements are pushed to men.
[0045] Therefore, it is of great significance to accurately push browsable resources by obtaining the user's gender information. However, in many application scenarios, users are not required to upload their identity information, and many users often do not provide gender information or provide false gender information for personal privacy reasons. Based on such situations, it is very important to build an accurate gender determination model for gender determination.
[0046] In the method for generating a gender determination model provided by the exemplary embodiment of the present application, sparse resource browsing data is obtained, and then the resource browsing data is converted into dense resource category data, and finally, a gender determination model is generated based on the resource category data. On the one hand, compared with the related technology that uses user attributes (such as user name, user avatar) as samples of the gender determination model, the present application can convert the originally sparse resource browsing data into dense data as samples of the gender determination model. Compared with user attributes, dense resource browsing data has a higher gender representation ability, and thus can solve the problem of low accuracy of the gender determination model generated based on user attributes, that is, the present application can improve the discrimination accuracy of the gender determination model; on the other hand, using sparse resource browsing data as raw data can improve the simplicity of raw data acquisition and reduce the difficulty of sample acquisition of the gender determination model.
[0047] In another exemplary embodiment, the above steps are described in detail below.
[0048] In step S210, sparse resource browsing data is obtained.
[0049] Among them, the resource browsing data can be data generated by users during the advertisement browsing process; it can also be data generated by users during the shopping website browsing process; of course, it can also be other types of resource browsing data such as data generated by users during video browsing, which is not limited in the embodiments of the present application.
[0050] In addition, the sparsity of resource browsing data is because users often do not browse resources in most time periods, so it is impossible to obtain resource browsing data corresponding to these time periods, resulting in data sparsity.
[0051] In an exemplary embodiment, obtaining sparse resource browsing data includes: obtaining a resource browsing log; filtering the resource browsing log based on the object gender attribute to obtain resource browsing data containing gender characteristics and resource identifiers. In this way, data in the resource browsing log that is useless for generating a gender determination model can be removed.
[0052] Among them, log refers to a collection of certain operations of the objects specified by the system and their operation results in time order. The resource browsing log can represent the log generated by the user in the process of browsing resources on the system. For example, the resource browsing log can be a log generated by the user in the process of browsing advertisements, or a log generated by the user in the process of browsing on an online shopping platform. Of course, the resource browsing log can also be a log generated by the user in the process of browsing videos, etc. Taking advertisement browsing as an example, a resource browsing log can record the time information, advertisement information, user attribute information, etc. of the user browsing the advertisement. In this exemplary embodiment, the resource browsing log can be obtained through a log collection tool, for example, using log collection tools such as Chukwa, Apache Flume, Scribe and Kafka to collect logs.
[0053] In addition, the object gender attribute can be the gender of the target object corresponding to the resource browser log. For example, the object gender attribute can be male, female, or other gender attributes. The resource identifier can represent the identifier of the resource browsed by the user. Taking advertisement browsing as an example, the resource identifier represents the identifier of the advertisement corresponding to it. However, when the user performs resource browsing behavior, in many application scenarios, the user is not required to upload identity information, and many users often do not provide gender information or provide false gender information for personal privacy reasons, resulting in the missing or wrong object gender attribute of some resource browsing logs. Therefore, it is necessary to filter the resource browsing log based on the object gender attribute. For example, the filtering can be to remove the resource browsing logs without gender characteristics, and to remove the logs belonging to the same object but with different gender characteristics, and then delete the unnecessary information to obtain the resource browsing data containing the user object, time information, gender characteristics and resource identifier.
[0054] Taking the ad browsing scenario as an example, the representation of sparse resource browsing data for different user objects is as follows:
[0055] User A: Male, Advertisement A, January 1, 2023 16:30:59
[0056] User A: Male, Advertisement B, January 2, 2023 16:33:59
[0057] User A: Male, Advertisement A, January 3, 2023 16:30:59
[0058] …
[0059] User B: Female, Advertisement A, January 4, 2023 16:30:59
[0060] User B: Female, Advertisement D, January 5, 2023 13:13:25
[0061] …
[0062] User C: Male, Advertisement B, January 1, 2023 16:31:56
[0063] …
[0064] Among them, male and female represent gender characteristics, Ad A, Ad B, etc. represent resource identifiers, and January 1, 2023, 16:30:59 is the timestamp, indicating the time when the user browsed the advertisement. In the following text, unless otherwise specified, the resource browsing mentioned is based on the example of ad browsing.
[0065] In step S220, the resource browsing data is converted into dense resource category data. The resource category data can reflect the category characteristics of resources browsed by different users. The resource browsing data is converted into dense resource category data because the total amount of advertisements is often large, and the corresponding resource identifiers are also more. For the same user, the resource identifiers of the advertisements browsed by the user are often spaced widely, resulting in large sparsity of resource browsing data, and it is not easy to obtain the association information between different advertisements and the association information between advertisements and users. However, multiple advertisements can correspond to the same category, and the number of categories is much smaller than the number of advertisements. In this way, the category identifier intervals of the resource category data of the same user are small, and it is easy to obtain the association information between the data, and it is easy to extract features.
[0066] In an exemplary embodiment, referring to Figure 3 As shown, the resource browsing data can be converted into dense resource category data through the steps shown in S310 to S340, so that the data can be better compatible with the gender determination model, and the gender determination model can extract more data features to improve the model accuracy, wherein:
[0067] In step S310 , based on a preset sequence length, resource browsing data corresponding to the same object is integrated into a resource sequence to obtain a resource sequence set.
[0068] The sequence length can be represented by a time period. For example, the resource browsing data of the same object every 5 days can be integrated according to time sorting to obtain a resource sequence combination. The resource sequence set of different user objects is expressed as follows:
[0069] User A: Male: Ad a, Ad f, Ad d, Ad c, Ad x, Ad j, Ad pUser A: Male: Ad d, Ad s, Ad a, Ad f, Ad s, Ad a, Ad oUser A: Male: Ad m, Ad p, Ad a, Ad z, Ad x, Ad w, Ad i...
[0070] User B: Female: Ad a, Ad d, Ad s, Ad a, Ad m
[0071] User B: Female: Ad a, Ad z, Ad x, Ad w, Ad i, Ad b
[0072] …
[0073] User C: Male: Ad b, Ad m, Ad a, Ad l, Ad g, Ad e, Ad z...
[0074] If the resource browsing data obtained is within 180 days, then for a user object with high activity, 36 resource sequences will be obtained, and gender characteristics will be included. In this way, the effective sample data with a small amount of data is greatly expanded. Of course, the resource sequence set can also be obtained by obtaining resource browsing data within one year, with one week as the preset sequence length, and obtaining 52 resource sequences.
[0075] In step S320, resource features are extracted from each resource sequence in the resource sequence set to obtain a resource feature vector set.
[0076] The resource feature vector may be a vector representing feature information of an advertisement, which includes association information between different advertisements. Feature vector representations of different advertisements may be obtained by extracting resource features from each resource sequence in the source sequence set.
[0077] In an exemplary embodiment, resource features are extracted from each resource sequence in a resource sequence set to obtain a resource feature vector set, including: for each resource sequence in the resource sequence set, resource features are extracted from the resources in the resource sequence based on the resource context relationship to obtain a resource feature vector set. In this way, the extracted resource features can include the context relationship of each resource, thereby improving the feature expression capability of the resource features.
[0078] Specifically, resource features of resources in a resource sequence are extracted based on resource context relationships. This can be done by treating a resource sequence as a text sequence, where the advertisements in the sequence are equivalent to the word segments in the text, and then extracting the feature vectors of the advertisements using the relevant ideas of natural language processing. For example, the word2vec (word to vector) model used to generate word vectors can be used to extract resource features, where word2vec is a model that generates vector representations (word embedding) of "words", and word embedding can well represent the similarity and analogy relationships between different words. In the field of natural language processing, words are the most fine-grained units. Words form sentences, and sentences form paragraphs, chapters, and documents. Therefore, to deal with natural language processing problems, words must be processed first. Words are human beings' abstract summaries of natural things in symbolic form (such as Chinese, English, Latin, etc.). Therefore, in the process of data processing, words need to be converted into numerical forms or embedded in a mathematical space through feature extraction. This embedding method is called word embedding, and word2vec is a model that can perform word embedding. In short, word embedding is to convert a word into its corresponding vector representation for computer reading and data processing.
[0079] Furthermore, the user information in the resource sequence set is removed because the feature vector of the advertisement is obtained and the user information is not needed. The resource sequence and advertisement sequence shown below are obtained: advertisement a, advertisement f, advertisement d, advertisement c, advertisement x, advertisement j, advertisement p
[0080] Ad D, Ad S, Ad A, Ad F, Ad S, Ad A, Ad O
[0081] Advertisement m, Advertisement p, Advertisement a, Advertisement z, Advertisement x, Advertisement w, Advertisement i
[0082] …
[0083] Ad A, Ad D, Ad S, Ad A, Ad M
[0084] Ad a, Ad z, Ad x, Ad w, Ad i, Ad b
[0085] …
[0086] Ad b, Ad m, Ad a, Ad l, Ad g, Ad e, Ad z
[0087] …
[0088] Each advertisement sequence is regarded as a text, and each advertisement is regarded as a word. It is input into the Word2vec model, and the Embedding or feature vector of the advertisement is extracted using the Continuous Bag-of-Words (CBOW) method. The target advertisement is predicted by the context of the given target advertisement (the first c advertisements and the last c advertisements of the target advertisement). The Word2vec model is used to obtain the potential correlation between advertisements, which can not only avoid the subsequent gender determination model from being unable to learn the potential correlation information between advertisements, but also reduce the training time of the model. The structure of the Word2vec model is as follows: Figure 4 As shown in the figure, taking the advertising sequence of "Ad a, Ad f, Ad d, Ad c, Ad x, Ad j, Ad p" as an example, to predict Ad d, the context of Ad d, i.e. "Ad a, Ad f, Ad c, Ad x", is input into the input layer of the model, and then the projection layer sums the vectors, and the output layer outputs Ad d with the highest probability.
[0089] Specifically, conditional probability can be used for modeling, and the target formula of modeling is as follows:
[0090] P(w t |w t-c :w t+c )
[0091] Among them, w t represents the predicted target advertisement, w t-c represents the first c words of the target advertisement, w t-c represents the last c words of the target advertisement. For a given advertisement sequence w1,w2,w3...w t , the objective function of the Word2vec model is to maximize the log-likelihood function of the above objective formula, as shown in the following formula:
[0092]
[0093] Where T is the length of the ad sequence, that is, the number of ads in the ad sequence. The conditional probability can be obtained by calculating the softmax function, as shown in the following formula:
[0094]
[0095] in
[0096] Through the above process, the feature vector of each advertisement is obtained. Taking the 8-dimensional feature vector as an example, the advertisement feature vector output by the model is expressed as follows:
[0097] Ad a: 0.1123, 1.2232, -0.3311, 4.4421, 9.0198, 6.3323, -1.3332, 7.1349 Ad b: 3.2533, 9.1222, 0.9311, 1.2421, 0.0198, 1.3323, 1.2332, 9.2349 Ad c: 1.8123, -1.8232, -1.9311, 2.8421, 1.0198, 9.3323, 2.3332, 7.0349…
[0098] In other exemplary embodiments of the present application, for the Word2vec model, the Skip-gram method can also be used to extract the feature vector of the advertisement, which predicts the previous and next advertisements of the target advertisement through the target advertisement.
[0099] In addition, in other exemplary embodiments of the present application, a global vector for word representation (GloVe) model may be used to extract resource features, or other feature extraction models such as an Item2Vec (item to vector) model may be used to extract resource features.
[0100] In step S330, the resource feature vector set is clustered to obtain a resource category set. Clustering means dividing the data set into different classes according to a specific standard, so that the similarity of data objects in the same class is as large as possible, and the difference of data objects in different classes is as large as possible. By clustering the resource feature vector set, advertisements with similar features can be classified into one class to obtain a resource category set, i.e., an advertisement category set.
[0101] Specifically, the feature clustering of the resource feature vector set can be performed through the K-means clustering algorithm, wherein the K-means clustering algorithm is also called the k-means clustering algorithm, which is a clustering analysis algorithm based on iterative solution of distance. It uses distance as an evaluation index of similarity, that is, it is believed that the closer the distance between two objects is, the greater the similarity is. By randomly selecting K objects as the initial cluster centers, and then calculating the distance between each object and each cluster center, each object is assigned to the cluster center closest to it. The cluster centers and the objects assigned to them represent a cluster. Each time a sample is assigned, the cluster center of the cluster will be recalculated according to the existing objects in the cluster. This process will be repeated until a certain termination condition is met. The termination condition of clustering can be any one of no (or the minimum number) objects are reassigned to different clusters, no (or the minimum number) cluster centers change again, and the error square sum is locally minimized.
[0102] Furthermore, the resource feature vector set is clustered by the K-means clustering algorithm. First, the K value is determined, that is, the number of categories into which the resource feature vector is expected to be divided. For example, the K value can be 8, or other values such as 10; K resource feature vectors are randomly selected from the resource feature vector set as the centroid, and then for each vector in the resource feature vector set, the distance between it and each centroid is calculated in turn, such as the Euclidean distance, etc. The vector with the smallest distance to the centroid is classified into the category to which the centroid belongs; after classifying all resource feature vector sets, K categories are obtained, and then the centroid of each category is recalculated; if the distance between the newly calculated centroid and the original centroid is less than the preset distance threshold, it means that the data has converged and the clustering has achieved the desired result, then clustering is stopped; if the distance between the newly calculated centroid and the original centroid is greater than the preset distance threshold, the centroid selection and distance calculation are performed again until convergence. Among them, the distance between two resource feature vectors can be obtained by the following formula:
[0103]
[0104] Among them, X and Y represent two different resource feature vectors respectively.
[0105] The resource feature vectors are classified into K categories through the K-means clustering algorithm, and finally the category to which each advertisement belongs is obtained, as shown below:
[0106] Ad a: Category A
[0107] Ad b: Category A
[0108] Ad c: Category B
[0109] Ad d: Category B
[0110] Ad e: Category B
[0111] Ad x: Category C
[0112] …
[0113] In other exemplary embodiments of the present application, the resource feature vector set can also be feature clustered by the Affinity Propagation (AP) algorithm, and the resource feature vector set can also be feature clustered by the Agglomerative Clustering algorithm. Of course, the resource feature vector set can also be feature clustered by other clustering methods such as Ordering Points to identify the clustering structure (OPTICS).
[0114] In step S340, the resource browsing data is mapped to dense resource category data based on the resource category set. Exemplarily, for "advertisement a" in the resource browsing data, if it belongs to category A, "advertisement a" in the resource browsing data is replaced with "category A", and other advertisements are also replaced in this way. The resource category data finally obtained is as follows: User A: Male: Category A, Category D, Category B, Category B, Category C, Category D, Category A User A: Male: Category B, Category F, Category A, Category D, Category K, Category A, Category B User A: Male: Category K, Category O, Category A, Category F, Category D, Category B, Category A...
[0115] User B: Female: Category A, Category B, Category K, Category A, Category K
[0116] User B: Female: Category A, Category F, Category D, Category B, Category A, Category C
[0117] …
[0118] User C: Male: Category C, Category K, Category A, Category D, Category B, Category C, Category F...
[0119] By mapping sparse resource browsing data into dense resource category data, the model can better extract data features and obtain more correlation information between different resource browsing data.
[0120] In step S230, a gender determination model is generated according to the resource category data. Specifically, the gender determination model may be a classification model, and the classification model is trained by using the resource category data and label information as sample data to obtain a pre-trained gender determination model.
[0121] In an exemplary embodiment, referring to Figure 5 As shown, a gender determination model can be generated according to resource category data through the steps shown in S510 to S530, so that the accuracy of the gender determination model can be higher and the determination can be more accurate.
[0122] In step S510, the object gender attribute is obtained, wherein the object gender attribute indicates the gender of the user object corresponding to the resource category data, for example, the object gender attribute may be male or female.
[0123] In step S520, sample data is generated according to the object gender attribute and the resource category data. Specifically, the object gender attribute is used as a label, and the resource category data corresponding to the object gender attribute is used as a feature to obtain the sample data of the model.
[0124] In step S530, the sample data is input into a natural language processing model to generate a gender determination model. The natural language processing model may refer to a model that can extract implicit features and relationships in text content of natural language.
[0125] Specifically, in this exemplary embodiment, a gender determination model can be generated based on the BERT (Bidirectional Encoder Representations from Transformers) model. The BERT model can be trained using large-scale unlabeled corpus to obtain feature representations of texts that contain rich semantic information, i.e., semantic representations of texts. The semantic representations of texts are then fine-tuned in specific tasks and finally applied to the tasks. Resource category data is considered as text data, and the various categories in resource category data are considered as words. Figure 6 As shown in the figure, the resource category data "User A: Male: Category A, Category D, Category B, Category B, Category C, Category D, Category A" is used as a sample data to train the model, and the gender attribute "Male" corresponding to user A is used as the label. In this way, the gender determination problem is transformed into a classification problem similar to natural language processing. The BERT model is trained using the sample data to obtain a pre-trained BERT model, which is then used as a gender determination model.
[0126] In an exemplary embodiment, the first gender discrimination result can also be generated in the following manner, including: obtaining target browsing data, and then generating the first gender discrimination result corresponding to the target browsing data by using a gender determination model. In this way, the gender determination model can be used to obtain accurate gender information of an unknown gender object.
[0127] Specifically, the target browsing data may represent data generated when the target user object performs resource browsing behavior, the target browsing data is converted into dense resource category data, and then the resource category data is input into the gender determination model to obtain a first gender determination result corresponding to the target browsing data. The first gender determination result may be the gender attribute of the user corresponding to the target browsing data, and the first gender determination result may also be the probability of the corresponding gender attribute of the user corresponding to the target browsing data.
[0128] Further, the method for generating the first gender discrimination result in this exemplary embodiment is described in more detail below in combination with a specific application scenario. Figure 7As shown, in step S710, the advertisement browsing data of some objects in the past six months are obtained. Specifically, the advertisement browsing logs of some objects in the past six months can be obtained, and then the advertisement browsing logs are filtered based on the gender attribute of the object to obtain the advertisement browsing data containing gender characteristics and advertisement identification. In step S720, based on the preset sequence length, the advertisement browsing data corresponding to the same object are integrated into an advertisement sequence to obtain an advertisement sequence set. For example, the preset sequence length can be 5 days, and an advertisement sequence set containing 36 advertisement sequences is obtained.
[0129] In step S730, advertisement features are extracted from each advertisement sequence in the advertisement sequence set based on the word2vec model to obtain an advertisement feature vector set. In step S740, feature clustering is performed on the advertisement feature vector set to obtain an advertisement category set. Specifically, feature clustering can be performed on the advertisement feature vector set by a K-means clustering algorithm, or by other clustering algorithms. In step S760, the object gender attribute and advertisement category data are input into the Bert model to generate a gender determination model, wherein the object gender attribute and advertisement category data constitute sample data, and the sample data is as follows:
[0130] Male: Category A, Category D, Category B, Category B, Category C, Category D, Category A
[0131] Male: Category B, Category F, Category A, Category D, Category K, Category A, Category B Male: Category K, Category O, Category A, Category F, Category D, Category B, Category A
[0132] …
[0133] Female: Category A, Category B, Category K, Category A, Category K
[0134] Female: Category A, Category F, Category D, Category B, Category A, Category C
[0135] …
[0136] Male: Category C, Category K, Category A, Category D, Category B, Category C, Category F
[0137] …
[0138] In step S770, the target browsing data of the object to be determined is obtained, and a first gender discrimination result corresponding to the target browsing data is generated through a gender determination model, wherein the target browsing data may be advertisement browsing data of the target object within a certain period of time; further, the target browsing data is converted into dense resource category data, and then the resource category data is input into the gender determination model to obtain a first gender discrimination result corresponding to the target browsing data. The first gender discrimination result may be the most probable gender attribute of the user corresponding to the target browsing data.
[0139] In an exemplary embodiment, referring to Figure 8 As shown, the target gender discrimination result corresponding to the target browsing data can be generated through the steps shown in S810 to S830, so that the target gender discrimination result can be generated by combining the first gender discrimination result and the second gender discrimination result, so that the target gender discrimination result is more accurate and the prediction probability is more precise. Among them:
[0140] In step S810, the gender ratio corresponding to each resource is obtained. The gender ratio corresponding to each resource may represent the gender ratio corresponding to each advertisement. For example, for advertisement a, among users browsing advertisement a, the proportion of males is 80% and the proportion of females is 20%.
[0141] In step S820, a second gender discrimination result corresponding to the target browsing data is generated based on the gender ratio corresponding to each resource. Specifically, the advertisements browsed by the user whose gender is to be determined within a certain period of time can be obtained and integrated into an advertisement sequence. For example, the advertisement sequence corresponding to user A can be: advertisement a, advertisement d, advertisement s, advertisement m. Then, the second gender result corresponding to user A is calculated based on the gender ratio corresponding to each advertisement. Specifically, the same gender ratio corresponding to all advertisements can be added up and then divided by the number of advertisements to obtain the gender ratio corresponding to each gender, and then the largest gender ratio and its corresponding gender attribute are used as the second gender determination result.
[0142] In step S830, a target gender discrimination result corresponding to the target browsing data is generated according to the first gender discrimination result and the second gender discrimination result. Specifically, when the gender attributes in the first gender discrimination result and the second gender discrimination result are the same, the gender attribute is used as the target gender discrimination result, and the probability value of the gender attribute is the gender probability corresponding to the first gender discrimination result multiplied by the gender ratio in the second gender discrimination result; when the gender attributes in the first gender discrimination result and the second gender discrimination result are different, the first gender discrimination result is used as the target gender discrimination result corresponding to the target browsing data.
[0143] Furthermore, the gender determination method in this exemplary embodiment is described in more detail below in conjunction with specific application scenarios. Fig. 9 As shown, in step S910, the advertisement browsing data of the target object within a specific time is obtained. For example, the advertisement browsing log of the target object within the past 30 days can be obtained, and then the advertisement identifier is sorted based on the timestamp information to obtain the advertisement browsing data containing the advertisement identifier. In step S920, based on the preset sequence length, the advertisement browsing data corresponding to the same object is integrated into an advertisement sequence to obtain an advertisement sequence set. For example, the preset sequence length can be 5 days, and an advertisement sequence set containing 6 advertisement sequences is obtained. In step S930, the advertisement browsing data is mapped to dense advertisement category data based on the pre-acquired advertisement category set. In step S940, the object gender attribute and the advertisement category data are input into the gender determination model, wherein the gender determination model can be generated based on the Bert model. In step S950, the gender determination model generates a first gender discrimination result corresponding to the advertisement browsing data, wherein the first gender discrimination result can be the gender attribute of the target object with the highest probability. In step S960, the gender ratio corresponding to each advertisement is obtained. In step S970, a second gender discrimination result corresponding to the advertisement browsing data is generated based on the gender ratio corresponding to each advertisement. Specifically, the same gender ratio corresponding to all advertisements in the advertisement sequence of the target object can be added up, and then divided by the number of advertisements to obtain the gender ratio corresponding to each gender, and then the maximum gender ratio and its corresponding gender attribute are used as the second gender discrimination result. In step S980, a target gender discrimination result corresponding to the advertisement browsing data is generated based on the first gender discrimination result and the second gender discrimination result. Specifically, when the gender attributes in the first gender discrimination result and the second gender discrimination result are the same, the gender attribute is used as the target gender discrimination result, and the probability value of the gender attribute is the gender probability corresponding to the first gender discrimination result multiplied by the gender ratio in the second gender discrimination result; when the gender attributes in the first gender discrimination result and the second gender discrimination result are different, the first gender discrimination result can be used as the target gender discrimination result corresponding to the target browsing data, or the second gender discrimination result can be used as the target gender discrimination result corresponding to the target browsing data, etc.
[0144] The gender determination method in the above exemplary embodiment solves the gender prediction problem in the resource browsing field based on the idea of natural language processing. First, the resource browsing data of the target object, such as advertising browsing data, is used to replace the native attribute features of the target object, and the sample size is increased dramatically by presetting the sequence length for data integration, so that the advantages of the deep model can be better reflected; then, the word2vec model is used for feature extraction and clustering, and the advertising sequence is converted into an advertising category sequence, and the sparse data is converted into dense data, which is more conducive to the feature extraction of the model; finally, the advertising category sequence is input into the gender determination model to obtain the first gender discrimination result, and the target discrimination result is generated in combination with the second gender discrimination result, which integrates the prediction probability in the statistical problem and the prediction probability in the deep model, and combines the advantages of the deep model and the advantages of the traditional statistical probability, so that the prediction is more accurate. In addition, the accurate gender probability prediction provides the target object with a resource browsing service that is more in line with its gender attributes, thereby improving the browsing experience. In addition, in the gender determination method in the above exemplary embodiment, by obtaining sparse resource browsing data, the resource browsing data is converted into dense resource category data, and finally, a gender determination model is generated according to the resource category data. On the one hand, compared with the related technology that uses user attributes (such as user name, user avatar) as samples of the gender determination model, the present application can convert the originally sparse resource browsing data into dense data and use it as samples of the gender determination model. Compared with user attributes, dense resource browsing data has a higher gender representation ability, and thus can solve the problem of low accuracy of the gender determination model generated based on user attributes, that is, the present application can improve the discrimination accuracy of the gender determination model; on the other hand, using sparse resource browsing data as raw data can improve the ease of obtaining raw data and reduce the difficulty of obtaining samples for the gender determination model.
[0145] Furthermore, in an exemplary embodiment, a device for generating a gender determination model is also provided. Fig.10 As shown, the device 1000 for generating a gender determination model may include a data acquisition module 1010, a data conversion module 1020, and a model generation module 1030. Among them:
[0146] The data acquisition module 1010 may be used to acquire sparse resource browsing data;
[0147] The data conversion module 1020 may be used to convert the resource browsing data into dense resource category data;
[0148] The model generation module 1030 may be used to generate a gender determination model according to resource category data.
[0149] In an exemplary embodiment, the data acquisition module 1010 may be used to acquire sparse resource browsing data, including:
[0150] Get resource browsing logs;
[0151] The resource browsing log is filtered based on the object gender attribute to obtain resource browsing data containing gender characteristics and resource identifiers.
[0152] It can be seen that by implementing this exemplary embodiment, data in the resource browsing log that is useless for generating a gender determination model can be removed.
[0153] In an exemplary embodiment, the data conversion module 1020 may be used to convert the resource browsing data into dense resource category data, including:
[0154] Based on a preset sequence length, resource browsing data corresponding to the same object is integrated into a resource sequence to obtain a resource sequence set;
[0155] Extract resource features from each resource sequence in the resource sequence set to obtain a resource feature vector set;
[0156] Perform feature clustering on the resource feature vector set to obtain a resource category set;
[0157] The resource browsing data is mapped into dense resource category data based on the resource category set.
[0158] It can be seen that the implementation of this exemplary embodiment can make the data more compatible with the gender determination model, and can enable the gender determination model to extract more data features and improve the model accuracy.
[0159] In an exemplary embodiment, the data conversion module 1020 may integrate the resource browsing data corresponding to the same object into a resource sequence based on a preset sequence length, and obtain a resource sequence set, including:
[0160] For each resource sequence in the resource sequence set, resource features are extracted from the resources in the resource sequence based on the resource context relationship to obtain a resource feature vector set.
[0161] It can be seen that the implementation of this exemplary embodiment can make the extracted resource features include the contextual relationship of each resource, thereby improving the feature expression capability of the resource features.
[0162] In an exemplary embodiment, the model generation module 1030 may be used to generate a gender determination model according to resource category data, including:
[0163] Get the object's gender attribute;
[0164] Generate sample data based on the object's gender attribute and resource category data;
[0165] The sample data is input into the natural language processing model to generate a gender determination model.
[0166] It can be seen that the implementation of this exemplary embodiment can make the gender determination model more precise and the determination more accurate.
[0167] In an exemplary embodiment, the device 1000 for generating a gender determination model further includes:
[0168] Target data module, which can be used to obtain target browsing data;
[0169] The gender determination module can be used to generate a first gender determination result corresponding to the target browsing data through a gender determination model.
[0170] It can be seen that by implementing this exemplary embodiment, the gender determination model can be used to obtain accurate gender information of an object of unknown gender.
[0171] In an exemplary embodiment, the device 1000 for generating a gender determination model further includes:
[0172] Gender ratio module, used to obtain the gender ratio corresponding to each resource;
[0173] A second discrimination module, used to generate a second gender discrimination result corresponding to the target browsing data based on the gender ratio corresponding to each resource;
[0174] The discrimination result module is used to generate a target gender discrimination result corresponding to the target browsing data according to the first gender discrimination result and the second gender discrimination result.
[0175] It can be seen that by implementing this exemplary embodiment, the first gender discrimination result and the second gender discrimination result can be combined to generate a target gender discrimination result, so that the target gender discrimination result is more accurate and the prediction probability is more precise.
[0176] The specific details of each module in the above-mentioned device for generating the gender determination model have been described in detail in the corresponding video encoding method, so they will not be repeated here. As another aspect, the present application also provides an electronic device, Fig.11 The structural diagram of the computer system of the electronic device provided according to the embodiment of the present application is schematically shown.
[0177] It should be noted that Fig.11 The computer system 1100 of the electronic device shown is only an example and should not bring any limitation to the functions and application scope of the embodiments of the present application.
[0178] like Fig.11As shown, the computer system 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage part 1108 into a random access memory (RAM) 1103. Various programs and data required for system operation are also stored in the RAM 1103. The CPU 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0179] The following components are connected to the I / O interface 1105: an input section 1106 including a keyboard, a mouse, etc.; an output section 1107 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a LAN card, a modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1111 is also connected to the I / O interface 1105 as needed. A removable medium 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1110 as needed, so that a computer program read therefrom is installed into the storage section 1108 as needed.
[0180] In particular, according to an embodiment of the present application, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1101, and / or installed from the removable medium 1111. When the computer program is executed by the central processing unit (CPU) 1101, various functions defined in the method and apparatus of the present application are executed. In some embodiments, the computer system 1100 may also include a data processor for processing data calculation operations related to the generation of the gender determination model.
[0181] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.
[0182] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0183] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
Claims
1. A method for generating a gender determination model, It is characterized in that include: Get sparse resource browsing data; Converting the resource browsing data into dense resource category data; A gender determination model is generated according to the resource category data.
2. The method according to claim 1, It is characterized in that Get sparse resource browsing data, including: Get resource browsing logs; The resource browsing log is filtered based on the object gender attribute to obtain resource browsing data including gender characteristics and resource identifiers.
3. The method according to claim 1, It is characterized in that Converting the resource browsing data into dense resource category data includes: Based on a preset sequence length, the resource browsing data corresponding to the same object is integrated into a resource sequence to obtain a resource sequence set; Extracting resource features from each resource sequence in the resource sequence set to obtain a resource feature vector set; Performing feature clustering on the resource feature vector set to obtain a resource category set; The resource browsing data is mapped into dense resource category data based on the resource category set.
4. The method according to claim 3, It is characterized in that Resource features are extracted from each resource sequence in the resource sequence set to obtain a resource feature vector set, including: For each resource sequence in the resource sequence set, resource features are extracted from the resources in the resource sequence based on the resource context relationship to obtain a resource feature vector set.
5. The method according to claim 1, It is characterized in that Generating a gender determination model according to the resource category data includes: Get the object's gender attribute; Generate sample data according to the object gender attribute and the resource category data; The sample data is input into a natural language processing model to generate a gender determination model.
6. The method according to claim 1, It is characterized in that Also includes: Get target browsing data; A first gender determination result corresponding to the target browsing data is generated by the gender determination model.
7. The method according to claim 6, It is characterized in that Also includes: Get the gender ratio corresponding to each resource; generating a second gender discrimination result corresponding to the target browsing data based on the gender ratios corresponding to the resources; A target gender discrimination result corresponding to the target browsing data is generated according to the first gender discrimination result and the second gender discrimination result.
8. A device for generating a gender determination model, It is characterized in that include: Data acquisition module, used to obtain sparse resource browsing data; A data conversion module, used for converting the resource browsing data into dense resource category data; The model generation module is used to generate a gender determination model according to the resource category data.
9. An electronic device, It is characterized in that include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 7 by executing the executable instructions.
10. A computer readable medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, each step of the method according to any one of claims 1 to 7 is implemented.
