Method for training graph pre-training model and method and device for classifying graphs

Through multi-task training and dynamic loss function weight adjustment, the problem of poor performance of existing graph pre-training models is solved, the model performance is improved and the graph pre-training process is optimized.

CN118940097APending Publication Date: 2024-11-12XIAOHONGSHU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310531565.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-11
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

The existing graph pre-training model fails to fully utilize the node-edge relationship in the graph during the pre-training process, and the loss function weight adjustment is inflexible, resulting in unsatisfactory model performance.

Method used

The multi-task training method is adopted, including random mask nodes, random mask edges, random walk paths and metapath-based tasks, and the loss function weight is dynamically adjusted to build multiple loss functions and train the graph pre-trained model.

Benefits of technology

The performance of the graph pre-trained model is significantly improved, and the model is fine-tuned and optimized by fully utilizing the node-edge relationship in the graph, and dynamically adjusting the loss function weights.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118940097A_ABST
    Figure CN118940097A_ABST
Patent Text Reader

Abstract

The invention discloses a method for training a graph pre-training model and a method and device for classifying graphs. The method for training the graph pre-training model comprises the following steps: an obtaining step: obtaining a plurality of vector representations of a plurality of graphs, each vector representation comprising a plurality of nodes and a plurality of edges; a masking step: respectively performing masking processing on the plurality of vector representations by utilizing the plurality of tasks to obtain a plurality of groups of mask vector representations respectively corresponding to the plurality of tasks; a construction step: constructing a plurality of loss functions respectively corresponding to the plurality of tasks by using the plurality of groups of mask vector representations; and a training step: training the graph pre-training model by using the plurality of loss functions to obtain a trained graph pre-training model. According to the training method, the performance of the graph pre-training model is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a method for training a graph pre-training model, a method and device for classifying graphs, a storage medium, and an electronic device. Background Art

[0002] Graph pre-training refers to pre-training the vector representation of a graph. The vector representation of a graph includes two aspects: the vector of the edge and the vector of the node. At present, the vector representation of the graph is generally trained by random initialization, and then the downstream tasks are trained. In order to optimize the vector representation of the graph, the graph has been pre-trained. The existing graph pre-training model uses two pre-training tasks, that is, masking the edges or masking the nodes, and then predicting the edges and nodes to pre-train the graph. Moreover, the existing graph pre-training models add the loss functions of these two pre-training tasks without performing additional operations. Therefore, the existing graph pre-training models are not ideal. Summary of the invention

[0003] Embodiments of the present application provide a method for training a graph pre-training model, a method for classifying a graph, an apparatus, a storage medium, an electronic device, and a computer program product.

[0004] In a first aspect, an embodiment of the present application provides a method for training a graph pre-training model for an electronic device, the method comprising:

[0005] An acquisition step of acquiring multiple vector representations of multiple graphs, each vector representation including multiple nodes and multiple edges;

[0006] A masking step, using a plurality of tasks to respectively perform masking processing on the plurality of vector representations to obtain a plurality of groups of mask vector representations corresponding to the plurality of tasks;

[0007] A construction step, using the multiple groups of mask vector representations to construct multiple loss functions corresponding to the multiple tasks respectively;

[0008] The training step uses a plurality of the loss functions to train the graph pre-training model to obtain a trained graph pre-training model.

[0009] In a possible implementation of the first aspect, the method further includes: calculating the mask vector representation corresponding to each task using a similarity function to obtain a weight of each task,

[0010] Wherein, each loss function is assigned the weight of the corresponding task.

[0011] In a possible implementation of the first aspect above, the multiple tasks include: a first task of randomly masking nodes, a second task of randomly masking edges, and a third task based on random walk paths and / or a fourth task based on meta-paths.

[0012] In a possible implementation of the first aspect, the first group of mask vectors corresponding to the first task represents a first group of mask nodes, the second group of mask vectors corresponding to the second task represents a second group of mask edges, the third group of mask vectors corresponding to the third task represents a third group of mask nodes and edges, and the fourth group of mask vectors corresponding to the fourth task represents a fourth group of mask nodes and edges.

