Model parameter adjusting method and device, electronic equipment and storage medium

文档序号:1952956 发布日期:2021-12-10 浏览:25次 中文

阅读说明:本技术 一种模型参数调整方法、装置、电子设备和存储介质 (Model parameter adjusting method and device, electronic equipment and storage medium ) 是由 李雷来 王健宗 瞿晓阳 于 2021-10-22 设计创作,主要内容包括:本申请涉及智能决策,公开了一种模型参数调整方法、装置、电子设备和存储介质,该方法包括:获取第一社交信息、第二社交信息和第三社交信息,第一社交信息与第二社交信息属于同一类别,第一社交信息与第三社交信息属于不同类别;对第一社交信息、第二社交信息和第三社交信息分别进行编码,得到第一特征向量、第二特征向量和第三特征向量;确定第一特征向量与第二特征向量之间的距离,得到第一距离;确定第一特征向量与第三特征向量之间的距离,得到第二距离;根据第一距离和第二距离之间的差值,确定损失函数;根据损失函数调整推荐模型的模型参数,以对推荐模型进行训练。实施本申请实施例,提高了推荐模型的泛化能力。(The application relates to intelligent decision making and discloses a model parameter adjusting method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: the method comprises the steps of obtaining first social contact information, second social contact information and third social contact information, wherein the first social contact information and the second social contact information belong to the same category, and the first social contact information and the third social contact information belong to different categories; respectively encoding the first social information, the second social information and the third social information to obtain a first feature vector, a second feature vector and a third feature vector; determining the distance between the first characteristic vector and the second characteristic vector to obtain a first distance; determining the distance between the first characteristic vector and the third characteristic vector to obtain a second distance; determining a loss function based on a difference between the first distance and the second distance; and adjusting the model parameters of the recommendation model according to the loss function so as to train the recommendation model. By implementing the embodiment of the application, the generalization capability of the recommendation model is improved.)

1. A model parameter adjustment method is characterized by comprising the following steps:

acquiring first social contact information, second social contact information and third social contact information, wherein the first social contact information and the second social contact information belong to the same category, and the first social contact information and the third social contact information belong to different categories;

respectively encoding the first social contact information, the second social contact information and the third social contact information to obtain a first feature vector, a second feature vector and a third feature vector;

determining the distance between the first characteristic vector and the second characteristic vector to obtain a first distance;

determining the distance between the first characteristic vector and the third characteristic vector to obtain a second distance;

determining a loss function based on a difference between the first distance and the second distance;

and adjusting the model parameters of the recommendation model according to the loss function so as to train the recommendation model.

2. The method of claim 1, wherein before the encoding the first social information, the second social information, and the third social information to obtain a first feature vector, a second feature vector, and a third feature vector, respectively, the method further comprises:

obtaining a heterogeneous social graph, wherein the heterogeneous social graph comprises a plurality of heterogeneous nodes and connecting edges between at least two of the plurality of heterogeneous nodes, and one of the heterogeneous nodes in the heterogeneous social graph comprises one of: the method comprises the steps of word text, tag information, user identification, time information and identification of social information, wherein the tag information is used for identifying the category of the social information;

generating a isomorphic social graph according to the heterogeneous social graph, wherein the isomorphic social graph comprises a plurality of isomorphic nodes and connecting edges between at least two isomorphic nodes in the plurality of isomorphic nodes, one isomorphic node in the isomorphic social graph is an identifier of social information, and the plurality of isomorphic nodes comprise an identifier of the first social information, an identifier of the second social information and an identifier of the third social information;

determining a first weight and a second weight according to the isomorphic social graph, wherein the first weight is determined according to a connection edge between the identifier of the first social information and the identifier of the second social information, and the second weight is determined according to a connection edge between the identifier of the first social information and the identifier of the third social information;

if the first weight is higher than a first threshold value, determining that the first social information and the second social information belong to the same category;

determining that the first social information and the third social information belong to different categories if the second weight is lower than a second threshold.

3. The method of claim 2, wherein prior to the obtaining the heterogeneous social graph, the method further comprises:

acquiring a plurality of pieces of social information within preset time;

extracting word texts, label information, user identifications, time information and identifications of the social information contained in each piece of social information in the plurality of pieces of social information;

and generating the heterogeneous social graph according to word texts, label information, user identifications, time information and identifications of social information contained in each piece of social information.

4. The method of claim 2, wherein determining the first weight and the second weight from the isomorphic social graph comprises:

if the connecting edge between at least two isomorphic nodes in the isomorphic social graph is determined according to the word text associated with the identifiers of different social information in the heterogeneous social graph, determining the first weight according to the similarity between the word text associated with the identifier of the first social information and the word text associated with the identifier of the second social information;

determining the second weight according to the similarity between the word text associated with the identifier of the first social information and the word text associated with the identifier of the third social information.

5. The method of any of claims 1-4, wherein the input to the recommendation model is miModel parameters of the first layerInput with the recommendation model is mjModel parameters for the temporal front layer l-1(ii) related; wherein l is an integer greater than or equal to 2; m isiIs the first social information, mjIs the second social information; or, miIs the first social information, mjIs the third social information.

6. The method of claim 5,the following formula is satisfied:

wherein the headers indicate that the model parameters of the first l-1 layer are connected in series in the direction of the head, and N (m)j) Is mjOf the adjacent matrix of (a) and (b),the input for the recommendation model is mjThe model parameters of the first layer l-1 are extracted,the input for aggregating in the recommendation model is mjThe model parameters of the first l-1 layer are extracted.

7. The method of any one of claims 1-4, wherein the loss function ζ istThe following formula is satisfied:

wherein m isiIs the first social information, mi+Is the second social information, mi-As the third social information, it is,the first distance is a distance between the first and second electrodes,and a is a second distance, a is a regularization parameter, and T is a set formed by a combination of every three pieces of social information, wherein the social information A and the social information B in the combination belong to the same type, and the social information A and the social information C in the combination belong to different types.

8. A model parameter adjusting device is characterized by comprising an obtaining module, a coding module, a first determining module, a second determining module, a third determining module and a training module,

the obtaining module is used for obtaining first social information, second social information and third social information, the first social information and the second social information belong to the same category, and the first social information and the third social information belong to different categories;

the encoding module is configured to encode the first social information, the second social information, and the third social information respectively to obtain a first feature vector, a second feature vector, and a third feature vector;

the first determining module is configured to determine a distance between the first feature vector and the second feature vector to obtain a first distance;

the second determining module is configured to determine a distance between the first feature vector and the third feature vector to obtain a second distance;

the third determining module is configured to determine a loss function according to a difference between the first distance and the second distance;

and the training module is used for adjusting the model parameters of the recommendation model according to the loss function so as to train the recommendation model.

9. An electronic device for model parameter adjustment, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and are generated as instructions to be executed by the processor for performing the steps of the method of any of claims 1-7.

10. A computer-readable storage medium, characterized in that the computer-readable storage medium is used to store a computer program, which is executed by the processor, to implement the method of any of claims 1-7.

Technical Field

The present application relates to the field of artificial intelligence, and in particular, to a method and an apparatus for adjusting model parameters, an electronic device, and a storage medium.

Background

In today's society, social behaviors have been performed almost entirely around the internet, and social information flows such as bloggers, social states, hotspot comments, and the like tend to arise from a large number of social events. Generally, the social information flow has the characteristics of time sequence, large quantity, quick update, high complexity and the like. However, in the current stage, social information is often adopted for training in the training of the recommendation model, and the trained recommendation model is used for recommending the social information for the user. Because the social information is only input to the recommendation model in a mechanized manner during training, there may be a problem that the recommendation of the social information is not accurate enough when the trained recommendation model is used for recommending the social information for the user. In other words, the generalization ability of the recommendation model is poor. Therefore, how to improve the generalization capability of the recommendation model becomes a technical problem to be solved urgently at the current stage.

Disclosure of Invention

The embodiment of the application provides a model parameter adjusting method and device, electronic equipment and a storage medium, and the generalization capability of a recommendation model is improved.

The application provides a method for adjusting model parameters in a first aspect, comprising:

acquiring first social contact information, second social contact information and third social contact information, wherein the first social contact information and the second social contact information belong to the same category, and the first social contact information and the third social contact information belong to different categories;

respectively encoding the first social contact information, the second social contact information and the third social contact information to obtain a first feature vector, a second feature vector and a third feature vector;

determining the distance between the first characteristic vector and the second characteristic vector to obtain a first distance;

determining the distance between the first characteristic vector and the third characteristic vector to obtain a second distance;

determining a loss function based on a difference between the first distance and the second distance;