[0013] The first group of masked nodes, the second group of masked edges, the third group of masked nodes and edges, and the fourth group of masked nodes and edges are the same or different.

[0014] In a possible implementation of the first aspect, each group of mask vector representations includes unmasked nodes and / or edges and masked nodes and / or edges.

[0015] The construction step further includes: for each group of mask vector representations, using the unmasked nodes and / or edges to perform predictions to obtain predicted masked nodes and / or edges, and using the predicted masked nodes and / or edges and the masked nodes and / or edges to construct the loss function.

[0016] In a second aspect, an embodiment of the present application provides a method for classifying a graph, which is used in an electronic device, and the method includes:

[0017] Acquisition step, obtaining the graph to be classified;

[0018] The classification step is to input the graph to be classified into the graph pre-training model trained according to the first aspect, so as to classify the graph to be classified.

[0019] In a third aspect, an embodiment of the present application provides a device for training a graph pre-training model, the device comprising:

[0020] An acquisition unit, acquiring multiple vector representations of multiple graphs, each vector representation including multiple nodes and multiple edges;

[0021] A mask unit, using a plurality of tasks to respectively perform mask processing on the plurality of vector representations to obtain a plurality of groups of mask vector representations corresponding to the plurality of tasks;

[0022] A construction unit, using the multiple groups of mask vector representations to construct multiple loss functions corresponding to the multiple tasks respectively;

[0023] The training unit trains the graph pre-training model using the multiple loss functions to obtain a trained graph pre-training model.

[0024] In a fourth aspect, an embodiment of the present application provides a device for classifying a graph, wherein the device comprises:

[0025] An acquisition unit is used to acquire a graph to be classified;

[0026] The classification unit inputs the graph to be classified into the graph pre-training model trained according to the third aspect, thereby classifying the graph to be classified.

[0027] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising computer executable instructions, which are executed by a processor to implement the method of training a graph pre-training model described in the first aspect or the method of classifying a graph described in the second aspect.

[0028] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium having instructions stored thereon, which, when executed on a computer, causes the computer to execute the method for training a graph pre-training model described in the first aspect or the method for classifying graphs described in the second aspect.

[0029] In the seventh aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; one or more memories; wherein the one or more memories store one or more programs, and when the one or more programs are executed by the one or more processors, the electronic device executes the method for training a graph pre-training model described in the first aspect or the method for classifying a graph described in the second aspect.

[0030] The present invention proposes a method for training a graph pre-training model based on multiple tasks, adds two tasks that are different from the previous graph pre-training model (i.e., a third task based on random walk paths and a fourth task based on meta-paths), and makes full use of the relationship between nodes and edges in the graph. These tasks greatly improve the performance of the graph pre-training model.

[0031] In addition, the present invention can dynamically adjust the weights of the loss functions of different tasks to achieve fine-tuning, so that the performance of the graph pre-training model is further optimized. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 According to some embodiments of the present application, a block diagram of an electronic device is shown;

[0033] Figure 2 According to some embodiments of the present application, a flowchart of a method for training a graph pre-training model is shown;

[0034] Figure 3 According to some embodiments of the present application, a flowchart of a method for classifying a graph is shown;

[0035] Figure 4 According to some embodiments of the present application, a structural diagram of an apparatus for training a graph pre-training model is shown;

[0036] Figure 5 According to some embodiments of the present application, a structural diagram of an apparatus for classifying images is shown. DETAILED DESCRIPTION

[0037] Illustrative embodiments of the present application include, but are not limited to, methods for training a graph pre-training model, methods, apparatuses, media, electronic devices, and computer program products for classifying graphs.

[0038] The embodiments of the present application will be described in further detail below in conjunction with the accompanying drawings.

[0039] Figure 1 According to some embodiments of the present application, a block diagram of an electronic device is shown.