and adjusting the model parameters of the recommendation model according to the loss function so as to train the recommendation model.

In a second aspect, the present application provides a model parameter adjusting apparatus, which includes an obtaining module, an encoding module, a first determining module, a second determining module, a third determining module, and a training module,

the obtaining module is used for obtaining first social information, second social information and third social information, the first social information and the second social information belong to the same category, and the first social information and the third social information belong to different categories;

the encoding module is configured to encode the first social information, the second social information, and the third social information respectively to obtain a first feature vector, a second feature vector, and a third feature vector;

the first determining module is configured to determine a distance between the first feature vector and the second feature vector to obtain a first distance;

the second determining module is configured to determine a distance between the first feature vector and the third feature vector to obtain a second distance;

the third determining module is configured to determine a loss function according to a difference between the first distance and the second distance;

and the training module is used for adjusting the model parameters of the recommendation model according to the loss function so as to train the recommendation model.

A third aspect of the application provides an electronic device for model parameter adjustment, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and are generated as instructions to be executed by the processor for performing steps in any one of the methods of a model parameter adjustment method.

A fourth aspect of the present application provides a computer-readable storage medium for storing a computer program for execution by the processor to implement the method of any one of the model parameter adjustment methods.

It can be seen that, in the above technical solution, the loss function can be determined according to a difference between the first distance and the second distance by determining the first distance between the feature vectors corresponding to the social information belonging to the same category and determining the second distance between the feature vectors corresponding to the social information belonging to different categories. Because the loss function is determined according to the first distance between the feature vectors corresponding to the social information belonging to the same category and the second distance between the feature vectors corresponding to the social information belonging to different categories, the expression forms of the same type of data can be richer when the model parameters of the recommendation model are adjusted by using the loss function, so that the feature extraction capability of the recommendation model is enhanced, and the generalization capability of the recommendation model is improved.

Drawings

In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.

Wherein:

fig. 1 is a schematic flowchart of a model parameter adjustment method according to an embodiment of the present disclosure;

FIG. 2 is a diagram illustrating a heterogeneous social graph according to an embodiment of the present disclosure;

FIG. 3 is a diagram of a homogeneous social graph based on the heterogeneous social graph of FIG. 2;

FIG. 4 is a schematic flow chart illustrating a further method for adjusting model parameters according to an embodiment of the present disclosure;

fig. 5 is a schematic diagram of a model parameter adjustment apparatus according to an embodiment of the present disclosure;

fig. 6 is a schematic structural diagram of an electronic device in a hardware operating environment according to an embodiment of the present application.

Detailed Description

The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

The following are detailed below.

The terms "first" and "second" in the description and claims of the present application and the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.

The embodiments of the present application are described below with reference to the drawings, and it can be understood that in the present application, the execution subject may be an electronic device or a cloud server, and is not limited herein. The electronic device may include various handheld devices, vehicle-mounted devices, wearable devices, computing devices or other processing devices connected to a wireless modem with wireless communication functions, and various forms of User Equipment (UE), Mobile Stations (MS), terminal devices (terminal device), and so on.

Referring to fig. 1, fig. 1 is a schematic flowchart of a model parameter adjustment method according to an embodiment of the present disclosure. As shown in fig. 1, the method includes:

101. the method comprises the steps of obtaining first social information, second social information and third social information, wherein the first social information and the second social information belong to the same category, and the first social information and the third social information belong to different categories.

The first social information comprises a first word text, first tag information, a first named entity, a first user identifier, first time information and an identifier of the first social information. The first word text may include one or more word texts, the one or more word texts are words other than common words and rare words, the common words may be, for example, mood-assisted words, stop words, and the like, and the rare words may be included in an open-source data set or preset words, which is not limited herein. The first tag information is used to identify a topic or category to which the first social information belongs. The first user identification is an identification of a user who published the first social information. The first time information is the time of posting the first social information.

The second social information comprises a second word text, second tag information, a second named entity, a second user identifier, second time information and an identifier of the second social information. The second word text may comprise two or more word texts. The second tag information is used to identify a topic or category to which the second social information belongs. The second user identification is an identification of a user who posted the second social information. The second time information is a time when the second social information is published.

The third social information comprises a third word text, third tag information, a third named entity, a third user identifier, third time information and an identifier of the third social information. The third word text may include three or more word texts. The third tag information is used to identify a topic or category to which the third social information belongs. The third user identification is an identification of a user who posted the third social information. The third time information is a time when the third social information is published.

In the present application, the social information may be, for example, text information and/or picture information such as text pushing and comments, which is not limited herein.

In addition, the first word text is obtained by performing natural language processing according to the first social information, the second word text is obtained by performing natural language processing according to the second social information, and the third word text is obtained by performing natural language processing according to the third social information, which is not limited herein.

102. And respectively encoding the first social information, the second social information and the third social information to obtain a first feature vector, a second feature vector and a third feature vector.

Optionally, before step 102, the method further includes: obtaining a heterogeneous social graph, wherein the heterogeneous social graph comprises a plurality of heterogeneous nodes and connecting edges between at least two of the plurality of heterogeneous nodes, and one of the heterogeneous nodes in the heterogeneous social graph comprises one of: the method comprises the steps of word text, tag information, user identification, time information and identification of social information, wherein the tag information is used for identifying the category of the social information; generating a isomorphic social graph according to the heterogeneous social graph, wherein the isomorphic social graph comprises a plurality of isomorphic nodes and connecting edges between at least two isomorphic nodes in the plurality of isomorphic nodes, one isomorphic node in the isomorphic social graph is an identifier of social information, and the plurality of isomorphic nodes comprise an identifier of the first social information, an identifier of the second social information and an identifier of the third social information; determining a first weight and a second weight according to the isomorphic social graph, wherein the first weight is determined according to a connection edge between the identifier of the first social information and the identifier of the second social information, and the second weight is determined according to a connection edge between the identifier of the first social information and the identifier of the third social information; if the first weight is higher than a first threshold value, determining that the first social information and the second social information belong to the same category; determining that the first social information and the third social information belong to different categories if the second weight is lower than a second threshold.

The connection edge between at least two heterogeneous nodes may be a connection edge between at least two heterogeneous nodes of the same type, and/or a connection edge between at least two heterogeneous nodes of different types.

For example, referring to fig. 2, fig. 2 is a schematic diagram of a heterogeneous social graph according to an embodiment of the present disclosure. As shown in fig. 2, a connection edge may exist between one heterogeneous node (identification of social information) and another node, for example, a connection edge may exist between one heterogeneous node (identification of social information) and a node of word text, tag information, user identification, time information, etc., and a connection edge may also exist between one heterogeneous node (identification of social information) and an identification of another social information. It can be understood that a connection edge may exist between one heterogeneous node (identification of social information) and a word text, tag information, user identification, time information, and the like, that is, a connection edge between at least two heterogeneous nodes of different types; a connecting edge may also exist between one heterogeneous node (identification of social information) and an identification of another social information, i.e. between at least two heterogeneous nodes of the same type.

Wherein, the connecting edge between at least two isomorphic nodes can be the connecting edge between at least two isomorphic nodes of the same type.

For example, referring to fig. 3, fig. 3 is a schematic diagram of a homogeneous social graph obtained based on the heterogeneous social graph shown in fig. 2. As shown in fig. 3, there is a connecting edge between every two identifications of social information (every two isomorphic nodes) in the three identifications of social information (three isomorphic nodes), i.e., between at least two isomorphic nodes of the same type.

The first threshold may be the same as or different from the second threshold, and is not limited herein. Such as the first threshold being higher than the second threshold.

Optionally, generating a homogeneous social graph according to the heterogeneous social graph includes: mapping the heterogeneous social graph into a homogeneous social graph based on a Heterogeneous Information Network (HIN) mapping rule.

Wherein the HIN mapping rule comprises one or more of the following: if the similarity between the word text connected with the identification of the social information D in the heterogeneous social graph and the word text connected with the identification of the social information E in the heterogeneous social graph is greater than or equal to a third threshold value, connecting the identification of the social information D and the identification of the social information E in the homogeneous social graph; if the tag information connected with the identifier of the social information D in the heterogeneous social graph is the same as the tag information connected with the identifier of the social information E in the heterogeneous social graph, connecting the identifier of the social information D with the identifier of the social information E in the homogeneous social graph; if the user identification connected with the identification of the social information D in the heterogeneous social graph is the same as the user identification connected with the identification of the social information E in the heterogeneous social graph, connecting the identification of the social information D with the identification of the social information E in the homogeneous social graph; if the time information connected with the identification of the social information D in the heterogeneous social graph is the same as the time information connected with the identification of the social information E in the heterogeneous social graph, connecting the identification of the social information D with the identification of the social information E in the homogeneous social graph; and if the difference value between the time information connected with the identifier of the social information D in the heterogeneous social graph and the time information connected with the identifier of the social information E in the heterogeneous social graph is less than or equal to a fourth threshold value, connecting the identifier of the social information D and the identifier of the social information E in the homogeneous social graph.