[0040] like Figure 1 As shown, the electronic device 100 may include one or more processors 102, a system motherboard 108 connected to at least one of the processors 102, a system memory 104 connected to the system motherboard 108, a non-volatile memory (NVM) 106 connected to the system motherboard 108, and a network interface 110 connected to the system motherboard 108.

[0041] The processor 102 may include one or more single-core or multi-core processors. The processor 102 may include any combination of a general-purpose processor (CPU) and a special-purpose processor (e.g., a graphics processor, an application processor, a baseband processor, etc.). A graphics processing unit (GPU) is a special-purpose processor that has a higher number of cores and powerful parallel computing capabilities than a general-purpose processor and is widely used in computer graphics processing. In an embodiment of the present invention, the processor 102 may be configured to execute the following: Figure 2 Or one or more of the various embodiments shown in 3.

[0042] In some embodiments, the system board 108 may include any suitable interface controller (not shown). Figure 1 ), to provide any suitable interface to at least one of the processors 102 and / or any suitable device or component in communication with the system motherboard 108.

[0043] In some embodiments, the system board 108 may include one or more memory controllers to provide an interface to the system memory 104. The system memory 104 may be used to load and store data and / or instructions 120. In some embodiments, the system memory 104 of the electronic device 100 may include any suitable volatile memory, such as a suitable dynamic random access memory (DRAM).

[0044] The non-volatile memory 106 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions 120. In some embodiments, the non-volatile memory 106 may include any suitable non-volatile memory such as flash memory and / or any suitable non-volatile storage device, such as at least one of a HDD (Hard Disk Drive), a CD (Compact Disc) drive, and a DVD (Digital Versatile Disc) drive.

[0045] The non-volatile memory 106 may include a portion of storage resources installed on the device of the electronic device 100, or it may be accessible to an external device but is not necessarily a portion of the external device. For example, the non-volatile memory 106 may be accessed over a network via the network interface 110.

[0046] In particular, the system memory 104 and the non-volatile memory 106 may respectively include: a temporary copy and a permanent copy of the instructions 120. The instructions 120 may include: when executed by at least one of the processors 102, causing the electronic device 100 to implement the following Figure 2 or Figure 3 In some embodiments, the instructions 120 , hardware, firmware, and / or software components thereof may additionally / alternatively be located in the system board 108 , the network interface 110 , and / or the processor 102 .

[0047] The network interface 110 may include a transceiver for providing a radio interface for the electronic device 100, thereby communicating with any other suitable device (e.g., a front-end module, an antenna, etc.) through one or more networks. In some embodiments, the network interface 110 may be integrated with other components of the electronic device 100. For example, the network interface 110 may be integrated with at least one of the processor 102, the system memory 104, the non-volatile memory 106, and a firmware device (not shown) having instructions. When at least one of the processors 102 executes the instructions, the electronic device 100 implements Figure 2 Or one or more of the various embodiments shown in 3.

[0048] The network interface 110 may further include any suitable hardware and / or firmware to provide a multiple-input multiple-output radio interface. For example, the network interface 110 may be a network adapter, a wireless network adapter, a telephone modem, and / or a wireless modem.

[0049] In one embodiment, at least one of the processors 102 may be packaged together with one or more controllers for the system motherboard 108 to form a system in package (SiP). In one embodiment, at least one of the processors 102 may be integrated on the same die with one or more controllers for the system motherboard 108 to form a system on a chip (SoC).

[0050] The electronic device 100 may further include an input / output (I / O) device 112 connected to the system motherboard 108. The I / O device 112 may include a user interface to enable a user to interact with the electronic device 100; the design of the peripheral component interface enables the peripheral components to interact with the electronic device 100. In some embodiments, the electronic device 100 further includes a sensor for determining at least one of an environmental condition and location information related to the electronic device 100.

[0051] In some embodiments, the I / O device 112 may include, but is not limited to, a display (e.g., a liquid crystal display, a touch screen display, etc.), a speaker, a microphone, one or more cameras (e.g., a still image camera and / or a video camera), a flashlight (e.g., a light emitting diode flash), a keyboard, and a graphics card. The graphics card is composed of a graphics processor integrated with an I / O interface (e.g., a PCIE interface) that complies with the data transmission protocol specification.