The third threshold is different from the fourth threshold, such as the third threshold is greater than the fourth threshold, or the third threshold is less than the fourth threshold.

It can be seen that, in the above technical solution, the obtained isomorphic social graph is made to better conform to the actual situation by obtaining the isomorphic social graph based on the heterogeneous social graph. Meanwhile, the first weight and the second weight are determined according to the isomorphic social graph, so that whether different social information belongs to the same category or not can be determined according to the two weights, and accuracy of category determination is improved.

Optionally, before the obtaining the heterogeneous social graph, the method further includes: acquiring a plurality of pieces of social information within preset time; extracting word texts, label information, user identifications, time information and identifications of the social information contained in each piece of social information in the plurality of pieces of social information; and generating the heterogeneous social graph according to word texts, label information, user identifications, time information and identifications of social information contained in each piece of social information.

The preset time may be set by an administrator or configured in a configuration file, which is not limited herein.

The plurality of pieces of social information may be included in the same social information block, the number of the social information block is within a preset number range, the preset coding range may be 0 to t + w, t is an integer greater than or equal to 0 and smaller than w, w is a time window length for maintaining the recommendation model, and the time window length may be set or configured in a configuration file by an administrator, which is not limited herein. It should be understood that, in the present application, the social information contained in the social information block within the preset encoding range is not outdated.

It can be understood that in the present application, different social information blocks correspond to different numbers, and the size of the number is used to indicate the chronological order of occurrence of the social information blocks. In addition, the times at which different social information occurs in the same social information block may be different or the same, i.e., the time information contained in different social information in the same social information block may be different or the same.

It can be seen that, in the above technical scheme, the generation of the heterogeneous social graph is realized.

Optionally, the determining the first weight and the second weight according to the isomorphic social graph includes: if the connecting edge between at least two isomorphic nodes in the isomorphic social graph is determined according to the word text associated with the identifiers of different social information in the heterogeneous social graph, determining the first weight according to the similarity between the word text associated with the identifier of the first social information and the word text associated with the identifier of the second social information; determining the second weight according to the similarity between the word text associated with the identifier of the first social information and the word text associated with the identifier of the third social information.

Wherein determining the first weight according to a similarity between the word text associated with the identifier of the first social information and the word text associated with the identifier of the second social information may include: and determining the first weight according to the cosine similarity between the word text associated with the identifier of the first social information and the word text associated with the identifier of the second social information.

Wherein determining the second weight according to a similarity between the word text associated with the identifier of the first social information and the word text associated with the identifier of the third social information comprises: and determining the second weight according to the cosine similarity between the word text associated with the identifier of the first social information and the word text associated with the identifier of the third social information.

It can be seen that, in the above technical solution, the weight is determined by the similarity between word texts associated with the identifiers of different social information, so that it is more accurate to determine whether the words belong to the same category according to the weight.

Optionally, the determining the first weight and the second weight according to the isomorphic social graph includes: if the connecting edge between at least two isomorphic nodes in the isomorphic social graph is determined according to the label information associated with the identifiers of different social information in the heterogeneous social graph, determining the first weight according to the similarity between the label information associated with the identifier of the first social information and the label information associated with the identifier of the second social information; determining the second weight according to a similarity between the tag information associated with the identifier of the first social information and the tag information associated with the identifier of the third social information.

Wherein determining the second weight according to a similarity between tag information associated with the identifier of the first social information and tag information associated with the identifier of the third social information comprises: and determining the second weight according to cosine similarity between the tag information associated with the identifier of the first social information and the tag information associated with the identifier of the third social information.

It can be seen that, in the above technical scheme, the weight is determined through the similarity between the tag information associated with the identifiers of different social information, so that whether the tag information belongs to the same category can be determined more accurately according to the weight.

Optionally, the determining the first weight and the second weight according to the isomorphic social graph includes: if the connecting edge between at least two isomorphic nodes in the isomorphic social graph is determined according to the time information associated with the identifiers of different social information in the heterogeneous social graph, determining the first weight according to the difference value between the time information associated with the identifier of the first social information and the time information associated with the identifier of the second social information; determining the second weight according to a difference between time information associated with the identifier of the first social information and time information associated with the identifier of the third social information.