[0052] In some embodiments, the peripheral component interface may include, but is not limited to, a non-volatile memory port, an audio jack, and a power interface.

[0053] In some embodiments, the sensors may include, but are not limited to, gyroscope sensors, accelerometers, proximity sensors, ambient light sensors, and positioning units. The positioning unit may also be part of or interact with the network interface 110 to communicate with components of a positioning network (e.g., global positioning system (GPS) satellites).

[0054] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0055] Program code can be applied to input instructions to perform the functions described in the present invention and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a system for processing instructions including processor 102 includes any system having a processor such as a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.

[0056] Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program code can also be implemented with assembly language or machine language. In fact, the mechanism described in the present invention is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.

[0057] One or more aspects of at least one embodiment may be implemented by instructions stored on a computer-readable storage medium, which, when read and executed by a processor, enables an electronic device to implement the method of the embodiment described in the present invention.

[0058] The method for training a graph pre-training model and the method for classifying a graph provided in this application can be applied to Figure 1 In the electronic device 100 shown, the electronic device 100 is, for example, a computer, a mobile device, a platform device, etc.

[0059] Figure 2 is a flow chart of a method for training a graph pre-training model according to an embodiment of the present invention. It can be understood that the graph pre-training model is a graph neural network.

[0060] In the acquisition step S21 , multiple vector representations of multiple graphs are acquired, each vector representation including multiple nodes and multiple edges.

[0061] The multiple graphs are, for example, multiple training graphs for training a model. After receiving the training graphs, the training graphs are encoded to obtain a vector representation of each training graph.

[0062] It can be understood that each vector representation includes a plurality of nodes and a plurality of edges.

[0063] In the masking step S22, a plurality of tasks are used to perform masking processing on the plurality of vector representations respectively, so as to obtain a plurality of groups of mask vector representations corresponding to the plurality of tasks respectively.

[0064] Masking is a common operation in deep learning, which is equivalent to covering the original nodes or edges with a mask to cover some specific nodes or edges.

[0065] The plurality of tasks include a first task of randomly masking nodes, a second task of randomly masking edges, and a third task based on random walk paths and / or a fourth task based on meta paths.

[0066] In this embodiment, for example, the multiple tasks include a first task of randomly masking nodes, a second task of randomly masking edges, a third task based on random walk paths, and a fourth task based on meta-paths.

[0067] Specifically, the first task of randomly masking nodes refers to randomly performing masking processing on any node in the plurality of vector representations to obtain a first group of masked vector representations corresponding to the first task. It is understandable that the first group of masked vector representations includes a first group of masked nodes.

[0068] The second task of randomly masking edges refers to randomly masking any edge in the plurality of vector representations to obtain a second set of masked vector representations corresponding to the second task. It is understandable that the second set of masked vector representations includes a second set of masked edges.

[0069] Since there is a direct connection between edges and nodes, in order to ensure that the information of edges and nodes can be mutually utilized, the present invention utilizes the third task based on random walk paths to construct multiple different paths and mask these paths. Specifically, the third task based on random walk paths refers to uniformly finding n starting points from the vector representation of the graph, and then using these n starting points to perform random walks m times. Random walks refer to starting from a certain starting point and performing random walks in the vector representation of the graph. The nodes and edges passed through are the paths that need to be masked.

[0070] After the mask processing of the third task, a third set of mask vector representations corresponding to the third task can be obtained. It can be understood that the third set of mask vector representations includes a third set of mask nodes and edges.

[0071] In order to continue to utilize the relationship between edges and nodes, the present invention further utilizes the fourth task based on meta-path. Specifically, the fourth task based on meta-path refers to constructing multiple different types of paths using meta-paths to mask these paths. It can be understood that a meta-path is a path composed of node and relationship types, including related nodes and edges.

[0072] After the mask processing of the fourth task, a fourth group of mask vector representations corresponding to the fourth task can be obtained. It can be understood that the fourth group of mask vector representations includes a fourth group of mask nodes and edges.

[0073] It can be understood that the first group of masked nodes, the second group of masked edges, the third group of masked nodes and edges, and the fourth group of masked nodes and edges are the same or different, that is, the masked nodes and edges in each group of mask vector representations can be the same or different.

[0074] In this embodiment, the multiple tasks include the above four tasks. It is understandable that the multiple tasks in the present invention may include the first task, the second task and the third task, or include the first task, the second task and the fourth task, without limitation.

[0075] In the construction step S23, multiple groups of mask vector representations are used to construct multiple loss functions corresponding to multiple tasks.

[0076] In this embodiment, for example, four groups of mask vector representations as described above are obtained, and a loss function corresponding to the task can be constructed using each group of mask vector representations.

[0077] Each group of mask vector representations includes unmasked nodes and / or edges and masked nodes and / or edges. For each group of mask vector representations, prediction is performed using the unmasked nodes and / or edges to obtain predicted masked nodes and / or edges, and a loss function is constructed using the predicted masked nodes and / or edges and the masked nodes and / or edges.

[0078] For example, the first group of mask vectors includes unmasked nodes and edges, and masked nodes, and the unmasked nodes and edges are used to predict those masked nodes, thereby obtaining predicted masked nodes. It can be understood that the specific prediction method is the same as that in the prior art, so it is not described in detail here.

[0079] Next, a first loss function Loss 1 is constructed using the predicted mask nodes and the actual mask nodes in the first set of mask vector representations.

[0080] The second set of mask vector representations includes unmasked nodes and edges, and masked edges, and the unmasked nodes and edges are used to predict those masked edges, thereby obtaining predicted masked edges. Next, the second loss function Loss 2 is constructed using the predicted masked edges and the actual masked edges in the second set of mask vector representations.

[0081] The third set of mask vector representations includes unmasked nodes and edges, and masked nodes and edges, and the unmasked nodes and edges are used to predict those masked nodes and edges, thereby obtaining predicted masked nodes and edges. Next, the third loss function Loss 3 is constructed using the predicted masked nodes and edges and the actual masked nodes and edges in the third set of mask vector representations.

[0082] The fourth set of mask vector representations includes unmasked nodes and edges, and masked nodes and edges, and the unmasked nodes and edges are used to predict those masked nodes and edges, thereby obtaining predicted masked nodes and edges. Next, a fourth loss function Loss 4 is constructed using the predicted masked nodes and edges and the actual masked nodes and edges in the fourth set of mask vector representations.

[0083] It is understandable that for each task, a corresponding loss function is constructed, and each loss function is not consistent. Since the loss functions of different tasks are inconsistent, a balance needs to be made when combining these loss functions. To this end, the method of the present invention also includes calculating the mask vector representation corresponding to each task using a similarity function to obtain the weight of each task, and each loss function is assigned the weight of the corresponding task.

[0084] Specifically, using the similarity function, the above four sets of mask vector representations can be calculated to obtain the weights w1, w2, w3, and w4 of each task. Each loss function is assigned the weight of the corresponding task and combined to obtain the total loss function L, which is specifically expressed as follows:

[0085] L=w1*Loss 1+w2*Loss 2+w3*Loss 3+w4*Loss 4

[0086] It will be appreciated that these weights may be adjusted dynamically during the learning process.

[0087] In the training step S24, the graph pre-training model is trained using multiple loss functions to obtain a trained graph pre-training model.

[0088] In the process of training a deep neural network, because we hope that the output of the deep neural network is as close as possible to the value we really want to predict, we can compare the predicted value of the current network with the target value we really want, and then update the weight vector of each layer of the neural network according to the difference between the two (of course, there is usually an initialization process before the first update, that is, pre-configuring parameters for each layer in the deep neural network); for example, if the predicted value of the network is high, adjust the weight vector to make it predict a lower value, and keep adjusting it until the deep neural network can predict the target value we really want or a value very close to the target value we really want. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value", which is the loss function, which is an important equation for measuring the difference between the predicted value and the target value. Among them, the higher the output value (loss) of the loss function, the greater the difference, so the training of the deep neural network becomes a process of minimizing this loss as much as possible.