It can be seen that, in the above technical solution, the weight is determined by the similarity between the time information associated with the identifiers of different social information, so that it can be more accurate to determine whether the time information belongs to the same category according to the weight.

103. And determining the distance between the first characteristic vector and the second characteristic vector to obtain a first distance.

104. And determining the distance between the first characteristic vector and the third characteristic vector to obtain a second distance.

105. Determining a loss function based on a difference between the first distance and the second distance.

106. And adjusting the model parameters of the recommendation model according to the loss function so as to train the recommendation model.

It can be seen that, in the above technical solution, the loss function can be determined according to a difference between the first distance and the second distance by determining the first distance between the feature vectors corresponding to the social information belonging to the same category and determining the second distance between the feature vectors corresponding to the social information belonging to different categories. Because the loss function is determined according to the first distance between the feature vectors corresponding to the social information belonging to the same category and the second distance between the feature vectors corresponding to the social information belonging to different categories, the expression forms of the same type of data can be richer when the model parameters of the recommendation model are adjusted by using the loss function, so that the feature extraction capability of the recommendation model is enhanced, and the generalization capability of the recommendation model is improved.

Optionally, the input of the recommendation model is miModel parameters of the first layerInput with the recommendation model is mjModel parameters for the temporal front layer l-1(ii) related; wherein l is an integer greater than or equal to 2; m isiIs the first social information, mjIs the second social information; or, miIs the first social information, mjIs the third social information.

It can be seen that, in the above technical solution, because the input of the recommendation model is miModel parameters of the first layerInput with the recommendation model is mjModel parameters for the temporal front layer l-1And the model parameters of different layers in the recommendation model have a relevant relationship, so that the information contained in the model parameters is richer, and the generalization capability of the recommendation model is improved.

Alternatively to this, the first and second parts may,the following formula is satisfied:

wherein the headers indicate that the model parameters of the first l-1 layer are connected in series in the direction of the head, and N (m)j) Is mjOf the adjacent matrix of (a) and (b),the input for the recommendation model is mjThe model parameters of the first layer l-1 are extracted,the input for aggregating in the recommendation model is mjThe model parameters of the first l-1 layer are extracted.

Optionally, a loss function ζtThe following formula is satisfied:

wherein m isiIs the first social information, mi+Is the second social information, mi-As the third social information, it is,the first distance is a distance between the first and second electrodes,and a is a second distance, a is a regularization parameter, and T is a set formed by a combination of every three pieces of social information, wherein the social information A and the social information B in the combination belong to the same type, and the social information A and the social information C in the combination belong to different types.

Referring to fig. 4, fig. 4 is a schematic flowchart of another model parameter adjustment method provided in the embodiment of the present application. As shown in fig. 4, the method includes:

401. the method comprises the steps of obtaining first social information, second social information and third social information, wherein the first social information and the second social information belong to the same category, and the first social information and the third social information belong to different categories.

Step 401 is the same as step 101 in fig. 1, and is not described herein again.

402. A heterogeneous social graph is obtained.

Step 402 may refer to the related description of step 102 in fig. 1, and is not repeated herein.

403. And generating a homogeneous social graph according to the heterogeneous social graph.

Step 403 may refer to the related description of step 102 in fig. 1, which is not repeated herein.

404. Determining a first weight and a second weight according to the isomorphic social graph.

Step 404 may refer to the related description of step 102 in fig. 1, and is not repeated herein.

405. If the first weight is higher than a first threshold value, determining that the first social information and the second social information belong to the same category.

Step 405 may refer to the related description of step 102 in fig. 1, and is not described herein again.

406. Determining that the first social information and the third social information belong to different categories if the second weight is lower than a second threshold.

Step 406 may refer to the related description of step 102 in fig. 1, and is not repeated herein.

407. And respectively encoding the first social information, the second social information and the third social information to obtain a first feature vector, a second feature vector and a third feature vector.

Step 407 is the same as step 102 in fig. 1, and is not repeated herein.

408. And determining the distance between the first characteristic vector and the second characteristic vector to obtain a first distance.

Step 408 is the same as step 103 in fig. 1, and is not repeated herein.

409. And determining the distance between the first characteristic vector and the third characteristic vector to obtain a second distance.