[0089] In this embodiment, the above-mentioned total loss function L is used to calculate the loss, and stochastic gradient descent learning is performed to train the graph pre-training model to obtain a trained graph pre-training model.

[0090] The present invention proposes a method for training a graph pre-training model based on multiple tasks, adds two tasks that are different from the previous graph pre-training model (i.e., a third task based on random walk paths and a fourth task based on meta-paths), and makes full use of the relationship between nodes and edges in the graph. These tasks greatly improve the performance of the graph pre-training model.

[0091] In addition, the present invention can dynamically adjust the weights of the loss functions of different tasks to achieve fine-tuning, so that the performance of the graph pre-training model is further optimized.

[0092] Figure 3 is a flowchart of a method for classifying a graph according to an embodiment of the present invention.

[0093] In the acquisition step S31, a graph to be classified is acquired.

[0094] It can be understood that the image to be classified is, for example, an image input by a user that needs to be classified.

[0095] In the classification step S32, the graph to be classified is input according to Figure 2 The trained graph pre-training model obtained by the method shown is used to classify the graph to be classified.

[0096] By using the trained graph pre-training model of the present invention, the graph can be classified more accurately and efficiently to obtain optimized classification results.

[0097] The present invention also provides a device 40 for training a graph pre-training model, such as Figure 4 As shown, the device 40 includes: an acquisition unit 41, which acquires multiple vector representations of multiple graphs, each vector representation including multiple nodes and multiple edges; a mask unit 42, which uses multiple tasks to mask the multiple vector representations respectively to obtain multiple groups of masked vector representations corresponding to the multiple tasks respectively; a construction unit 43, which uses the multiple groups of masked vector representations to construct multiple loss functions corresponding to the multiple tasks respectively; a training unit 44, which uses the multiple loss functions to train the graph pre-training model to obtain a trained graph pre-training model.

[0098] It is understandable that the acquisition unit 41, the mask unit 42, the construction unit 43, and the training unit 44 can be implemented by the processor 102 having the functions of these modules or units in the electronic device 100. The implementation methods disclosed in the foregoing are method implementation methods corresponding to this implementation method, and this implementation method can be implemented in conjunction with the above-mentioned implementation methods. The relevant technical details mentioned in the above-mentioned implementation methods are still valid in this implementation method, and in order to reduce repetition, they will not be repeated here. Accordingly, the relevant technical details mentioned in this implementation method can also be applied in the above-mentioned implementation methods.

[0099] The present invention also provides a device 50 for classifying a graph, such as Figure 5 As shown, the device 50 includes: an acquisition unit 51, which acquires a graph to be classified; a classification unit 52, which inputs the graph to be classified into a classification system according to Figure 4 The trained graph pre-training model is obtained by the device to classify the graph to be classified.

[0100] It is understandable that the acquisition unit 51 and the classification unit 52 can be implemented by the processor 102 having the functions of these modules or units in the electronic device 100. The embodiments disclosed in the foregoing are method embodiments corresponding to this embodiment, and this embodiment can be implemented in conjunction with the above-mentioned embodiments. The relevant technical details mentioned in the above-mentioned embodiments are still valid in this embodiment, and in order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the above-mentioned embodiments.

[0101] The present invention also provides a computer program product, including computer executable instructions, which are executed by the processor 102 to implement the method of training a graph pre-training model or the method of classifying a graph of the present invention.

[0102] The present invention also provides a computer-readable storage medium having instructions stored thereon. When the instructions are executed on a computer, the computer executes the method for training a graph pre-training model or the method for classifying a graph of the present invention.

[0103] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one" do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0104] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it will be apparent to those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present application.

[0105] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0106] It should be understood that in order to streamline the present invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the intention that the claimed invention requires more features than those expressly recited in each claim. Rather, as reflected in the claims, inventive aspects lie in less than all of the features of the individual embodiments previously disclosed. Therefore, the claims that follow the detailed description are hereby expressly incorporated into the detailed description, with each claim itself serving as a separate embodiment of the present invention.

[0107] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0108] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims, any one of the claimed embodiments may be used in any combination.

Claims

1. A method for training a graph pre-training model, for use in electronic equipment, characterized in that: The method comprises: An acquisition step of acquiring multiple vector representations of multiple graphs, each vector representation including multiple nodes and multiple edges; A masking step, using a plurality of tasks to respectively perform masking processing on the plurality of vector representations to obtain a plurality of groups of mask vector representations corresponding to the plurality of tasks; A construction step, using the multiple groups of mask vector representations to construct multiple loss functions corresponding to the multiple tasks respectively; The training step uses a plurality of the loss functions to train the graph pre-training model to obtain a trained graph pre-training model.

2. The method according to claim 1, characterized in that The method further comprises: calculating the mask vector representation corresponding to each task using a similarity function to obtain a weight of each task, Wherein, each loss function is assigned the weight of the corresponding task.

3. The method according to claim 1, characterized in that The multiple tasks include: a first task of randomly masking nodes, a second task of randomly masking edges, and a third task based on random walk paths and / or a fourth task based on meta paths.

4. The method according to claim 3, characterized in that The first group of mask vectors corresponding to the first task represents a first group of mask nodes, the second group of mask vectors corresponding to the second task represents a second group of mask edges, the third group of mask vectors corresponding to the third task represents a third group of mask nodes and edges, and the fourth group of mask vectors corresponding to the fourth task represents a fourth group of mask nodes and edges. The first group of masked nodes, the second group of masked edges, the third group of masked nodes and edges, and the fourth group of masked nodes and edges are the same or different.

5. The method according to claim 1, characterized in that Each set of mask vector representations includes unmasked nodes and / or edges and masked nodes and / or edges, The construction step further includes: for each group of mask vector representations, using the unmasked nodes and / or edges to perform predictions to obtain predicted masked nodes and / or edges, and using the predicted masked nodes and / or edges and the masked nodes and / or edges to construct the loss function.

6. A method for classifying images, used in electronic equipment, characterized in that: The method comprises: Acquisition step, acquiring the graph to be classified; The classification step is to input the graph to be classified into the graph pre-training model trained according to any one of claims 1-5, so as to classify the graph to be classified.

7. A device for training a graph pre-training model, characterized in that: The device comprises: An acquisition unit, acquiring multiple vector representations of multiple graphs, each vector representation including multiple nodes and multiple edges; A mask unit, using a plurality of tasks to respectively perform mask processing on the plurality of vector representations to obtain a plurality of groups of mask vector representations corresponding to the plurality of tasks; A construction unit, using the multiple groups of mask vector representations to construct multiple loss functions corresponding to the multiple tasks respectively; The training unit trains the graph pre-training model using the multiple loss functions to obtain a trained graph pre-training model.

8. A device for classifying a graph, characterized in that: The device comprises: An acquisition unit is used to acquire a graph to be classified; A classification unit inputs the graph to be classified into a graph pre-training model trained according to any one of claims 1 to 5, thereby classifying the graph to be classified.

9. A computer program product comprising computer executable instructions, characterized in that: The instructions are executed by a processor to implement the method for training a graph pre-training model according to any one of claims 1 to 5 or the method for classifying a graph according to claim 6.

10. A computer-readable storage medium, characterized in that: The storage medium stores instructions, which, when executed on a computer, cause the computer to execute the method for training a graph pre-training model according to any one of claims 1 to 5 or the method for classifying a graph according to claim 6.

11. An electronic device, characterized in that: include: one or more processors; one or more memories; Wherein, the one or more memories store one or more programs, and when the one or more programs are executed by the one or more processors, the electronic device executes the method for training a graph pre-training model as described in any one of claims 1 to 5 or the method for classifying a graph as described in claim 6.