Step 409 is the same as step 104 in fig. 1, and is not described herein again.

410. Determining a loss function based on a difference between the first distance and the second distance.

Step 410 is the same as step 105 in fig. 1, and is not repeated herein.

411. And adjusting the model parameters of the recommendation model according to the loss function so as to train the recommendation model.

Step 411 is the same as step 106 in fig. 1, and is not repeated herein.

It can be seen that, in the above technical solution, the loss function can be determined according to a difference between the first distance and the second distance by determining the first distance between the feature vectors corresponding to the social information belonging to the same category and determining the second distance between the feature vectors corresponding to the social information belonging to different categories. Because the loss function is determined according to the first distance between the feature vectors corresponding to the social information belonging to the same category and the second distance between the feature vectors corresponding to the social information belonging to different categories, the expression forms of the same type of data can be richer when the model parameters of the recommendation model are adjusted by using the loss function, so that the feature extraction capability of the recommendation model is enhanced, and the generalization capability of the recommendation model is improved. Meanwhile, the isomorphic social graph is obtained based on the heterogeneous social graph, so that the obtained isomorphic social graph is more in line with the actual situation. Meanwhile, the first weight and the second weight are determined according to the isomorphic social graph, so that whether different social information belongs to the same category or not can be determined according to the two weights, and accuracy of category determination is improved.

Referring to fig. 5, fig. 5 is a schematic view of a model parameter adjusting apparatus according to an embodiment of the present disclosure. As shown in fig. 5, a model parameter adjusting apparatus 500 provided in this embodiment of the present application includes an obtaining module 501, an encoding module 502, a first determining module 503, a second determining module 504, a third determining module 505, and a training module 506,

the obtaining module 501 is configured to obtain first social information, second social information, and third social information, where the first social information and the second social information belong to the same category, and the first social information and the third social information belong to different categories; the encoding module 502 is configured to encode the first social information, the second social information, and the third social information respectively to obtain a first feature vector, a second feature vector, and a third feature vector; the first determining module 503 is configured to determine a distance between the first feature vector and the second feature vector to obtain a first distance; the second determining module 504 is configured to determine a distance between the first feature vector and the third feature vector to obtain a second distance; the third determining module 505 is configured to determine a loss function according to a difference between the first distance and the second distance; the training module 506 is configured to adjust a model parameter of the recommendation model according to the loss function, so as to train the recommendation model.

Optionally, the model parameter adjusting apparatus 500 further includes a generating module 507, and an obtaining module 501, and is further configured to obtain a heterogeneous social graph, where the heterogeneous social graph includes a plurality of heterogeneous nodes and connection edges between at least two of the plurality of heterogeneous nodes, and one of the heterogeneous nodes in the heterogeneous social graph includes one of: the method comprises the steps of word text, tag information, user identification, time information and identification of social information, wherein the tag information is used for identifying the category of the social information; a generating module 507, configured to generate a isomorphic social graph according to the heterogeneous social graph, where the isomorphic social graph includes a plurality of isomorphic nodes and a connection edge between at least two isomorphic nodes in the plurality of isomorphic nodes, one isomorphic node in the isomorphic social graph is an identifier of social information, and the plurality of isomorphic nodes includes an identifier of the first social information, an identifier of the second social information, and an identifier of the third social information; a first determining module 503, further configured to determine, according to the isomorphic social graph, a first weight and a second weight, where the first weight is determined according to a connection edge between the identifier of the first social information and the identifier of the second social information, and the second weight is determined according to a connection edge between the identifier of the first social information and the identifier of the third social information; the first determining module 503 is further configured to determine that the first social information and the second social information belong to the same category if the first weight is higher than a first threshold; the first determining module 503 is further configured to determine that the first social information and the third social information belong to different categories if the second weight is lower than a second threshold.

Optionally, the model parameter adjusting apparatus 500 further includes an extracting module 508, and the obtaining module 501, further configured to obtain a plurality of pieces of social information within a preset time; the extracting module 508 is further configured to extract word texts, tag information, user identifiers, time information, and identifiers of social information included in each piece of social information of the plurality of pieces of social information; the generating module 507 is further configured to generate the heterogeneous social graph according to the word text, the tag information, the user identifier, the time information, and the identifier of the social information included in each piece of social information.

Optionally, when determining the first weight and the second weight according to the isomorphic social graph, the first determining module 503 is configured to determine the first weight according to a similarity between a word text associated with the identifier of the first social information and a word text associated with the identifier of the second social information if a connecting edge between at least two isomorphic nodes in the isomorphic social graph is determined according to the word text associated with the identifiers of different social information in the heterogeneous social graph; determining the second weight according to the similarity between the word text associated with the identifier of the first social information and the word text associated with the identifier of the third social information.

Optionally, the input of the recommendation model is miModel parameters of the first layerInput with the recommendation model is mjModel parameters for the temporal front layer l-1(ii) related; wherein l is an integer greater than or equal to 2; m isiIs the first social information, mjIs the second social information; or, miIs the first social information, mjIs the third social information.

Alternatively to this, the first and second parts may,the following formula is satisfied:

wherein the headers represent the model parameters of the first l-1 layer as a string in the direction of the headLin, N (m)j) Is mjOf the adjacent matrix of (a) and (b),the input for the recommendation model is mjThe model parameters of the first layer l-1 are extracted,the input for aggregating in the recommendation model is mjThe model parameters of the first l-1 layer are extracted.

Optionally, a loss function ζtThe following formula is satisfied:

wherein m isiIs the first social information, mi+Is the second social information, mi-As the third social information, it is,the first distance is a distance between the first and second electrodes,and a is a second distance, a is a regularization parameter, and T is a set formed by a combination of every three pieces of social information, wherein the social information A and the social information B in the combination belong to the same type, and the social information A and the social information C in the combination belong to different types.

Referring to fig. 6, fig. 6 is a schematic structural diagram of an electronic device in a hardware operating environment according to an embodiment of the present application.

Embodiments of the present application provide an electronic device for model parameter adjustment, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor to execute instructions comprising steps in any of the model parameter adjustment methods. As shown in fig. 6, an electronic device of a hardware operating environment according to an embodiment of the present application may include:

a processor 601, such as a CPU.

The memory 602 may alternatively be a high speed RAM memory or a stable memory such as a disk memory.

A communication interface 603 for implementing connection communication between the processor 601 and the memory 602.

Those skilled in the art will appreciate that the configuration of the electronic device shown in fig. 6 is not intended to be limiting and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.

As shown in fig. 6, the memory 602 may include an operating system, a network communication module, and one or more programs. An operating system is a program that manages and controls the server hardware and software resources, supporting the execution of one or more programs. The network communication module is used for communication among the components in the memory 602 and with other hardware and software in the electronic device.

In the electronic device shown in fig. 6, the processor 601 is configured to execute one or more programs in the memory 602, and implement the following steps:

acquiring first social contact information, second social contact information and third social contact information, wherein the first social contact information and the second social contact information belong to the same category, and the first social contact information and the third social contact information belong to different categories;

respectively encoding the first social contact information, the second social contact information and the third social contact information to obtain a first feature vector, a second feature vector and a third feature vector;

determining the distance between the first characteristic vector and the second characteristic vector to obtain a first distance;

determining the distance between the first characteristic vector and the third characteristic vector to obtain a second distance;

determining a loss function based on a difference between the first distance and the second distance;

and adjusting the model parameters of the recommendation model according to the loss function so as to train the recommendation model.

For specific implementation of the electronic device related to the present application, reference may be made to various embodiments of the model parameter adjustment method, which are not described herein again.

The present application further provides a computer readable storage medium for storing a computer program, the stored computer program being executable by the processor to perform the steps of:

acquiring first social contact information, second social contact information and third social contact information, wherein the first social contact information and the second social contact information belong to the same category, and the first social contact information and the third social contact information belong to different categories;

respectively encoding the first social contact information, the second social contact information and the third social contact information to obtain a first feature vector, a second feature vector and a third feature vector;

determining the distance between the first characteristic vector and the second characteristic vector to obtain a first distance;

determining the distance between the first characteristic vector and the third characteristic vector to obtain a second distance;

determining a loss function based on a difference between the first distance and the second distance;

and adjusting the model parameters of the recommendation model according to the loss function so as to train the recommendation model.

For specific implementation of the computer-readable storage medium related to the present application, reference may be made to the embodiments of the model parameter adjustment method, which are not described herein again.

It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art should understand that the present application is not limited by the order of acts described, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in this specification are preferred embodiments and that the acts and modules involved are not necessarily required for this application.

The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

19页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于智慧屏一键找伴处理方法、装置、智能终端及介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!