WO2024000512A1 - 一种模型训练方法以及相关设备 - Google Patents

一种模型训练方法以及相关设备 Download PDF

Info

Publication number
WO2024000512A1
WO2024000512A1 PCT/CN2022/103117 CN2022103117W WO2024000512A1 WO 2024000512 A1 WO2024000512 A1 WO 2024000512A1 CN 2022103117 W CN2022103117 W CN 2022103117W WO 2024000512 A1 WO2024000512 A1 WO 2024000512A1
Authority
WO
WIPO (PCT)
Prior art keywords
weight
node
feature representation
information
graph
Prior art date
Application number
PCT/CN2022/103117
Other languages
English (en)
French (fr)
Inventor
李凯迪
王神迪
李小慧
吴艺晖
曹琛
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2022/103117 priority Critical patent/WO2024000512A1/zh
Publication of WO2024000512A1 publication Critical patent/WO2024000512A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/51Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems at application loading time, e.g. accepting, rejecting, starting or inhibiting executable software based on integrity or source reliability
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology

Definitions

  • This application relates to the field of artificial intelligence, and in particular to a model training method and related equipment.
  • Artificial intelligence is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
  • artificial intelligence is a branch of computer science that attempts to understand the nature of intelligence and produce a new class of intelligent machines that can respond in a manner similar to human intelligence.
  • Artificial intelligence is the study of the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making.
  • a graph is a data structure including at least one node and at least one edge.
  • nodes in the graph can be mapped to objects (or entities), and edges in the graph can be mapped to relationships between entities.
  • Graphs can be directed or undirected.
  • the graph can also include other data besides nodes and edges, such as node labels and edge labels.
  • each node in the graph can represent a user, and each edge in the graph can represent the social relationship between different users.
  • the data of each node in the graph is The user's portrait data and the user's behavioral data, such as the user's age, occupation, hobbies, education, etc.
  • each node in the graph when applied to product recommendation scenarios, can represent a user or a product, and each edge in the graph can represent the interactive relationship between the user and the product, such as purchase relationship, collection relationship, etc. .
  • each node in the graph when applied to financial risk control scenarios, can represent an account, transaction or fund.
  • the interpreter of the graph is used to obtain the degree of influence of each node on the state of a certain node based on the information of the graph (for example, including node information and edge information).
  • graph interpretation is achieved through a perturbation-based interpretation method.
  • the idea of this method is to input the graph information into a graph neural network (GNN) used to achieve the target task.
  • GNN graph neural network
  • the target task It can be used to predict the status of a certain node.
  • By perturbing the input graph information and observing the output of the GNN model it can determine the role of each node in the input graph information on the GNN model in predicting the status of the node. This effect can be used as the degree of influence on the status of a certain node.
  • the above method can only obtain the degree of influence of nodes on the status of nodes, and the results of graph interpretation are incomplete (for example, the degree of influence of edges between nodes on the status of nodes cannot be obtained).
  • This application provides a model training method that can obtain more complete graph interpretation results than the existing technology.
  • This application provides a model training method, which is applied to servers or terminal devices on the cloud side.
  • the method includes:
  • the graph includes multiple nodes and edges between nodes.
  • the graph information includes node information and edge information. Each node corresponds to an object.
  • the node information includes object attributes and edge information. Includes relationships between objects;
  • the attributes of the character can be at least one of gender, age, occupation, income, hobbies and education level, where the gender can be male or female, and the age can be 0- A number between 100, the occupation can be teachers, programmers, chefs, etc., the hobbies can be basketball, tennis, running, etc., and the education level can be elementary school, junior high school, high school, university, etc.; this application is not limited to the target audience
  • the specific type of attribute for example, the object corresponding to the node is an item.
  • the item can be a physical item or a virtual item.
  • it can be an application (APP), audio and video, web page, news information, etc.
  • APP application
  • the attribute of the item can be an item. At least one of the name, developer, installation package size, category and rating. Taking the item as an application as an example, the category of the item can be chat, parkour games, office, etc., and the rating can be It is for ratings, comments, etc. on items; this application does not limit the specific types of attributes of items. Among them, taking the object corresponding to the node as a person as an example, the relationship between the objects can be a kinship relationship or an economic relationship (such as equity relationship, trade relationship, etc.).
  • the first characteristic representation of each node and the second characteristic representation of each edge are obtained; according to the first characteristic representation of each node, the first weight is obtained through the first neural network, and the first The weight is the weight of the node; the first weight is used to fuse with the corresponding first feature representation to obtain the third feature representation; according to the second feature representation of each edge, the second weight is obtained through the second neural network, so The second weight is the weight of the edge; the second weight is the weight of the edge; according to the third feature representation and the second weight, the first loss is obtained through the graph neural network GNN, and the first loss is used to determine the loss Function; update the first attention network, the second attention network and GNN according to the loss function.
  • the first weight can be fused with the corresponding first feature representation, which is equivalent to applying a perturbation to the first feature representation, which is equivalent to the role of the first neural network in obtaining the size of the applied perturbation based on the first feature representation. Since the input to The input in the subsequent task network (such as GNN) is the feature after the perturbation is applied (that is, the third feature representation). As the model is updated, there will be a trend in the perturbation: it has a greater impact on the accuracy of the network execution task. For nodes, their first weight will be given larger and larger (that is, the interference will be smaller and smaller), and for nodes that have less impact on the accuracy of network execution tasks, their first weight will be given smaller and smaller (that is, the interference will be smaller and smaller).
  • the interference will become larger and larger), and then the first weight can represent the degree of influence of the node.
  • the second weight can be input into the subsequent task network (such as GNN) as the weight exerted by the task network on the edge when processing the information of the corresponding edge.
  • the subsequent task network such as GNN
  • the weight exerted by the task network on the edge when processing the information of the corresponding edge.
  • the weight exerted by the task network on the edge when processing the information of the corresponding edge.
  • the weight for setting the weight usually, the weight of each edge is the same by default
  • the parameters for setting the weight of each edge in the task network can be set to the corresponding second weight.
  • the perturbation will have a trend: For the edge that has a greater impact on the accuracy of the network execution task, its second weight will be given larger and larger (that is, the interference will be smaller and smaller). For the edge that has a smaller impact on the accuracy of the network execution task, its second weight will be given. The weight will be given smaller and smaller (that is, the interference will become larger and larger), and then the second weight can represent the degree of influence of the edge.
  • the first neural network and the second neural network trained in the above manner can be used as a graph interpreter to determine the importance of each node and the relationship between nodes, which is equivalent to obtaining a more complete graph interpretation result than the existing technology.
  • the above-mentioned first weight can represent the degree of positive influence of the corresponding node on the GNN when performing the target task.
  • the first weight of the node is set to be larger.
  • the weight of one dimension (such as the degree of positive influence) cannot accurately represent the actual degree of influence of a node.
  • the feedforward process of the parameter model is parameterized by weights of multiple dimensions to accurately characterize the actual degree of influence of the node.
  • the third weight can be obtained based on the first weight, where the third weight is the weight of the node, and the first weight indicates the degree of reverse influence of the corresponding node on the GNN when performing the target task;
  • the three weights are used to fuse with the corresponding first feature representation to obtain the fourth feature representation; according to the fourth feature representation, the second loss is obtained through the graph neural network GNN, and the second loss is used to determine the loss function.
  • the first weight is larger and the third weight is smaller
  • the first loss can represent the accuracy of the corresponding model when the node's weight is larger
  • the second loss can represent the accuracy of the corresponding model when the node's weight is smaller.
  • the processing accuracy of the network is higher.
  • the processing accuracy of the network is still higher, or decreases very little.
  • the model With the update the first weight will gradually become smaller, which can more accurately describe the actual influence of the node and improve the accuracy of the network.
  • the first weight is expressed as a positive number less than 1, and the sum of the third weight and the corresponding first weight is 1.
  • the first weight is 0.9 and the third weight is 0.1.
  • the above-mentioned first weight can be called the positive mask of the node, and the third weight can be called the negative mask of the node.
  • the loss function can also be constructed through the above-mentioned positive and negative masks.
  • GNN is used to perform the target task
  • the second weight indicates the degree of positive influence of the corresponding edge on the GNN when performing the target task.
  • the fourth weight can be obtained according to the second weight.
  • the fourth weight is the weight of the edge.
  • the fourth weight indicates the degree of reverse influence of the corresponding edge on the GNN when performing the target task; according to the fourth weight, through the graph neural network GNN, obtains the third loss, and the third loss is used to determine the loss function.
  • the first weight is expressed as a positive number less than 1, and the sum of the fourth weight and the corresponding second weight is 1.
  • the embedded representation of each node and the information of the node can be fused (for example, spliced to obtain a first feature representation), and the first feature representation can be used as the heterogeneous information of the node.
  • the first feature representation of the nodes at both ends of the edge and the information of its own edge can be fused to obtain the second feature representation of the edge (that is, the heterogeneous information of the edge).
  • heterogeneous graph containing different types of nodes
  • different types of nodes correspond to features of different dimensions, and features of the same dimension may also have different meanings.
  • the types of edge factors in heterogeneous graphs are different and require differentiated representation.
  • nodes This embodiment can obtain features representing node heterogeneous information by fusing graph structure information (embedded representation of nodes) and original features (node information).
  • edges This embodiment extracts the embedded representation of the head and tail nodes where the edge is located and the attributes of the edge itself (edge information) for fusion representation, and can obtain features representing the heterogeneous information of the edge. This achieves accurate heterogeneous information representation of nodes and edges in heterogeneous graphs.
  • the first feature representation includes features of multiple dimensions, and the first weight includes the weight corresponding to the features of each dimension; or,
  • the second feature representation includes features of multiple dimensions, and the second weight includes the weight corresponding to the features of each dimension.
  • the first neural network or the second neural network is a neural network based on an attention mechanism.
  • the fusion includes:
  • the object is a character
  • different nodes correspond to different characters
  • edges indicate kinship or economic relationships between characters.
  • GNN is used to predict whether at least one character has economic risks based on the information in the graph.
  • embodiments of the present application provide a data processing method, including:
  • the graph information includes multiple nodes and edges between nodes.
  • the graph information includes node information and edge information. Each node corresponds to an object.
  • the node information includes the attributes of the object.
  • the edge information includes relationships between objects;
  • the first feature representation of each node and the second feature representation of each edge are obtained;
  • the first weight is obtained through the first neural network, and the first weight is the weight of the node; the first weight is used to represent the importance of the corresponding node in the graph;
  • a second weight is obtained, the second weight is the weight of the edge; the second weight is the weight of the edge; the second weight is used to represent The importance of the corresponding edge in the graph.
  • the first feature representation includes the embedding representation (embedding) of the node obtained through the feature network and the information of the corresponding node; or,
  • the second feature representation includes the first feature representation of the nodes at both ends of the edge and the corresponding edge information.
  • the first feature representation includes features of multiple dimensions, and the first weight includes the weight corresponding to the features of each dimension; or,
  • the second feature representation includes features of multiple dimensions, and the second weight includes the weight corresponding to the features of each dimension.
  • the first neural network or the second neural network is a neural network based on an attention mechanism.
  • this application provides a model training device, which includes:
  • the acquisition module is used to obtain the information of the graph information graph.
  • the graph includes multiple nodes and the edges between the nodes.
  • the graph information includes node information and edge information. Each node corresponds to an object.
  • the node information includes the object's information. Attributes and edge information include relationships between objects;
  • the processing module is used to obtain the first feature representation of each node and the second feature representation of each edge based on the graph information;
  • the first weight is obtained through the first neural network, and the first weight is the weight of the node; the first weight is used to fuse with the corresponding first feature representation to obtain the third Feature representation;
  • a second weight is obtained, and the second weight is the weight of the edge;
  • the first loss is obtained through the graph neural network GNN, and the first loss is used to determine the loss function
  • the model update module is used to update the first attention network, the second attention network and GNN according to the loss function.
  • the first neural network and the second neural network trained through the above method can be used as a graph interpreter to judge the importance of each node and the relationship between nodes, which is equivalent to obtaining a more complete graph interpretation result than the existing technology.
  • the GNN is used to perform the target task
  • the first weight indicates the degree of positive influence of the corresponding node on the GNN when performing the target task.
  • the acquisition module is also used to:
  • the third weight is obtained.
  • the third weight is the weight of the node.
  • the first weight indicates the degree of reverse influence of the corresponding node on the GNN when executing the target task; the third weight is used to match the corresponding first
  • the feature representations are fused to obtain the fourth feature representation;
  • the processing module is also used to: obtain the second loss through the graph neural network GNN according to the fourth feature representation, and the second loss is used to determine the loss function.
  • the first weight is expressed as a positive number less than 1, and the sum of the third weight and the corresponding first weight is 1.
  • the GNN is used to perform the target task
  • the second weight indicates the degree of positive influence of the corresponding edge on the GNN when performing the target task.
  • the acquisition module is also used to:
  • the fourth weight is the weight of the edge, and the fourth weight indicates the degree of reverse influence of the corresponding edge on the GNN when performing the target task;
  • the processing module is also used to obtain the third loss through the graph neural network GNN according to the fourth weight, and the third loss is used to determine the loss function.
  • the first weight is expressed as a positive number less than 1, and the sum of the fourth weight and the corresponding second weight is 1.
  • the first feature representation includes the embedding representation (embedding) of the node obtained through the feature network and the information of the corresponding node; or,
  • the second feature representation includes the embedding representation of the nodes at both ends of the edge and the edge information.
  • the first feature representation includes features of multiple dimensions, and the first weight includes the weight corresponding to the features of each dimension; or,
  • the second feature representation includes features of multiple dimensions, and the second weight includes the weight corresponding to the features of each dimension.
  • the first neural network or the second neural network is a neural network based on an attention mechanism.
  • the fusion includes:
  • the objects are characters, different nodes correspond to different characters, and the edges indicate the kinship or economic relationships between characters.
  • GNN is used to predict whether at least one character has economic risks based on the information in the graph.
  • embodiments of the present application provide a data processing method, including:
  • the acquisition module is used to obtain graph information.
  • the graph information includes multiple nodes and the edges between the nodes.
  • the graph information includes node information and edge information. Each node corresponds to an object.
  • the node information includes the attributes of the object.
  • edge information includes relationships between objects;
  • the processing module is used to obtain the first feature representation of each node and the second feature representation of each edge based on the graph information;
  • the first weight is obtained through the first neural network, and the first weight is the weight of the node; the first weight is used to represent the importance of the corresponding node in the graph;
  • a second weight is obtained through the second neural network, where the second weight is the weight of the edge; the second weight is used to represent the importance of the corresponding edge in the graph.
  • the first feature representation includes the embedding representation (embedding) of the node obtained through the feature network and the information of the corresponding node; or,
  • the second feature representation includes the first feature representation of the nodes at both ends of the edge and the corresponding edge information.
  • the first feature representation includes features of multiple dimensions, and the first weight includes the weight corresponding to the features of each dimension; or,
  • the second feature representation includes features of multiple dimensions, and the second weight includes the weight corresponding to the features of each dimension.
  • the first neural network or the second neural network is a neural network based on an attention mechanism.
  • a training device which may include a memory, a processor, and a bus system.
  • the memory is used to store programs
  • the processor is used to execute programs in the memory to perform any of the above-mentioned first aspects.
  • embodiments of the present application provide an execution device, which may include a memory, a processor, and a bus system.
  • the memory is used to store programs
  • the processor is used to execute programs in the memory to execute any of the above-mentioned second aspects.
  • embodiments of the present application provide a computer-readable storage medium.
  • a computer program is stored in the computer-readable storage medium. When it is run on a computer, it causes the computer to execute the above-mentioned first aspect and any optional method. method, as well as the above second aspect and any optional method.
  • embodiments of the present application provide a computer program product, including code.
  • code When the code is executed, it is used to implement the above-mentioned first aspect and any optional method, and the above-mentioned second aspect and any optional method. Methods.
  • this application provides a chip system, which includes a processor for supporting an execution device or a training device to implement the functions involved in the above aspects, for example, sending or processing data involved in the above methods; Or, information.
  • the chip system also includes a memory, which is used to save necessary program instructions and data for executing the device or training the device.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • Figure 1 is a schematic diagram of a system architecture provided by an embodiment of the present application.
  • Figure 2 is a schematic diagram of a system architecture provided by an embodiment of the present application.
  • Figure 3 is a schematic diagram of a system architecture provided by an embodiment of the present application.
  • Figure 4 is a schematic diagram of a system architecture provided by an embodiment of the present application.
  • Figure 5 is a schematic diagram of a system architecture provided by an embodiment of the present application.
  • Figure 6 is a schematic flow chart of a model training method provided by an embodiment of the present application.
  • Figure 7 is a diagram of a loss function
  • Figure 8 is a schematic diagram of the process of a model training method
  • Figure 9 is a schematic diagram of the interpretation results of a graph structure
  • Figure 10 is a schematic flow chart of a data processing method provided by an embodiment of the present application.
  • Figure 11 is a schematic structural diagram of a model training device provided by an embodiment of the present application.
  • Figure 12 is a schematic structural diagram of a data processing device provided by an embodiment of the present application.
  • Figure 13 is a schematic diagram of an execution device provided by an embodiment of the present application.
  • Figure 14 is a schematic diagram of a training device provided by an embodiment of the present application.
  • Figure 15 is a schematic diagram of a chip provided by an embodiment of the present application.
  • This application can be, but is not limited to, applied in circuit design applications or cloud services provided by cloud-side servers. Next, we will introduce them respectively:
  • the product form of the embodiment of the present application may be a diagram interpretation application.
  • Diagram interpretation applications can run on terminal devices or cloud-side servers.
  • the graph interpretation application can generate the importance of nodes and the correlation between nodes based on the input graph information (including node information and edge information).
  • the information of the node can be the attribute information of the object and the relationship between the objects.
  • the attribute information can be of many types. Taking the object as a person as an example, the information can include but is not limited to gender, age, occupation, and hobbies. etc., the objects can also be items, such as applications (applications, APPs).
  • the object features extracted from the training samples of the APP market can be the name (logo), type, size, etc.
  • the object characteristics mentioned in the training sample can be the name of the product, the category to which it belongs, the price range, etc.; the relationship between the objects can be kinship relationships, economic relationships (such as equity relationships, trade relationships, etc.).
  • Figure 1 is a schematic diagram of the functional architecture of a diagram explanation application in an embodiment of the present application:
  • the embodiments of the present application include a system (such as a graph interpretation application) that can generate the importance of nodes and the degree of correlation between nodes based on the input graph information, where different inputs to the system Parameter values can cause different graph interpretations to be generated.
  • the graph interpretation application 102 can receive input parameters 101 and generate graph interpretation results 103 .
  • the diagram interpretation application 102 may be executed, for example, on at least one computer system, and includes computer code that, when executed by one or more computers, causes the computers to perform tasks related to diagram interpretation. method.
  • the diagram interpretation design software can be run on a terminal device on the end side or in a server on the cloud side.
  • the terminal device can be installed with graphic interpretation design software, and actions including data input, data processing, and data output can be performed by the terminal device.
  • the terminal device can be installed with a client of graphic interpretation design software, and actions including data input and data output can be performed by the terminal device. That is to say, the terminal device can transmit the data required for data processing to the cloud side. After the server and the server on the cloud side complete the data processing action, the data processing results can be returned to the terminal device on the end side, and the terminal device outputs based on the processing results.
  • Figure 2 is a schematic diagram of the physical architecture of running a circuit design application in an embodiment of the present application:
  • FIG. 2 shows a schematic diagram of a system architecture.
  • the system may include a terminal 100 and a server 200.
  • the server 200 may include one or more servers (one server is used as an example in FIG. 2 for illustration), and the server 200 may provide graph interpretation services for one or more terminals.
  • the terminal 100 can be installed with a diagram explanation design application, or open a web page related to the diagram explanation design.
  • the above application and web page can provide a diagram explanation design interface, and the terminal 100 can receive the user's diagram explanation design
  • the relevant parameters entered on the interface are sent to the server 200.
  • the server 200 can obtain the processing results based on the received parameters and return the processing results to the terminal 100.
  • the terminal 100 can also complete the action of obtaining the graph interpretation result based on the received parameters by itself without requiring the cooperation of the server, which is not limited by the embodiments of this application.
  • the terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR)/virtual reality (VR) device, a notebook computer, or an ultra mobile personal computer (ultra mobile personal computer).
  • -mobile personal computer UMPC
  • netbook personal digital assistant
  • PDA personal digital assistant
  • FIG. 3 shows an optional hardware structure diagram of the terminal 100.
  • the terminal 100 may include a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), Microphone 162 (optional), processor 170, external interface 180, power supply 190 and other components.
  • a radio frequency unit 110 may include a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), Microphone 162 (optional), processor 170, external interface 180, power supply 190 and other components.
  • Figure 3 is only an example of a terminal or a multi-function device, and does not constitute a limitation to the terminal or multi-function device. It may include more or fewer components than shown in the figure, or some components may be combined. Or different parts.
  • the input unit 130 may be used to receive input numeric or character information and generate key signal input related to user settings and function control of the portable multi-function device.
  • the input unit 130 may include a touch screen 131 (optional) and/or other input devices 132.
  • the touch screen 131 can collect the user's touch operations on or near it (such as the user's operations on or near the touch screen using fingers, knuckles, stylus, or any other suitable objects), and drive the corresponding according to the preset program. Connect the device.
  • the touch screen can detect the user's touch action on the touch screen, convert the touch action into a touch signal and send it to the processor 170, and can receive and execute commands from the processor 170; the touch signal at least includes contact point coordinate information.
  • the touch screen 131 can provide an input interface and an output interface between the terminal 100 and the user.
  • touch screens can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave.
  • the input unit 130 may also include other input devices.
  • other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys 132, switch keys 133, etc.), trackball, mouse, joystick, etc.
  • the input device 132 can receive parameters related to graph interpretation, such as graph information in the embodiment of the present application, and so on.
  • the display unit 140 may be used to display information input by the user or information provided to the user, various menus of the terminal 100, interactive interfaces, file display, and/or playback of any kind of multimedia files.
  • the display unit 140 may be used to display an interface of a diagram interpretation design application program, a diagram of a diagram interpretation result, etc.
  • the memory 120 can be used to store instructions and data.
  • the memory 120 can mainly include a storage instruction area and a storage data area.
  • the storage data area can store various data, such as multimedia files, texts, etc.;
  • the storage instruction area can store operating systems, applications, at least Software units such as instructions required for a function, or their subsets or extensions.
  • Non-volatile random access memory may also be included; providing the processor 170 with management of hardware, software and data resources in the computing processing device and supporting control software and applications. It is also used for storage of multimedia files and storage of running programs and applications.
  • the processor 170 is the control center of the terminal 100. It uses various interfaces and lines to connect various parts of the entire terminal 100, and executes various functions of the terminal 100 by running or executing instructions stored in the memory 120 and calling data stored in the memory 120. functions and process data to provide overall control of the terminal device.
  • the processor 170 may include one or more processing units; preferably, the processor 170 may integrate an application processor and a modem processor, where the application processor mainly processes operating systems, user interfaces, application programs, etc. , the modem processor mainly handles wireless communications. It can be understood that the above-mentioned modem processor may not be integrated into the processor 170 .
  • the processor and memory can be implemented on a single chip, and in some embodiments, they can also be implemented on separate chips.
  • the processor 170 can also be used to generate corresponding operation control signals, send them to corresponding components of the computing processing device, read and process data in the software, especially read and process the data and programs in the memory 120, so that the Each functional module performs a corresponding function, thereby controlling the corresponding components to act according to the instructions.
  • the memory 120 can be used to store software codes related to the diagram interpretation method, and the processor 170 can execute the steps of the diagram interpretation method of the chip, and can also schedule other units (such as the above-mentioned input unit 130 and the display unit 140) to implement corresponding functions. .
  • the radio frequency unit 110 (optional) can be used to send and receive information or receive and send signals during calls. For example, after receiving downlink information from the base station, it is processed by the processor 170; in addition, the designed uplink data is sent to the base station.
  • RF circuits include but are not limited to antennas, at least one amplifier, transceivers, couplers, low noise amplifiers (LNA), duplexers, etc.
  • the radio frequency unit 110 can also communicate with network devices and other devices through wireless communication.
  • the wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division) Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
  • GSM Global System of Mobile communication
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • SMS Short Messaging Service
  • the radio frequency unit 110 may send parameters such as graph information to the server 200, and receive the graph interpretation results sent by the server 200.
  • radio frequency unit 110 is optional and can be replaced by other communication interfaces, such as a network port.
  • the terminal 100 also includes a power supply 190 (such as a battery) that supplies power to various components.
  • a power supply 190 such as a battery
  • the power supply can be logically connected to the processor 170 through a power management system, so that functions such as charging, discharging, and power consumption management can be implemented through the power management system.
  • the terminal 100 also includes an external interface 180, which can be a standard Micro USB interface or a multi-pin connector, which can be used to connect the terminal 100 to communicate with other devices, or can be used to connect a charger to charge the terminal 100. .
  • an external interface 180 can be a standard Micro USB interface or a multi-pin connector, which can be used to connect the terminal 100 to communicate with other devices, or can be used to connect a charger to charge the terminal 100.
  • the terminal 100 may also include a flash light, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which will not be described again here. Some or all of the methods described below may be applied in the terminal 100 shown in FIG. 3 .
  • WiFi wireless fidelity
  • Bluetooth Bluetooth
  • FIG 4 provides a schematic structural diagram of a server 200.
  • the server 200 includes a bus 201, a processor 202, a communication interface 203 and a memory 204.
  • the processor 202, the memory 204 and the communication interface 203 communicate through the bus 201.
  • the bus 201 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the bus can be divided into address bus, data bus, control bus, etc. For ease of presentation, only one thick line is used in Figure 4, but it does not mean that there is only one bus or one type of bus.
  • the processor 202 may be a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP) or a digital signal processor (DSP). any one or more of them.
  • CPU central processing unit
  • GPU graphics processing unit
  • MP microprocessor
  • DSP digital signal processor
  • Memory 204 may include volatile memory, such as random access memory (RAM).
  • RAM random access memory
  • the memory 204 may also include non-volatile memory (non-volatile memory), such as read-only memory (ROM), flash memory, mechanical hard drive (hard drive drive, HDD) or solid state drive (solid state drive). ,SSD).
  • ROM read-only memory
  • HDD hard drive drive
  • SSD solid state drive
  • the memory 204 can be used to store software codes related to the graph interpretation method, and the processor 202 can execute the steps of the graph interpretation method of the chip, and can also schedule other units to implement corresponding functions.
  • the terminal 100 and the server 200 may be centralized or distributed devices, and the processors (such as the processor 170 and the processor 202) in the terminal 100 and the server 200 may be hardware circuits (such as application specific integrated circuits) application specific integrated circuit (ASIC), field-programmable gate array (FPGA), general-purpose processor, digital signal processing (DSP), microprocessor or microcontroller, etc.), Or a combination of these hardware circuits.
  • the processor can be a hardware system with the function of executing instructions, such as CPU, DSP, etc., or a hardware system without the function of executing instructions, such as ASIC, FPGA, etc., or the above-mentioned processor without the function of executing instructions.
  • the diagram interpretation method in the embodiment of the present application involves AI-related operations.
  • the instruction execution architecture of the terminal device and the server is not limited to the architecture of the processor combined with the memory shown in Figure 3 and Figure 4 .
  • the system architecture provided by the embodiment of the present application will be introduced in detail below with reference to Figure 5 .
  • FIG. 5 is a schematic diagram of the system architecture provided by the embodiment of the present application.
  • the system architecture 500 includes an execution device 510, a training device 520, a database 530, a client device 540, a data storage system 550 and a data collection system 560.
  • the execution device 510 includes a computing module 511, an I/O interface 512, a preprocessing module 513 and a preprocessing module 514.
  • the target model/rule 501 may be included in the calculation module 511, and the preprocessing module 513 and the preprocessing module 514 are optional.
  • the execution device 510 may be the above-mentioned terminal device or server that runs the circuit design application program.
  • Training samples can be attribute information of objects and relationships between objects. There can be many kinds of attribute information. Taking the object as a person as an example, it can include but is not limited to gender, age, occupation, hobby, etc.
  • the object can also be an object.
  • application application, APP
  • the object features extracted in the training samples of the APP market can be the name (identity), type, size, etc. of the APP; and the object features mentioned in the training samples of e-commerce APPs It can be the name of the product, its category, price range, etc.; the relationship between objects can be kinship relationships, economic relationships (such as equity relationships, trade relationships, etc.), and label features are used to indicate that this sample is positive. Example or negative example, such as whether the character has economic risks, etc.
  • the data collection device 560 After collecting the training samples, stores the training samples into the database 530 .
  • the training device 520 can maintain the training samples in the database 530 and the neural network to be trained (such as the first neural network, the second neural network and the graph neural network in the embodiment of this application) to obtain the target model/rule 501.
  • the neural network to be trained such as the first neural network, the second neural network and the graph neural network in the embodiment of this application
  • the training samples maintained in the database 530 are not necessarily collected from the data collection device 560, and may also be received from other devices.
  • the training device 520 may not necessarily train the target model/rules 501 based entirely on the training samples maintained by the database 530. It may also obtain training samples from the cloud or other places for model training. The above description should not be used as a guarantee for this application. Limitations of Examples.
  • the target model/rules 501 trained according to the training device 520 can be applied to different systems or devices, such as the execution device 510 shown in Figure 5.
  • the execution device 510 can be a terminal, such as a mobile phone terminal, a tablet computer, and a notebook.
  • AR augmented reality
  • VR virtual reality
  • the training device 520 can transfer the trained model to the execution device 510 .
  • the execution device 510 is configured with an input/output (I/O) interface 512 for data interaction with external devices.
  • the user can input data to the I/O interface 512 through the client device 540 (for example, this Information on the figures in the application examples, etc.).
  • the preprocessing module 513 and the preprocessing module 514 are used to perform preprocessing according to the input data received by the I/O interface 512. It should be understood that there may be no preprocessing module 513 and 514 or only one preprocessing module. When the preprocessing module 513 and the preprocessing module 514 do not exist, the computing module 511 can be directly used to process the input data.
  • the execution device 510 When the execution device 510 preprocesses input data, or when the calculation module 511 of the execution device 510 performs calculations and other related processes, the execution device 510 can call data, codes, etc. in the data storage system 550 for corresponding processing. , the data, instructions, etc. obtained by corresponding processing can also be stored in the data storage system 550.
  • the I/O interface 512 provides the processing results (such as the results explained in the figures in the embodiments of this application) to the client device 540, thereby providing them to the user.
  • the user can manually set the input data, and the "manually set input data" can be operated through the interface provided by the I/O interface 512 .
  • the client device 540 can automatically send input data to the I/O interface 512. If requiring the client device 540 to automatically send the input data requires the user's authorization, the user can set corresponding permissions in the client device 540. The user can view the results output by the execution device 510 on the client device 540, and the specific presentation form may be display, sound, action, etc.
  • the client device 540 can also be used as a data collection terminal to collect the input data of the input I/O interface 512 and the output results of the output I/O interface 512 as new sample data, and store them in the database 530.
  • the I/O interface 512 directly uses the input data input to the I/O interface 512 and the output result of the output I/O interface 512 as a new sample as shown in the figure.
  • the data is stored in database 530.
  • Figure 5 is only a schematic diagram of a system architecture provided by an embodiment of the present application.
  • the positional relationship between the devices, devices, modules, etc. shown in the figure does not constitute any limitation.
  • the data The storage system 550 is an external memory relative to the execution device 510. In other cases, the data storage system 550 can also be placed in the execution device 510. It should be understood that the above execution device 510 may be deployed in the client device 540.
  • the computing module 511 of the above-mentioned execution device 520 can obtain the code stored in the data storage system 550 to implement the graph interpretation method.
  • the computing module 511 of the execution device 520 may include hardware circuits (such as application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), general-purpose processors, digital signal processing (DSP), microprocessor or microcontroller, etc.), or a combination of these hardware circuits.
  • the training device 520 can be a hardware system with the function of executing instructions, such as a CPU, DSP, etc. , or it is a hardware system that does not have the function of executing instructions, such as ASIC, FPGA, etc., or it is a combination of the above-mentioned hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions.
  • the calculation module 511 of the execution device 520 can be a hardware system with the function of executing instructions.
  • the connection relationship prediction method provided by the embodiment of the present application can be a software code stored in the memory.
  • the calculation module 511 of the execution device 520 can obtain the information from the memory. Obtain the software code and execute the obtained software code to implement the diagram interpretation method provided by the embodiment of the present application.
  • the computing module 511 of the execution device 520 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some steps of the diagram explanation method provided by the embodiment of the present application can also be executed by the execution device 520 The computing module 511 is implemented by a hardware system that does not have the function of executing instructions, which is not limited here.
  • the above-mentioned training device 520 can obtain the code stored in the memory (not shown in Figure 5, which can be integrated with the training device 520 or deployed separately from the training device 520) to implement the model training in the embodiment of the present application. Related steps.
  • the training device 520 may include hardware circuits (such as application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), general-purpose processors, digital signal processors (digital signal processing, DSP, microprocessor or microcontroller, etc.), or a combination of these hardware circuits.
  • ASICs application specific integrated circuits
  • FPGAs field-programmable gate arrays
  • DSP digital signal processors
  • the training device 520 can be a hardware system with the function of executing instructions, such as a CPU, DSP, etc., or a combination of other hardware circuits.
  • a hardware system with the function of executing instructions such as ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without the function of executing instructions and a hardware system with the function of executing instructions.
  • the training device 520 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some of the steps related to model training provided by the embodiments of the present application can also be implemented by the training device 520 that does not have the function of executing instructions. It is implemented by the hardware system that executes the instruction function, which is not limited here.
  • the server can provide graph interpretation services for the client side through an application programming interface (API).
  • API application programming interface
  • the terminal device can send relevant parameters (such as graph information, etc.) to the server through the API provided by the cloud.
  • the server can obtain the processing results based on the received parameters and return the processing results (such as graph interpretation results, etc.) to to the terminal.
  • the neural network can be composed of neural units.
  • the neural unit can refer to an operation unit that takes xs (ie, input data) and intercept 1 as input.
  • the output of the operation unit can be:
  • s 1, 2,...n, n is a natural number greater than 1
  • Ws is the weight of xs
  • b is the bias of the neural unit.
  • f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal in the neural unit into an output signal.
  • the output signal of the activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function.
  • a neural network is a network formed by connecting multiple above-mentioned single neural units together, that is, the output of one neural unit can be the input of another neural unit.
  • the input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field.
  • the local receptive field can be an area composed of several neural units.
  • Deep Neural Network also known as multi-layer neural network
  • DNN Deep Neural Network
  • the neural network inside DNN can be divided into three categories: input layer, hidden layer, and output layer.
  • the first layer is the input layer
  • the last layer is the output layer
  • the layers in between are hidden layers.
  • the layers are fully connected, that is to say, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer.
  • the coefficient from the k-th neuron in layer L-1 to the j-th neuron in layer L is defined as It should be noted that the input layer has no W parameter.
  • more hidden layers make the network more capable of describing complex situations in the real world. Theoretically, a model with more parameters has higher complexity and greater "capacity", which means it can complete more complex learning tasks.
  • Training a deep neural network is the process of learning the weight matrix. The ultimate goal is to obtain the weight matrix of all layers of the trained deep neural network (a weight matrix formed by the vectors W of many layers).
  • a graph is a data structure including at least one node and at least one edge.
  • nodes in the graph can be mapped to entities, and edges in the graph can be mapped to relationships between entities.
  • Graphs can be directed or undirected.
  • the graph can also include other data besides nodes and edges, such as node labels and edge labels.
  • each node in the graph can represent a user, and each edge in the graph can represent the social relationship between different users.
  • the data of each node in the graph is The user's portrait data and the user's behavioral data, such as the user's age, occupation, hobbies, education, etc.
  • each node in the graph when applied to product recommendation scenarios, can represent a user or a product, and each edge in the graph can represent the interactive relationship between the user and the product, such as purchase relationship, collection relationship, etc. .
  • each node in the graph when applied to financial risk control scenarios, can represent an account, transaction or fund.
  • the edges in the graph can represent the flow relationship of funds.
  • the loops in the graph can represent circular transfers.
  • each node in the graph can represent a network element, such as a router, switch, terminal, etc., and each edge in the graph can represent a different network element. connection relationship between them.
  • GNN is a deep learning method with structural information that can be used to calculate the current state of a node.
  • the information transfer of the graph neural network is carried out according to the given graph structure, and the status of each node can be updated according to the adjacent nodes. Specifically, it can use the neural network as the aggregation function of point information according to the structure diagram of the current node, transfer the information of all adjacent nodes to the current node, and update it in combination with the status of the current node.
  • the convolutional neural network can use the error back propagation (BP) algorithm to modify the size of the parameters in the initial super-resolution model during the training process, so that the reconstruction error loss of the super-resolution model becomes smaller and smaller.
  • BP error back propagation
  • forward propagation of the input signal until the output will produce an error loss
  • the parameters in the initial super-resolution model are updated by back-propagating the error loss information, so that the error loss converges.
  • the backpropagation algorithm is a backpropagation movement dominated by error loss, aiming to obtain the optimal parameters of the super-resolution model, such as the weight matrix.
  • the attention mechanism imitates the internal process of biological observation behavior, that is, a mechanism that aligns internal experience and external sensation to increase the precision of observation in some areas, and can use limited attention resources to quickly filter out high-value information from a large amount of information. .
  • the attention mechanism can quickly extract important features of sparse data and is therefore widely used in natural language processing tasks, especially machine translation.
  • the self-attention mechanism is an improvement of the attention mechanism, which reduces the dependence on external information and is better at capturing the internal correlation of data or features.
  • the essential idea of the attention mechanism can be rewritten as the following formula:
  • Lx
  • represents the length of Source.
  • the meaning of the formula is to imagine that the constituent elements in Source are composed of a series of data pairs. At this time, given a certain element Query in the target Target, by calculating the Query and Based on the similarity or correlation of each Key, the weight coefficient of each Key's corresponding Value is obtained, and then the Value is weighted and summed to obtain the final Attention value. So essentially the Attention mechanism is a weighted summation of the Value values of the elements in the Source, and Query and Key are used to calculate the weight coefficient of the corresponding Value.
  • Attention can be understood as selectively filtering out a small amount of important information from a large amount of information and focusing on this important information, while ignoring most of the unimportant information.
  • the process of focusing is reflected in the calculation of the weight coefficient.
  • the self-attention mechanism can be understood as internal Attention (intra attention).
  • the Attention mechanism occurs between the Target element Query and all elements in the Source.
  • the self-attention mechanism refers to between the internal elements of the Source or between the internal elements of the Target.
  • a graph is a data structure including at least one node and at least one edge.
  • nodes in the graph can be mapped to objects (or entities), and edges in the graph can be mapped to relationships between entities.
  • Graphs can be directed or undirected.
  • the graph can also include other data besides nodes and edges, such as node labels and edge labels.
  • each node in the graph can represent a user, and each edge in the graph can represent the social relationship between different users.
  • the data of each node in the graph is The user's portrait data and the user's behavioral data, such as the user's age, occupation, hobbies, education, etc.
  • each node in the graph when applied to product recommendation scenarios, can represent a user or a product, and each edge in the graph can represent the interactive relationship between the user and the product, such as purchase relationship, collection relationship, etc. .
  • each node in the graph when applied to financial risk control scenarios, can represent an account, transaction or fund.
  • the interpreter of the graph is used to obtain the degree of influence of each node on the state of a certain node based on the information of the graph (for example, including node information and edge information).
  • graph interpretation is achieved through a perturbation-based interpretation method.
  • the idea of this method is to input the graph information into a graph neural network (GNN) used to achieve the target task.
  • GNN graph neural network
  • the target task It can be used to predict the status of a certain node.
  • By perturbing the input graph information and observing the output of the GNN model it can determine the role of each node in the input graph information on the GNN model in predicting the status of the node. This effect can be used as the degree of influence on the status of a certain node.
  • the above method can only obtain the degree of influence of nodes on the status of nodes, and the results of graph interpretation are incomplete (for example, the degree of influence of edges between nodes on the status of nodes cannot be obtained).
  • Figure 6 is a schematic diagram of a model training method provided by an embodiment of the present application. As shown in Figure 6, the embodiment of the present application One model training method provided includes:
  • the graph includes multiple nodes and edges between the nodes.
  • the information of the graph includes node information and edge information. Each node corresponds to an object.
  • the node The information includes the attributes of the objects, and the edge information includes the relationships between objects.
  • the execution subject of step 601 may be a server on the cloud side.
  • the server may receive the graph information sent from the terminal device, and the server may obtain the graph information.
  • the execution subject of step 601 may be a terminal device, and the terminal device may be a portable mobile device, such as but not limited to a mobile or portable computing device (such as a smart phone), a personal computer, a server computer, a handheld device (such as tablet) or laptop device, multi-processor system, game console or controller, microprocessor-based system, set-top box, programmable consumer electronics, mobile phone, wearable or accessory form factor (e.g., watch, glasses, headsets, or earbuds), network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like.
  • a mobile or portable computing device such as a smart phone
  • a personal computer such as a server computer
  • a handheld device such as tablet
  • microprocessor-based system such as tablet
  • set-top box such as programmable consumer electronics
  • mobile phone wearable or accessory form factor
  • network PCs e.g., watch, glasses, headsets, or earbuds
  • minicomputers
  • graph information can be obtained.
  • the graph information can include multiple nodes and edges between nodes.
  • the graph information includes node information and edge information.
  • Each of the nodes Corresponding to an object, the node information includes attributes of the object, and the edge information includes relationships between objects.
  • the attributes of the character can be at least one of gender, age, occupation, income, hobbies and education level, where the gender can be male or female, and the age can be 0- A number between 100, the occupation can be teachers, programmers, chefs, etc., the hobbies can be basketball, tennis, running, etc., and the education level can be elementary school, junior high school, high school, university, etc.; this application is not limited to the target audience The specific type of attribute.
  • the object corresponding to the node is an item.
  • the item can be a physical item or a virtual item.
  • it can be an application (APP), audio and video, web page, news information, etc.
  • the attribute of the item can be an item. At least one of the name, developer, installation package size, category and rating.
  • the category of the item can be chat, parkour games, office, etc., and the rating can be It is for ratings, comments, etc. on items; this application does not limit the specific types of attributes of items.
  • the relationship between the objects can be a kinship relationship or an economic relationship (such as equity relationship, trade relationship, etc.).
  • the information of the above graph can be used as the input of the neural network to be trained.
  • the label information used in the training process (or called the groundtruth) can also be obtained. Specifically, it can be combined with the neural network to be trained.
  • the tasks to be implemented by GNN are related. For example, GNN can be used to predict the status of the object corresponding to the node (such as performing a binary classification problem for the state). For example, GNN can predict whether the object corresponding to each node has economic risks (such as whether it will If there is a problem of insufficient repayment ability), the label information can indicate whether the object corresponding to the node actually has economic risks.
  • the first feature representation is a feature representation of a node
  • the second feature representation is a feature representation of an edge
  • the graph information can be input into the feature extraction network (implemented in the feed-forward process of training) to obtain the first feature representation of each node and the second feature representation of each edge.
  • each node information including the node itself and nearby nodes (such as the information of the k-order subgraph of each node, k is greater than 1) can be input into the feature extraction network to obtain the embedding of each node.
  • Representation embedding
  • the embedding representation of a node can include features in multiple dimensions (or channels).
  • the embedded representation of each node and the information of the node can be fused (for example, spliced to obtain a first feature representation), and the first feature representation can be used as the heterogeneous information of the node.
  • the first feature representation of the nodes at both ends of the edge and the information of its own edge can be fused to obtain the second feature representation of the edge (that is, the heterogeneous information of the edge).
  • heterogeneous graph containing different types of nodes
  • different types of nodes correspond to features of different dimensions, and features of the same dimension may also have different meanings.
  • the types of edge factors in heterogeneous graphs are different and require differentiated representation.
  • nodes This embodiment can obtain features representing node heterogeneous information by fusing graph structure information (embedded representation of nodes) and original features (node information).
  • edges This embodiment extracts the embedded representation of the head and tail nodes where the edge is located and the attributes of the edge itself (edge information) for fusion representation, and can obtain features representing the heterogeneous information of the edge. This achieves accurate heterogeneous information representation of nodes and edges in heterogeneous graphs.
  • the above feature extraction network may be, but is not limited to, a multi-layer pyramid model.
  • the embedding representation can be in the form of feature vectors.
  • the first weight is obtained through the first neural network, and the first weight is the weight of the node; the first weight is used to compare with the corresponding first characteristic representation. Fusion to obtain the third feature representation.
  • the first feature representation of each node can be input into a first neural network, where the first neural network can be a neural network based on an attention mechanism, and the first neural network can be based on The input feature representation is used to obtain the corresponding first weight (this weight gradually has a certain semantic meaning as the network is updated).
  • different neural networks can be used for different types of nodes.
  • the above steps are performed for each node to obtain the feature mask of the node (
  • the mask may include a first weight corresponding to each node).
  • the first weight can be fused with the corresponding first feature representation (for example, weighted, that is, a product operation based on the weight) to obtain a third feature representation.
  • Weighting the first feature representation based on the first weight is equivalent to applying a perturbation to the first feature representation, which is equivalent to the role of the first neural network in obtaining the size of the applied perturbation based on the first feature representation. Since it is input to the subsequent task network (For example, the input in GNN) is the feature after the perturbation is applied (that is, the third feature representation).
  • the perturbation will have a trend: the nodes that have a greater impact on the accuracy of the network execution task will The first weight will be given larger and larger (that is, the interference will be smaller and smaller), and the nodes that have less impact on the accuracy of network execution tasks will be given smaller and smaller weights (that is, the interference will be smaller and smaller). (larger), and then the first weight can represent the degree of influence of the node.
  • the first feature representation may include features of multiple dimensions
  • the first weight may include a weight for the features of each dimension.
  • each weight may be the same as the corresponding dimension in the first feature representation. features are weighted.
  • the second feature representation of each edge can be input into a second neural network, where the second neural network can be a neural network based on an attention mechanism, and the second neural network can be based on the input Feature representation, the corresponding second weight is obtained (this weight gradually has a certain semantic meaning as the network is updated).
  • the second weight can be input into the subsequent task network (such as GNN) as the weight exerted by the task network on the edge when processing the information of the corresponding edge.
  • the subsequent task network such as GNN
  • the parameters for setting the weight of each edge can be set as the corresponding second weight.
  • the perturbation will have a trend: For the edge that has a greater impact on the accuracy of the network execution task, its second weight will be given larger and larger (that is, the interference will be smaller and smaller). For the edge that has a smaller impact on the accuracy of the network execution task, its second weight will be given. The weight will be given smaller and smaller (that is, the interference will become larger and larger), and then the second weight can represent the degree of influence of the edge.
  • the third feature representation and the second weight obtain the first loss through the graph neural network GNN, and the first loss is used to determine the loss function.
  • the third feature representation and the second weight obtained above can be input into a task network (such as GNN) to obtain an output result (for example, if GNN is used to achieve the target task, the output result is The execution result of the target task).
  • a task network such as GNN
  • the output result can be the prediction results of the economic risks of the characters corresponding to each node.
  • the first loss (used to represent the difference between the output result and the label information) can be obtained, and then the loss function can be determined based on the first loss.
  • the above-mentioned first weight may represent the degree of positive influence of the corresponding node on the GNN when executing the target task.
  • the first weight of the node is When the setting is larger, the processing accuracy of the network is higher. When the first weight of the node is set smaller, the processing accuracy of the network is still higher, or drops very little, so the influence of the node is still very low. Therefore, only the weight of one dimension (such as the degree of positive influence) cannot accurately represent the actual degree of influence of a node.
  • the feedforward process of the parameter model is parameterized by weights of multiple dimensions to accurately characterize the actual degree of influence of the node.
  • a third weight can be obtained based on the first weight, where the third weight is the weight of a node, and the third weight is the time when the corresponding node performs the target task for the GNN.
  • the second loss is used to determine the loss function. For example, when the first weight is larger and the third weight is smaller, the first loss can represent the accuracy of the corresponding model when the node's weight is larger, and the second loss can represent the accuracy of the corresponding model when the node's weight is smaller.
  • the processing accuracy of the network is higher.
  • the processing accuracy of the network is still higher, or decreases very little.
  • the model With the update the first weight will gradually become smaller, which can more accurately describe the actual influence of the node and improve the accuracy of the network.
  • the first weight is expressed as a positive number less than 1, and the sum of the third weight and the corresponding first weight is 1.
  • the first weight is 0.9 and the third weight is 0.1.
  • the above-mentioned first weight can be called the positive mask of the node, and the third weight can be called the negative mask of the node.
  • a loss function can also be constructed through the above-mentioned positive and negative masks.
  • the GNN is used to perform the target task, and the second weight indicates that the corresponding edge is useful for the GNN in executing the target.
  • the degree of positive influence during the task can be obtained according to the second weight.
  • the fourth weight is the weight of the edge.
  • the fourth weight indicates that the corresponding edge is important for the GNN in executing the target task.
  • the degree of reverse influence at the time; according to the fourth weight, the third loss is obtained through the graph neural network GNN, and the third loss is used to determine the loss function.
  • the first weight is expressed as a positive number less than 1, and the sum of the fourth weight and the corresponding second weight is 1.
  • the loss function can include three parts:
  • the function of (3) is to increase the variance of the mask, so that the mask can better distinguish nodes and edges, and improve the quality of interpretation.
  • the specific representation of the loss function can be shown in Figure 7.
  • masked pred represents the prediction result of the GNN model after applying the mask.
  • var represents a function for finding variance.
  • the interpreter (first neural network, second neural grid) is updated through backpropagation by optimizing the loss function.
  • the k-order subgraph where the node to be explained is located can be input.
  • the feature mask and edge mask can be obtained, respectively. Interpretation as node features and edge interpretation.
  • the prediction model is a Heterogeneous Graph Transformer (HGT), which is used to predict whether a customer is a high-risk customer (whether there is a debt default risk).
  • HCT Heterogeneous Graph Transformer
  • the basic requirement is to provide an explanation of the characteristic and relational dimensions of customers predicted to be high risk.
  • Figure 9 shows the explanation effect of the above embodiment. Dark gray nodes represent customers predicted to be high risk, and light gray nodes represent normal customers.
  • customer 1 which is predicted to be high risk, is explained in terms of characteristic dimensions and relationship dimensions.
  • the explanation of the characteristic dimension reflects the discovery that the three characteristics of Customer 1’s age, cumulative payment amount, and behavioral score play the greatest role in predicting that Customer 1 is high risk.
  • the explanation of the relationship dimension reflects the existence of equity correlation between Customer 1 and high-risk legal person 4. relationship, resulting in Customer 1 being high risk. From the perspective of explanation efficiency, it takes 4-7s for GNNexplainer to generate a single-sample explanation, while the time it takes for the present invention to generate a single-sample explanation is 10ms.
  • the embodiment of this application designs a heterogeneous information extraction module, sets an attention network to generate feature masks and edge masks, and sets a loss function based on causal enhancement to optimize the interpreter.
  • the training of the interpreter is based on For all training data, the explanation is guaranteed to be the local optimal global optimal.
  • the trained interpreter does not need to be retrained when generating explanations, and the explanation is less time-consuming and more efficient.
  • Embodiments of the present application provide a model training method.
  • the method includes: obtaining information of an information graph of a graph.
  • the graph includes multiple nodes and edges between nodes.
  • the graph information includes node information and edges.
  • information, each node corresponds to an object, the information of the node includes the attributes of the object, and the information of the edge includes the relationship between objects;
  • the first feature representation and the second feature are obtained representation, the first feature representation is a feature representation of a node, and the second feature representation is a feature representation of an edge;
  • the first weight is obtained through the first neural network, so
  • the first weight is the weight of the node; the first weight is used to fuse with the corresponding first feature representation to obtain the third feature representation; according to the second feature representation of each edge, through the second neural network, we obtain
  • the second weight is the weight of the edge; according to the third feature representation and the second weight, the first loss is obtained through the graph neural network GNN, and the first loss is used to determine the loss
  • the first weight can be fused with the corresponding first feature representation, which is equivalent to applying a perturbation to the first feature representation, which is equivalent to the role of the first neural network in obtaining the size of the applied perturbation based on the first feature representation. Since the input to The input in the subsequent task network (such as GNN) is the feature after the perturbation is applied (that is, the third feature representation). As the model is updated, there will be a trend in the perturbation: it has a greater impact on the accuracy of the network execution task. For nodes, their first weight will be given larger and larger (that is, the interference will be smaller and smaller), and for nodes that have less impact on the accuracy of network execution tasks, their first weight will be given smaller and smaller (that is, the interference will be smaller and smaller).
  • the interference will become larger and larger), and then the first weight can represent the degree of influence of the node.
  • the second weight can be input into the subsequent task network (such as GNN) as the weight exerted by the task network on the edge when processing the information of the corresponding edge.
  • the subsequent task network such as GNN
  • the weight exerted by the task network on the edge when processing the information of the corresponding edge.
  • the weight exerted by the task network on the edge when processing the information of the corresponding edge.
  • the weight for setting the weight usually, the weight of each edge is the same by default
  • the parameters for setting the weight of each edge in the task network can be set to the corresponding second weight.
  • the perturbation will have a trend: For the edge that has a greater impact on the accuracy of the network execution task, its second weight will be given larger and larger (that is, the interference will be smaller and smaller). For the edge that has a smaller impact on the accuracy of the network execution task, its second weight will be given. The weight will be given smaller and smaller (that is, the interference will become larger and larger), and then the second weight can represent the degree of influence of the edge.
  • the first neural network and the second neural network trained in the above manner can be used as a graph interpreter to determine the importance of each node and the relationship between nodes, which is equivalent to obtaining a more complete graph interpretation result than the existing technology.
  • the recommendation method is introduced above from the perspective of model training.
  • a data processing method provided by the embodiment of the present application is introduced from the perspective of model inference:
  • Figure 10 is a flow diagram of a data processing method provided by an embodiment of the present application.
  • a data processing method provided by an embodiment of the present application includes:
  • the graph information includes multiple nodes and edges between the nodes.
  • the graph information includes node information and edge information. Each node corresponds to an object.
  • the node's The information includes attributes of objects, and the edge information includes relationships between objects;
  • step 1001 For a specific description of step 1001, reference may be made to the introduction of step 601 in the above embodiment, which will not be described again here.
  • the first feature representation is a feature representation of a node
  • the second feature representation is a feature representation of an edge
  • step 1002 For a specific description of step 1002, reference may be made to the introduction of step 602 in the above embodiment, which will not be described again here.
  • the first weight is obtained through the first neural network.
  • the first weight is the weight of the node; the first weight is used to represent the position of the corresponding node in the graph. degree of importance;
  • the first neural network can be obtained through the model training method corresponding to Figure 6.
  • each edge obtains a second weight through the second neural network.
  • the second weight is the weight of the edge; the second weight is used to represent the position of the corresponding edge in the graph. Importance.
  • the second neural network can be obtained through the model training method corresponding to Figure 6.
  • the first feature representation includes the embedding representation (embedding) of the node obtained through the feature network and the information of the corresponding node; or,
  • the second feature representation includes the first feature representation of the nodes at both ends of the edge and the corresponding edge information.
  • the first feature representation includes features of multiple dimensions
  • the first weight includes a weight corresponding to the features of each of the dimensions
  • the second feature representation includes features of multiple dimensions, and the second weight includes a weight corresponding to the features of each of the dimensions.
  • the first neural network or the second neural network is a neural network based on an attention mechanism.
  • FIG 11 is a schematic structural diagram of a model training device provided by an embodiment of the present application.
  • a model training device 1100 provided by an embodiment of the present application includes:
  • Obtaining module 1101 is used to obtain information of an information graph of a graph.
  • the graph includes multiple nodes and edges between nodes.
  • the information of the graph includes node information and edge information.
  • Each node corresponds to an object.
  • the node information includes the attributes of the objects, and the edge information includes the relationships between objects;
  • step 601 For a specific introduction to the acquisition module 1101, please refer to the description of step 601 in the above embodiment, and will not be described again here.
  • the processing module 1102 is configured to obtain a first feature representation and a second feature representation based on the information of the graph.
  • the first feature representation is a feature representation of a node
  • the second feature representation is a feature representation of an edge
  • the first weight is obtained through the first neural network, and the first weight is the weight of the node; the first weight is used to fuse with the corresponding first feature representation, To obtain the third characteristic representation;
  • a second weight is obtained, and the second weight is the weight of the edge;
  • the first loss is obtained through the graph neural network GNN, and the first loss is used to determine the loss function
  • the model update module 1103 is used to update the first attention network, the second attention network and the GNN according to the loss function.
  • model update module 1103 For a specific introduction to the model update module 1103, please refer to the description of step 606 in the above embodiment, and will not be described again here.
  • the first neural network and the second neural network trained in the above manner can be used as a graph interpreter to determine the importance of each node and the relationship between nodes, which is equivalent to obtaining a more complete graph interpretation result than the existing technology.
  • the GNN is used to perform a target task
  • the first weight is the degree of positive influence of the corresponding node on the GNN when performing the target task.
  • the acquisition module also uses At:
  • a third weight is obtained, the third weight is the weight of a node, and the third weight is the degree of reverse influence of the corresponding node on the GNN when executing the target task;
  • the third weight is used to fuse with the corresponding first feature representation to obtain the fourth feature representation;
  • the processing module is further configured to: obtain a second loss through a graph neural network GNN according to the fourth feature representation, and the second loss is used to determine the loss function.
  • the first weight is expressed as a positive number less than 1, and the sum of the third weight and the corresponding first weight is 1.
  • the GNN is used to perform the target task
  • the second weight indicates the degree of positive influence of the corresponding edge on the GNN when performing the target task.
  • the acquisition module also uses At:
  • a fourth weight is obtained, the fourth weight is the weight of an edge, and the fourth weight indicates the degree of reverse influence of the corresponding edge on the GNN when performing the target task;
  • the processing module is further configured to: obtain a third loss through a graph neural network GNN according to the fourth weight, and the third loss is used to determine the loss function.
  • the first weight is expressed as a positive number less than 1, and the sum of the fourth weight and the corresponding second weight is 1.
  • the first feature representation includes the embedding representation (embedding) of the node obtained through the feature network and the information of the corresponding node; or,
  • the second feature representation includes embedded representations of nodes at both ends of an edge and information about the edge.
  • the first feature representation includes features of multiple dimensions
  • the first weight includes a weight corresponding to the features of each of the dimensions
  • the second feature representation includes features of multiple dimensions, and the second weight includes a weight corresponding to the features of each of the dimensions.
  • the first neural network or the second neural network is a neural network based on an attention mechanism.
  • the fusion includes:
  • the object is a character
  • different nodes correspond to different characters
  • the edges indicate kinship relationships or economic relationships between the characters
  • the GNN is used according to the information of the graph, Predict whether at least one of the described characters is a financial risk.
  • Figure 12 provides a schematic structural diagram of a data processing device according to an embodiment of the present application.
  • a data processing device 1200 according to an embodiment of the present application includes:
  • the acquisition module 1201 is used to obtain graph information.
  • the graph information includes multiple nodes and edges between nodes.
  • the graph information includes node information and edge information. Each node corresponds to an object.
  • the node information includes attributes of objects, and the edge information includes relationships between objects;
  • step 1001 for a specific description of the acquisition module 1201, please refer to the introduction of step 1001 in the above embodiment, and will not be described again here.
  • the processing module 1202 is configured to obtain a first feature representation and a second feature representation based on the information of the graph.
  • the first feature representation is a feature representation of a node
  • the second feature representation is a feature representation of an edge
  • a first weight is obtained through the first neural network, and the first weight is the weight of the node; the first weight is used to represent the position of the corresponding node in the graph. Importance;
  • a second weight is obtained through the second neural network, and the second weight is the weight of the edge; the second weight is used to represent the importance of the corresponding edge in the graph. .
  • the first feature representation includes the embedding representation (embedding) of the node obtained through the feature network and the information of the corresponding node; or,
  • the second feature representation includes the first feature representation of the nodes at both ends of the edge and the corresponding edge information.
  • the first feature representation includes features of multiple dimensions
  • the first weight includes a weight corresponding to the features of each of the dimensions
  • the second feature representation includes features of multiple dimensions, and the second weight includes a weight corresponding to the features of each of the dimensions.
  • the first neural network or the second neural network is a neural network based on an attention mechanism.
  • FIG. 13 is a schematic structural diagram of an execution device provided by an embodiment of the present application.
  • the execution device 1300 can be embodied as a mobile phone, a tablet, a notebook computer, Smart wearable devices, servers, etc. are not limited here.
  • the recommendation device described in the corresponding embodiment of FIG. 12 may be deployed on the execution device 1300 to implement the function of the recommendation method in the corresponding embodiment of FIG. 10 .
  • the execution device 1300 includes: a receiver 1301, a transmitter 1302, a processor 1303, and a memory 1304 (the number of processors 1303 in the execution device 1300 may be one or more), where the processor 1303 may include application processing processor 13031 and communication processor 13032.
  • the receiver 1301, the transmitter 1302, the processor 1303, and the memory 1304 may be connected through a bus or other means.
  • Memory 1304 may include read-only memory and random access memory and provides instructions and data to processor 1303 .
  • a portion of memory 1304 may also include non-volatile random access memory (NVRAM).
  • NVRAM non-volatile random access memory
  • the memory 1304 stores processor and operating instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, where the operating instructions may include various operating instructions for implementing various operations.
  • the processor 1303 controls the execution of operations of the device.
  • various components of the execution device are coupled together through a bus system.
  • the bus system may also include a power bus, a control bus, a status signal bus, etc.
  • various buses are called bus systems in the figure.
  • the methods disclosed in the above embodiments of the present application can be applied to the processor 1303 or implemented by the processor 1303.
  • the processor 1303 may be an integrated circuit chip with signal processing capabilities. During the implementation process, each step of the above method can be completed by instructions in the form of hardware integrated logic circuits or software in the processor 1303 .
  • the above-mentioned processor 1303 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, a vision processing unit (VPU), or a tensor processing unit.
  • DSP digital signal processor
  • VPU vision processing unit
  • TPU and other processors suitable for AI computing, may further include application specific integrated circuits (ASICs), field-programmable gate arrays (field-programmable gate arrays, FPGAs) or other programmable logic devices, Discrete gate or transistor logic devices, discrete hardware components.
  • ASICs application specific integrated circuits
  • FPGAs field-programmable gate arrays
  • Discrete gate or transistor logic devices discrete hardware components.
  • the processor 1303 can implement or execute each method, step and logical block diagram disclosed in the embodiment of this application.
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
  • the steps of the method disclosed in conjunction with the embodiments of the present application can be directly implemented by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other mature storage media in this field.
  • the storage medium is located in the memory 1304.
  • the processor 1303 reads the information in the memory 1304 and completes steps 1001 to 1004 in the above embodiment in conjunction with its hardware.
  • the receiver 1301 may be configured to receive input numeric or character information and generate signal inputs related to performing relevant settings and functional controls of the device.
  • the transmitter 1302 can be used to output numeric or character information through the first interface; the transmitter 1302 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 1302 can also include a display device such as a display screen .
  • FIG. 14 is a schematic structural diagram of the training device provided by the embodiment of the present application.
  • the training device 1400 is implemented by one or more servers.
  • the training device 1400 There may be relatively large differences due to different configurations or performance, which may include one or more central processing units (CPU) 1414 (for example, one or more processors) and memory 1432, one or more storage applications Storage medium 1430 for program 1442 or data 1444 (eg, one or more mass storage devices).
  • the memory 1432 and the storage medium 1430 may be short-term storage or persistent storage.
  • the program stored in the storage medium 1430 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the training device. Furthermore, the central processor 1414 may be configured to communicate with the storage medium 1430 and execute a series of instruction operations in the storage medium 1430 on the training device 1400 .
  • the training device 1400 may also include one or more power supplies 1426, one or more wired or wireless network interfaces 1450, one or more input and output interfaces 1458; or, one or more operating systems 1441, such as Windows ServerTM, Mac OS XTM , UnixTM, LinuxTM, FreeBSDTM and so on.
  • operating systems 1441 such as Windows ServerTM, Mac OS XTM , UnixTM, LinuxTM, FreeBSDTM and so on.
  • the training device may perform steps 601 to 606 in the above embodiment.
  • An embodiment of the present application also provides a computer program product that, when run on a computer, causes the computer to perform the steps performed by the foregoing execution device, or causes the computer to perform the steps performed by the foregoing training device.
  • Embodiments of the present application also provide a computer-readable storage medium.
  • the computer-readable storage medium stores a program for performing signal processing.
  • the program When the program is run on a computer, it causes the computer to perform the steps performed by the aforementioned execution device. , or, causing the computer to perform the steps performed by the aforementioned training device.
  • the execution device, training device or terminal device provided by the embodiment of the present application may specifically be a chip.
  • the chip includes: a processing unit and a communication unit.
  • the processing unit may be, for example, a processor.
  • the communication unit may be, for example, an input/output interface. Pins or circuits, etc.
  • the processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment.
  • the storage unit is a storage unit within the chip, such as a register, cache, etc.
  • the storage unit may also be a storage unit located outside the chip in the wireless access device, such as Read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (random access memory, RAM), etc.
  • ROM Read-only memory
  • RAM random access memory
  • Figure 15 is a structural schematic diagram of a chip provided by an embodiment of the present application.
  • the chip can be represented as a neural network processor NPU 1500.
  • the NPU 1500 serves as a co-processor and is mounted to the host CPU (Host CPU). ), tasks are allocated by the Host CPU.
  • the core part of the NPU is the arithmetic circuit 1503.
  • the arithmetic circuit 1503 is controlled by the controller 1504 to extract the matrix data in the memory and perform multiplication operations.
  • NPU 1500 can implement the model training method provided in the embodiment described in Figure 6 and the data processing method provided in the embodiment described in Figure 10 through the cooperation between various internal components.
  • the computing circuit 1503 in the NPU 1500 internally includes multiple processing units (Process Engine, PE).
  • arithmetic circuit 1503 is a two-dimensional systolic array.
  • the arithmetic circuit 1503 may also be a one-dimensional systolic array or other electronic circuit capable of performing mathematical operations such as multiplication and addition.
  • arithmetic circuit 1503 is a general-purpose matrix processor.
  • the arithmetic circuit obtains the corresponding data of matrix B from the weight memory 1502 and caches it on each PE in the arithmetic circuit.
  • the operation circuit takes matrix A data and matrix B from the input memory 1501 to perform matrix operations, and the partial result or final result of the obtained matrix is stored in an accumulator (accumulator) 1508 .
  • the unified memory 1506 is used to store input data and output data.
  • the weight data directly passes through the storage unit access controller (Direct Memory Access Controller, DMAC) 1505, and the DMAC is transferred to the weight memory 1502.
  • Input data is also transferred to unified memory 1506 via DMAC.
  • DMAC Direct Memory Access Controller
  • BIU is the Bus Interface Unit, that is, the bus interface unit 1510, which is used for the interaction between the AXI bus and the DMAC and the Instruction Fetch Buffer (IFB) 1509.
  • IFB Instruction Fetch Buffer
  • the bus interface unit 1510 (Bus Interface Unit, BIU for short) is used to fetch the memory 1509 to obtain instructions from the external memory, and is also used for the storage unit access controller 1505 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
  • BIU Bus Interface Unit
  • DMAC is mainly used to transfer the input data in the external memory DDR to the unified memory 1506 or the weight data to the weight memory 1502 or the input data to the input memory 1501 .
  • the vector calculation unit 1507 includes multiple arithmetic processing units, and if necessary, further processes the output of the arithmetic circuit 1503, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc.
  • vector calculation unit 1507 can store the processed output vectors to unified memory 1506 .
  • the vector calculation unit 1507 can apply a linear function; or a nonlinear function to the output of the operation circuit 1503, such as linear interpolation on the feature plane extracted by the convolution layer, or a vector of accumulated values, to generate an activation value.
  • vector calculation unit 1507 generates normalized values, pixel-wise summed values, or both.
  • the processed output vector can be used as an activation input to the arithmetic circuit 1503, such as for use in a subsequent layer in a neural network.
  • the instruction fetch buffer 1509 connected to the controller 1504 is used to store instructions used by the controller 1504;
  • the unified memory 1506, the input memory 1501, the weight memory 1502 and the fetch memory 1509 are all On-Chip memories. External memory is private to the NPU hardware architecture.
  • the processor mentioned in any of the above places can be a general central processing unit, a microprocessor, an ASIC, or one or more integrated circuits used to control the execution of the above programs.
  • the device embodiments described above are only illustrative.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physically separate.
  • the physical unit can be located in one place, or it can be distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • the connection relationship between modules indicates that there are communication connections between them, which can be specifically implemented as one or more communication buses or signal lines.
  • the present application can be implemented by software plus necessary general hardware. Of course, it can also be implemented by dedicated hardware including dedicated integrated circuits, dedicated CPUs, dedicated memories, Special components, etc. to achieve. In general, all functions performed by computer programs can be easily implemented with corresponding hardware. Moreover, the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special-purpose circuits. circuit etc. However, for this application, software program implementation is a better implementation in most cases. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence or that contributes to the existing technology.
  • the computer software product is stored in a readable storage medium, such as a computer floppy disk. , U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., including several instructions to cause a computer device (which can be a personal computer, training device, or network device, etc.) to execute the steps described in various embodiments of this application. method.
  • a computer device which can be a personal computer, training device, or network device, etc.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, the computer instructions may be transferred from a website, computer, training device, or data
  • the center transmits to another website site, computer, training equipment or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) means.
  • wired such as coaxial cable, optical fiber, digital subscriber line (DSL)
  • wireless such as infrared, wireless, microwave, etc.
  • the computer-readable storage medium may be any available medium that a computer can store, or a data storage device such as a training device or a data center integrated with one or more available media.
  • the available media may be magnetic media (eg, floppy disk, hard disk, tape), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Image Analysis (AREA)

Abstract

一种模型训练方法,包括:获取图的信息,根据图的信息,得到图中每个节点的第一特征表示、以及每个边的第二特征表示;根据每个节点的第一特征表示,通过第一神经网络,得到第一权重,第一权重为节点的权重;第一权重用于与对应的第一特征表示进行融合,以得到第三特征表示;根据每个边的第二特征表示,通过第二神经网络,得到第二权重,第二权重为边的权重。通过训练得到的第一神经网络和第二神经网络可以作为图的解释器来判断各个节点以及节点之间关系的重要程度,可以得到更完整的图解释结果。

Description

一种模型训练方法以及相关设备 技术领域
本申请涉及人工智能领域,尤其涉及一种模型训练方法以及相关设备。
背景技术
人工智能(artificial intelligence,AI)是利用数字计算机或者数字计算机控制的机器模拟、延伸和扩展人的智能,感知环境、获取知识并使用知识获得最佳结果的理论、方法、技术及应用系统。换句话说,人工智能是计算机科学的一个分支,它企图了解智能的实质,并生产出一种新的能以人类智能相似的方式作出反应的智能机器。人工智能也就是研究各种智能机器的设计原理与实现方法,使机器具有感知、推理与决策的功能。
图为包括至少一个节点以及至少一条边的数据结构。在一些场景中,图中的节点可以映射为对象(或者称之为实体),图中的边可以映射为实体与实体之间的关系。图可以是有向图或无向图。当然,图还可以包括节点以及边以外的其他数据,例如节点的标签以及边的标签等。在一个示例性场景中,应用于好友推荐的场景中,图中的每个节点可以表示一个用户,图中的每条边可以表示不同用户之间的社交关系,图中每个节点的数据为用户的画像数据以及用户的行为数据,例如用户的年龄、职业、爱好、学历等。又如,应用于在商品推荐的场景中,图中的每个节点可以表示一个用户或一个商品,图中的每条边可以表示用户与商品之间的交互关系,例如购买关系、收藏关系等。又如,应用于金融风控的场景中,图中的每个节点可以表示账号、交易或资金。
图的解释器用于根据图的信息(例如包括节点的信息以及边的信息)来得到各个节点对于某一节点的状态的影响程度。在现有的实现中,通过基于扰动的解释方法来实现图的解释,该方法的思想是将图的信息输入到用于实现目标任务的图神经网络(graph neural network,GNN)中,目标任务可以用于预测某一个节点的状态,通过对输入的图的信息进行扰动,观察GNN模型的输出,从而确定输入的图的信息中各个节点对GNN模型对预测节点的状态所起到的作用,该作用可以作为对于某一节点的状态的影响程度。
然而,上述方式仅仅能够得到节点对于节点的状态的影响程度,图解释的结果不完整(例如,并不能得到针对于节点之间的边对于节点的状态的影响程度)。
发明内容
本申请提供的一种模型训练方法,可以得到相比现有技术更完整的图解释结果。
本申请提供的一种模型训练方法,应用于云侧的服务器或者终端设备,方法包括:
获取图的信息图的信息,图包括多个节点以及节点之间的边,图的信息包括节点的信息和边的信息,每个节点对应一个对象,节点的信息包括对象的属性,边的信息包括对象之间的关系;
其中,以节点对应的对象为人物为例,人物的属性可以为性别、年龄、职业、收入、爱好以及受教育程度中的至少一种,其中,性别可以为男或者女,年龄可以为0-100之间的 数字,职业可以为教师、程序员、厨师等等,爱好可以为篮球、网球、跑步等等,受教育程度可以为小学、初中、高中、大学等等;本申请并不限定对象的属性的具体类型。其中,以节点对应的对象为物品为例,物品可以为实体物品,或者是虚拟物品,例如可以为应用程序(application,APP)、音视频、网页以及新闻资讯等物品,物品的属性可以为物品名称、开发者、安装包大小、品类以及好评度中的至少一种,其中,以物品为应用程序为例,物品的品类可以为聊天类、跑酷类游戏、办公类等等,好评度可以为针对于物品的打分、评论等;本申请并不限定物品的属性的具体类型。其中,以节点对应的对象为人物为例,对象之间的关系可以为亲属关系、经济上的关系(例如股权关联、贸易关联等)。
根据图的信息,得到每个节点的第一特征表示、以及每个边的第二特征表示;根据每个节点的第一特征表示,通过第一神经网络,得到第一权重,所述第一权重为节点的权重;第一权重用于与对应的第一特征表示进行融合,以得到第三特征表示;根据每个边的第二特征表示,通过第二神经网络,得到第二权重,所述第二权重为边的权重第二权重,所述第二权重为边的权重;根据第三特征表示和第二权重,通过图神经网络GNN,得到第一损失,第一损失用于确定损失函数;根据损失函数,更新第一注意力网络、第二注意力网络以及GNN。
该第一权重可以与对应的第一特征表示进行融合,相当于对第一特征表示施加了扰动,相当于第一神经网络的作用根据第一特征表示来得到施加的扰动的大小,由于输入到后续任务网络(例如GNN)中的输入为施加了扰动后的特征(也就是第三特征表示),随着模型的更新,该扰动会存在着一个趋势:对于网络执行任务的精度影响较大的节点,其第一权重会被赋予的越来越大(也就是干扰会越来越小),对于网络执行任务的精度影响较小的节点,其权重会被赋予的越来越小(也就是干扰会越来越大),进而第一权重就可以表征出节点的影响程度。类似的,该第二权重可以输入到后续的任务网络(例如GNN)中,来作为任务网络在处理对应的边的信息时对边施加的权重,例如,任务网络中会存在针对于各个边的权重的设定的参数(通常情况下,默认各个边的权重相同),进而可以将任务网络中针对于各个边的权重的设定的参数设置为对应的第二权重。通过上述方式,相当于对第二特征表示施加了扰动,相当于第二神经网络的作用根据第二特征表示来得到施加的扰动的大小,随着模型的更新,该扰动会存在着一个趋势:对于网络执行任务的精度影响较大的边,其第二权重会被赋予的越来越大(也就是干扰会越来越小),对于网络执行任务的精度影响较小的边,其第二权重会被赋予的越来越小(也就是干扰会越来越大),进而第二权重就可以表征出边的影响程度。
通过上述方式训练得到的第一神经网络和第二神经网络可以作为图的解释器来判断各个节点以及节点之间关系的重要程度,相当于可以得到相比现有技术更完整的图解释结果。
在一种可能的实现中,上述第一权重可以表示出对应的节点对于GNN在执行目标任务时的正向影响程度,然而,在一种实现中,该节点的第一权重被设置的较大时,网络的处理精度较高,而该节点的第一权重被设置的较小时,网络的处理精度仍然较高,或者下降的很少,则该节点的影响程度依然很低,因此,仅通过一个维度的权重(例如正向影响程 度)并不能准确的表征出节点的实际影响程度。本申请实施例中,通过多个维度的权重来参数模型的前馈过程,来准确的表征出节点的实际影响程度。
在一种可能的实现中,可以根据第一权重,获取第三权重,所述第三权重为节点的权重,第一权重指示对应的节点对于GNN在执行目标任务时的反向影响程度;第三权重用于与对应的第一特征表示进行融合,以得到第四特征表示;根据第四特征表示,通过图神经网络GNN,得到第二损失,第二损失用于确定损失函数。例如,在第一权重较大,第三权重较小时,第一损失可以表示该节点的权重较大时对应模型的精度,第二损失可以表示该节点的权重较小时对应模型的精度,若该节点的第一权重被设置的较大时,网络的处理精度较高,而该节点的第一权重被设置的较小时,网络的处理精度仍然较高,或者下降的很少,则随着模型的更新,第一权重会逐渐变小,进而可以更准确的描述出节点的实际影响程度,提高了网络的精度。
在一种可能的实现中,第一权重表示为小于1的正数,第三权重与对应的第一权重的加和为1。例如,第一权重为0.9,第三权重为0.1。
在一种可能的实现中,上述第一权重可以称之为节点的正掩膜,第三权重可以称之为节点的负掩膜。
类似的,针对于边,也可以通过上述正负掩膜的方式构建损失函数,例如,GNN用于执行目标任务,第二权重指示对应的边对于GNN在执行目标任务时的正向影响程度,可以根据第二权重,获取第四权重,所述第四权重为边的权重,第四权重指示对应的边对于GNN在执行目标任务时的反向影响程度;根据第四权重,通过图神经网络GNN,得到第三损失,第三损失用于确定损失函数。
在一种可能的实现中,第一权重表示为小于1的正数,第四权重与对应的第二权重的加和为1。
在一种可能的实现中,可以将每个节点的嵌入表示和节点的信息进行融合(例如进行拼接,得到第一特征表示),该第一特征表示可以作为节点的异构信息。
其中,针对于每个边,可以将边所在的两端的节点的第一特征表示以及其自身的边的信息进行融合,得到边的第二特征表示(也就是边的异构信息)。
通过上述方式,在包含不同类型的节点的异构图中,不同类型的节点对应不同维度的特征,同一维度的特征其含义也可能存在差异。异构图中的边因类型不一,也需要进行有区分的表征。对于节点:本实施例通过将图结构信息(节点的嵌入表示)和原始特征(节点的信息)进行融合的方式,可以得到表示节点异构信息的特征。对于边:本实施例通过提取边所在首尾节点的嵌入表示以及边自身所带属性(边的信息)进行融合表征,可以得到表示边的异构信息的特征。进而实现了异构图中节点和边的准确的异构信息表示。
在一种可能的实现中,第一特征表示包括多个维度的特征,第一权重包括每个维度的特征对应的权重;或者,
第二特征表示包括多个维度的特征,第二权重包括每个维度的特征对应的权重。
在一种可能的实现中,第一神经网络或第二神经网络为基于注意力机制的神经网络。
在一种可能的实现中,融合,包括:
加权。
在一种可能的实现中,对象为人物,不同节点对应于不同的人物,边指示人物之间的亲属关系或经济关系,GNN用于根据图的信息,预测至少一个人物是否存在经济风险。
第二方面,本申请实施例提供一种数据处理方法,包括:
获取图的信息,图的信息包括多个节点以及节点之间的边,图的信息包括节点的信息和边的信息,每个节点对应一个对象,节点的信息包括对象的属性,边的信息包括对象之间的关系;
根据图的信息,得到每个节点的第一特征表示、以及每个边的第二特征表示;
根据每个节点的第一特征表示,通过第一神经网络,得到第一权重,所述第一权重为节点的权重;第一权重用于表示对应的节点在图中的重要程度;
根据每个边的第二特征表示,通过第二神经网络,得到第二权重,所述第二权重为边的权重第二权重,所述第二权重为边的权重;第二权重用于表示对应的边在图中的重要程度。
在一种可能的实现中,第一特征表示包括通过特征网络得到的节点的嵌入表示(embedding)以及对应的节点的信息;或者,
第二特征表示包括边两端的节点的第一特征表示以及对应的边的信息。
在一种可能的实现中,第一特征表示包括多个维度的特征,第一权重包括每个维度的特征对应的权重;或者,
第二特征表示包括多个维度的特征,第二权重包括每个维度的特征对应的权重。
在一种可能的实现中,第一神经网络或第二神经网络为基于注意力机制的神经网络。
第三方面,本申请提供了一种模型训练装置,装置包括:
获取模块,用于获取图的信息图的信息,图包括多个节点以及节点之间的边,图的信息包括节点的信息和边的信息,每个节点对应一个对象,节点的信息包括对象的属性,边的信息包括对象之间的关系;
处理模块,用于根据图的信息,得到每个节点的第一特征表示、以及每个边的第二特征表示;
根据每个节点的第一特征表示,通过第一神经网络,得到第一权重,所述第一权重为节点的权重;第一权重用于与对应的第一特征表示进行融合,以得到第三特征表示;
根据每个边的第二特征表示,通过第二神经网络,得到第二权重,所述第二权重为边的权重;
根据第三特征表示和第二权重,通过图神经网络GNN,得到第一损失,第一损失用于确定损失函数;
模型更新模块,用于根据损失函数,更新第一注意力网络、第二注意力网络以及GNN。
通过上述方式训练得到的第一神经网络和第二神经网络可以作为图的解释器来判断各 个节点以及节点之间关系的重要程度,相当于可以得到相比现有技术更完整的图解释结果。
在一种可能的实现中,GNN用于执行目标任务,第一权重指示对应的节点对于GNN在执行目标任务时的正向影响程度,获取模块,还用于:
根据第一权重,获取第三权重,所述第三权重为节点的权重,第一权重指示对应的节点对于GNN在执行目标任务时的反向影响程度;第三权重用于与对应的第一特征表示进行融合,以得到第四特征表示;
处理模块,还用于:根据第四特征表示,通过图神经网络GNN,得到第二损失,第二损失用于确定损失函数。
在一种可能的实现中,第一权重表示为小于1的正数,第三权重与对应的第一权重的加和为1。
在一种可能的实现中,GNN用于执行目标任务,第二权重指示对应的边对于GNN在执行目标任务时的正向影响程度,获取模块,还用于:
根据第二权重,获取第四权重,所述第四权重为边的权重,第四权重指示对应的边对于GNN在执行目标任务时的反向影响程度;
处理模块,还用于:根据第四权重,通过图神经网络GNN,得到第三损失,第三损失用于确定损失函数。
在一种可能的实现中,第一权重表示为小于1的正数,第四权重与对应的第二权重的加和为1。
在一种可能的实现中,第一特征表示包括通过特征网络得到的节点的嵌入表示(embedding)以及对应的节点的信息;或者,
第二特征表示包括边两端的节点的嵌入表示以及边的信息。
在一种可能的实现中,第一特征表示包括多个维度的特征,第一权重包括每个维度的特征对应的权重;或者,
第二特征表示包括多个维度的特征,第二权重包括每个维度的特征对应的权重。
在一种可能的实现中,第一神经网络或第二神经网络为基于注意力机制的神经网络。
在一种可能的实现中,融合,包括:
加权。
在一种可能的实现中,对象为人物,不同节点对应于不同的人物,边指示人物之间的 亲属关系或经济关系,GNN用于根据图的信息,预测至少一个人物是否存在经济风险。
第四方面,本申请实施例提供一种数据处理方法,包括:
获取模块,用于获取图的信息,图的信息包括多个节点以及节点之间的边,图的信息包括节点的信息和边的信息,每个节点对应一个对象,节点的信息包括对象的属性,边的信息包括对象之间的关系;
处理模块,用于根据图的信息,得到每个节点的第一特征表示、以及每个边的第二特征表示;
根据每个节点的第一特征表示,通过第一神经网络,得到第一权重,所述第一权重为节点的权重;第一权重用于表示对应的节点在图中的重要程度;
根据每个边的第二特征表示,通过第二神经网络,得到第二权重,所述第二权重为边的权重;第二权重用于表示对应的边在图中的重要程度。
在一种可能的实现中,第一特征表示包括通过特征网络得到的节点的嵌入表示(embedding)以及对应的节点的信息;或者,
第二特征表示包括边两端的节点的第一特征表示以及对应的边的信息。
在一种可能的实现中,第一特征表示包括多个维度的特征,第一权重包括每个维度的特征对应的权重;或者,
第二特征表示包括多个维度的特征,第二权重包括每个维度的特征对应的权重。
在一种可能的实现中,第一神经网络或第二神经网络为基于注意力机制的神经网络。
第五方面,本申请实施例提供了一种训练装置,可以包括存储器、处理器以及总线系统,其中,存储器用于存储程序,处理器用于执行存储器中的程序,以执行如上述第一方面任一可选的方法。
第五方面,本申请实施例提供了一种执行装置,可以包括存储器、处理器以及总线系统,其中,存储器用于存储程序,处理器用于执行存储器中的程序,以执行如上述第二方面任一可选的方法。
第六方面,本申请实施例提供了一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面及任一可选的方法、以及上述第二方面及任一可选的方法。
第七方面,本申请实施例提供了一种计算机程序产品,包括代码,当代码被执行时,用于实现上述第一方面及任一可选的方法、以及上述第二方面及任一可选的方法。
第八方面,本申请提供了一种芯片系统,该芯片系统包括处理器,用于支持执行设备或训练设备实现上述方面中所涉及的功能,例如,发送或处理上述方法中所涉及的数据;或,信息。在一种可能的设计中,芯片系统还包括存储器,存储器,用于保存执行设备或训练设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包括芯片和其他分立器件。
附图说明
图1为本申请实施例提供的一种系统架构的示意图;
图2为本申请实施例提供的一种系统架构的示意图;
图3为本申请实施例提供的一种系统架构的示意图;
图4为本申请实施例提供的一种系统架构的示意图;
图5为本申请实施例提供的一种系统架构的示意图;
图6为本申请实施例提供的一种模型训练方法的流程示意图;
图7为一种损失函数的示意;
图8为一种模型训练方法的流程的示意;
图9为一种图结构的解释结果示意;
图10为本申请实施例提供的一种数据处理方法的流程示意图;
图11为本申请实施例提供的一种模型训练装置的结构示意图;
图12为本申请实施例提供的一种数据处理装置的结构示意图;
图13为本申请实施例提供的一种执行设备的示意图;
图14为本申请实施例提供的一种训练设备的示意图;
图15为本申请实施例提供的一种芯片的示意图。
具体实施方式
下面结合本发明实施例中的附图对本发明实施例进行描述。本发明的实施方式部分使用的术语仅用于对本发明的具体实施例进行解释,而非旨在限定本发明。
下面结合附图,对本申请的实施例进行描述。本领域普通技术人员可知,随着技术的发展和新场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的术语在适当情况下可以互换,这仅仅是描述本申请的实施例中对相同属性的对象在描述时所采用的区分方式。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,以便包含一系列单元的过程、方法、系统、产品或设备不必限于那些单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它单元。
首先介绍本申请的应用场景,本申请可以但不限于应用在电路设计类应用程序或者云侧服务器提供的云服务等,接下来分别进行介绍:
一、图解释类应用程序
本申请实施例的产品形态可以为图解释类应用程序。图解释类应用程序可以运行在终端设备或者云侧的服务器上。
在一种可能的实现中,图解释类应用程序可以根据输入的图的信息(包括节点的信息和边的信息),生成节点的重要程度以及节点之间的关联度。在本申请实施例中,节点的信息可以为对象的属性信息以及对象之间的关系,属性信息可以有多种,以对象为人物为例,具体可以包括但不限于性别,年龄,职业,爱好等,对象还可以为物品,例如应用程序(application,APP),例如APP市场的训练样本中所提取的对象特征可以为,APP的名称(标 识),类型,大小等;而电商类APP的训练样本中所提起的对象特征可以为,商品的名称,所属的类别,价格区间等;对象之间的关系可以为亲属关系、经济上的关系(例如股权关联、贸易关联等)。
接下来分别从功能架构以及实现功能的产品架构介绍本申请实施例中的图解释类应用程序。
参照图1,图1为本申请实施例中图解释类应用程序的功能架构示意:
在一种可能的实现中,本申请实施例包含能够基于输入的图的信息而生成节点的重要程度以及节点之间的关联度的系统(例如图解释类应用程序),其中,对系统输入不同的参数值可致使不同的图解释生成。如图1所示,图解释类应用程序102可接收输入的参数101且产生图解释结果103。图解释类应用程序102可在(举例来说)至少一个计算机系统上执行,且包括计算机代码,所述计算机代码在由一或多个计算机执行时致使所述计算机执行用于执行图解释相关的方法。
在一种可能的实现中,图解释类设计软件可以运行在端侧的终端设备或者运行在云侧的服务器中。
例如,终端设备可以安装有图解释类设计软件,包括数据输入、数据处理以及数据输出的动作可以为终端设备执行的。
例如,终端设备可以安装有图解释类设计软件的客户端,包括数据输入以及数据输出的动作可以为终端设备执行的,也就是说,终端设备可以将数据处理所需的数据传输到云侧的服务器,云侧的服务器在执行完数据处理动作后,可以将数据处理结果返回至端侧的终端设备,由终端设备基于处理结果进行输出。
接下来介绍本申请实施例中运行电路设计类应用程序的实体架构。
参照图2,图2为本申请实施例中运行电路设计类应用程序的实体架构示意:
参见图2,图2示出了一种系统架构示意图。该系统可以包括终端100、以及服务器200。其中,服务器200可以包括一个或者多个服务器(图2中以包括一个服务器作为示例进行说明),服务器200可以为一个或者多个终端提供图解释服务。
其中,终端100上可以安装有图解释类设计应用程序,或者打开与图解释类设计相关的网页,上述应用程序和网页可以提供一个图解释类设计界面,终端100可以接收用户在图解释类设计界面上输入的相关参数,并将上述参数发送至服务器200,服务器200可以基于接收到的参数,得到处理结果,并将处理结果返回至至终端100。
应理解,在一些可选的实现中,终端100也可以由自身完成基于接收到的参数,得到图解释结果的动作,而不需要服务器配合实现,本申请实施例并不限定。
接下来描述图2中终端100的产品形态;
本申请实施例中的终端100可以为手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等,本申请实施例对此不作任何限制。
图3示出了终端100的一种可选的硬件结构示意图。
参考图3所示,终端100可以包括射频单元110、存储器120、输入单元130、显示单元140、摄像头150(可选的)、音频电路160(可选的)、扬声器161(可选的)、麦克风162(可选的)、处理器170、外部接口180、电源190等部件。本领域技术人员可以理解,图3仅仅是终端或多功能设备的举例,并不构成对终端或多功能设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件。
输入单元130可用于接收输入的数字或字符信息,以及产生与该便携式多功能装置的用户设置以及功能控制有关的键信号输入。具体地,输入单元130可包括触摸屏131(可选的)和/或其他输入设备132。该触摸屏131可收集用户在其上或附近的触摸操作(比如用户使用手指、关节、触笔等任何适合的物体在触摸屏上或在触摸屏附近的操作),并根据预先设定的程序驱动相应的连接装置。触摸屏可以检测用户对触摸屏的触摸动作,将该触摸动作转换为触摸信号发送给该处理器170,并能接收该处理器170发来的命令并加以执行;该触摸信号至少包括触点坐标信息。该触摸屏131可以提供该终端100和用户之间的输入界面和输出界面。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触摸屏。除了触摸屏131,输入单元130还可以包括其他输入设备。具体地,其他输入设备132可以包括但不限于物理键盘、功能键(比如音量控制按键132、开关按键133等)、轨迹球、鼠标、操作杆等中的一种或多种。
其中,输入设备132可以接收到图解释相关的参数,例如本申请实施例中的图的信息等等。
该显示单元140可用于显示由用户输入的信息或提供给用户的信息、终端100的各种菜单、交互界面、文件显示和/或任意一种多媒体文件的播放。在本申请实施例中,显示单元140可用于显示图解释类设计应用程序的界面、图解释结果的示意等。
该存储器120可用于存储指令和数据,存储器120可主要包括存储指令区和存储数据区,存储数据区可存储各种数据,如多媒体文件、文本等;存储指令区可存储操作系统、应用、至少一个功能所需的指令等软件单元,或者他们的子集、扩展集。还可以包括非易失性随机存储器;向处理器170提供包括管理计算处理设备中的硬件、软件以及数据资源,支持控制软件和应用。还用于多媒体文件的存储,以及运行程序和应用的存储。
处理器170是终端100的控制中心,利用各种接口和线路连接整个终端100的各个部分,通过运行或执行存储在存储器120内的指令以及调用存储在存储器120内的数据,执行终端100的各种功能和处理数据,从而对终端设备进行整体控制。可选的,处理器170可包括一个或多个处理单元;优选的,处理器170可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器170中。在一些实施例中,处理器、存储器、可以在单一芯片上实现,在一些实施例中,他们也可以在独立的芯片上分别实现。处理器170还可以用于产生相应的操作控制信号,发给计算处理设备相应的部件,读取以及处理软件中的数据,尤其是读取和处理存储器120中的数据和程序,以使其中的各个功能模块执行相应的功能,从而控制相应的部件按指令的要求进行动作。
其中,存储器120可以用于存储图解释方法相关的软件代码,处理器170可以执行芯片的图解释方法的步骤,也可以调度其他单元(例如上述输入单元130以及显示单元140)以实现相应的功能。
该射频单元110(可选的)可用于收发信息或通话过程中信号的接收和发送,例如,将基站的下行信息接收后,给处理器170处理;另外,将设计上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,射频单元110还可以通过无线通信与网络设备和其他设备通信。该无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System of Mobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE)、电子邮件、短消息服务(Short Messaging Service,SMS)等。
其中,在本申请实施例中,该射频单元110可以图的信息等参数发送至服务器200,并接收到服务器200发送的图解释结果。
应理解,该射频单元110为可选的,其可以被替换为其他通信接口,例如可以是网口。
终端100还包括给各个部件供电的电源190(比如电池),优选的,电源可以通过电源管理系统与处理器170逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。
终端100还包括外部接口180,该外部接口可以是标准的Micro USB接口,也可以使多针连接器,可以用于连接终端100与其他装置进行通信,也可以用于连接充电器为终端100充电。
尽管未示出,终端100还可以包括闪光灯、无线保真(wireless fidelity,WiFi)模块、蓝牙模块、不同功能的传感器等,在此不再赘述。下文中描述的部分或全部方法均可以应用在如图3所示的终端100中。
接下来描述图4中服务器200的产品形态;
图4提供了一种服务器200的结构示意图,如图4所示,服务器200包括总线201、处理器202、通信接口203和存储器204。处理器202、存储器204和通信接口203之间通过总线201通信。
总线201可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图4中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
处理器202可以为中央处理器(central processing unit,CPU)、图形处理器(graphics processing unit,GPU)、微处理器(micro processor,MP)或者数字信号处理器(digital signal processor,DSP)等处理器中的任意一种或多种。
存储器204可以包括易失性存储器(volatile memory),例如随机存取存储器(random access memory,RAM)。存储器204还可以包括非易失性存储器(non-volatile memory),例 如只读存储器(read-only memory,ROM),快闪存储器,机械硬盘(hard drive drive,HDD)或固态硬盘(solid state drive,SSD)。
其中,存储器204可以用于存储图解释方法相关的软件代码,处理器202可以执行芯片的图解释方法的步骤,也可以调度其他单元以实现相应的功能。
应理解,上述终端100和服务器200可以为集中式或者是分布式的设备,上述终端100和服务器200中的处理器(例如处理器170以及处理器202)可以为硬件电路(如专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)、通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器等等)、或这些硬件电路的组合,例如,处理器可以为具有执行指令功能的硬件系统,如CPU、DSP等,或者为不具有执行指令功能的硬件系统,如ASIC、FPGA等,或者为上述不具有执行指令功能的硬件系统以及具有执行指令功能的硬件系统的组合。
应理解,本申请实施例中的图解释方法涉及AI相关的运算,在执行AI运算时,终端设备和服务器的指令执行架构不仅仅局限在图3以及图4所示的处理器结合存储器的架构。下面结合图5对本申请实施例提供的系统架构进行详细的介绍。
图5为本申请实施例提供的系统架构示意图。如图5所示,系统架构500包括执行设备510、训练设备520、数据库530、客户设备540、数据存储系统550以及数据采集系统560。
执行设备510包括计算模块511、I/O接口512、预处理模块513和预处理模块514。计算模块511中可以包括目标模型/规则501,预处理模块513和预处理模块514是可选的。
其中,执行设备510可以为上述运行电路设计类应用程序的终端设备或者服务器。
数据采集设备560用于采集训练样本。训练样本可以为对象的属性信息以及对象之间的关系,属性信息可以有多种,以对象为人物为例,具体可以包括但不限于性别,年龄,职业,爱好等,对象还可以为物品,例如应用程序(application,APP),例如APP市场的训练样本中所提取的对象特征可以为,APP的名称(标识),类型,大小等;而电商类APP的训练样本中所提起的对象特征可以为,商品的名称,所属的类别,价格区间等;对象之间的关系可以为亲属关系、经济上的关系(例如股权关联、贸易关联等),标签特征,则是用于表示这个样本是正例还是负例,例如人物是否具备经济风险等等。在采集到训练样本之后,数据采集设备560将这些训练样本存入数据库530。
训练设备520可以基于数据库530中维护训练样本,对待训练的神经网络(例如本申请实施例中的第一神经网络、第二神经网络以及图神经网络等),以得到目标模型/规则501。
需要说明的是,在实际应用中,数据库530中维护的训练样本不一定都来自于数据采集设备560的采集,也有可能是从其他设备接收得到的。另外需要说明的是,训练设备520也不一定完全基于数据库530维护的训练样本进行目标模型/规则501的训练,也有可能从云端或其他地方获取训练样本进行模型训练,上述描述不应该作为对本申请实施例的限定。
根据训练设备520训练得到的目标模型/规则501可以应用于不同的系统或设备中,如应用于图5所示的执行设备510,该执行设备510可以是终端,如手机终端,平板电脑,笔记本电脑,增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备,车载终 端等,还可以是服务器等。
具体的,训练设备520可以将训练后的模型传递至执行设备510。
在图5中,执行设备510配置输入/输出(input/output,I/O)接口512,用于与外部设备进行数据交互,用户可以通过客户设备540向I/O接口512输入数据(例如本申请实施例中的图的信息等)。
预处理模块513和预处理模块514用于根据I/O接口512接收到的输入数据进行预处理。应理解,可以没有预处理模块513和预处理模块514或者只有的一个预处理模块。当不存在预处理模块513和预处理模块514时,可以直接采用计算模块511对输入数据进行处理。
在执行设备510对输入数据进行预处理,或者在执行设备510的计算模块511执行计算等相关的处理过程中,执行设备510可以调用数据存储系统550中的数据、代码等以用于相应的处理,也可以将相应处理得到的数据、指令等存入数据存储系统550中。
最后,I/O接口512将处理结果(例如本申请实施例中图解释结果)提供给客户设备540,从而提供给用户。
在图5所示情况下,用户可以手动给定输入数据,该“手动给定输入数据”可以通过I/O接口512提供的界面进行操作。另一种情况下,客户设备540可以自动地向I/O接口512发送输入数据,如果要求客户设备540自动发送输入数据需要获得用户的授权,则用户可以在客户设备540中设置相应权限。用户可以在客户设备540查看执行设备510输出的结果,具体的呈现形式可以是显示、声音、动作等具体方式。客户设备540也可以作为数据采集端,采集如图所示输入I/O接口512的输入数据及输出I/O接口512的输出结果作为新的样本数据,并存入数据库530。当然,也可以不经过客户设备540进行采集,而是由I/O接口512直接将如图所示输入I/O接口512的输入数据及输出I/O接口512的输出结果,作为新的样本数据存入数据库530。
值得注意的是,图5仅是本申请实施例提供的一种系统架构的示意图,图中所示设备、器件、模块等之间的位置关系不构成任何限制,例如,在图5中,数据存储系统550相对执行设备510是外部存储器,在其它情况下,也可以将数据存储系统550置于执行设备510中。应理解,上述执行设备510可以部署于客户设备540中。
从模型的推理侧来说:
本申请实施例中,上述执行设备520的计算模块511可以获取到数据存储系统550中存储的代码来实现图解释方法。
本申请实施例中,执行设备520的计算模块511可以包括硬件电路(如专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)、通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器等等)、或这些硬件电路的组合,例如,训练设备520可以为具有执行指令功能的硬件系统,如CPU、DSP等,或者为不具有执行指令功能的硬件系统,如ASIC、FPGA等,或者为上述不具有执行指令功能的硬件系统以及具有执行指令功能的硬件系统的组合。
具体的,执行设备520的计算模块511可以为具有执行指令功能的硬件系统,本申请 实施例提供的连接关系预测方法可以为存储在存储器中的软件代码,执行设备520的计算模块511可以从存储器中获取到软件代码,并执行获取到的软件代码来实现本申请实施例提供的图解释方法。
应理解,执行设备520的计算模块511可以为不具有执行指令功能的硬件系统以及具有执行指令功能的硬件系统的组合,本申请实施例提供的图解释方法的部分步骤还可以通过执行设备520的计算模块511中不具有执行指令功能的硬件系统来实现,这里并不限定。
从模型的训练侧来说:
本申请实施例中,上述训练设备520可以获取到存储器(图5中未示出,可以集成于训练设备520或者与训练设备520分离部署)中存储的代码来实现本申请实施例中和模型训练相关的步骤。
本申请实施例中,训练设备520可以包括硬件电路(如专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)、通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器等等)、或这些硬件电路的组合,例如,训练设备520可以为具有执行指令功能的硬件系统,如CPU、DSP等,或者为不具有执行指令功能的硬件系统,如ASIC、FPGA等,或者为上述不具有执行指令功能的硬件系统以及具有执行指令功能的硬件系统的组合。
应理解,训练设备520可以为不具有执行指令功能的硬件系统以及具有执行指令功能的硬件系统的组合,本申请实施例提供的中和模型训练相关的部分步骤还可以通过训练设备520中不具有执行指令功能的硬件系统来实现,这里并不限定。
二、服务器提供的云服务:
在一种可能的实现中,服务器可以通过应用程序编程接口(application programming interface,API)为端侧提供图解释的服务。
其中,终端设备可以通过云端提供的API,将相关参数(例如图的信息等)发送至服务器,服务器可以基于接收到的参数,得到处理结果,并将处理结果(例如图解释结果等)返回至至终端。
关于终端以及服务器的描述可以上述实施例的描述,这里不再赘述。
由于本申请实施例涉及大量神经网络的应用,为了便于理解,下面先对本申请实施例涉及的相关术语及神经网络等相关概念进行介绍。
(1)神经网络
神经网络可以是由神经单元组成的,神经单元可以是指以xs(即输入数据)和截距1为输入的运算单元,该运算单元的输出可以为:
Figure PCTCN2022103117-appb-000001
其中,s=1、2、……n,n为大于1的自然数,Ws为xs的权重,b为神经单元的偏置。f为神经单元的激活函数(activation functions),用于将非线性特性引入神经网络中,来将神经单元中的输入信号转换为输出信号。该激活函数的输出信号可以作为下一层卷积层的输 入,激活函数可以是sigmoid函数。神经网络是将多个上述单一的神经单元联结在一起形成的网络,即一个神经单元的输出可以是另一个神经单元的输入。每个神经单元的输入可以与前一层的局部接受域相连,来提取局部接受域的特征,局部接受域可以是由若干个神经单元组成的区域。
(2)深度神经网络
深度神经网络(Deep Neural Network,DNN),也称多层神经网络,可以理解为具有很多层隐含层的神经网络,这里的“很多”并没有特别的度量标准。从DNN按不同层的位置划分,DNN内部的神经网络可以分为三类:输入层,隐含层,输出层。一般来说第一层是输入层,最后一层是输出层,中间的层数都是隐含层。层与层之间是全连接的,也就是说,第i层的任意一个神经元一定与第i+1层的任意一个神经元相连。虽然DNN看起来很复杂,但是就每一层的工作来说,其实并不复杂,简单来说就是如下线性关系表达式:
Figure PCTCN2022103117-appb-000002
其中,
Figure PCTCN2022103117-appb-000003
是输入向量,
Figure PCTCN2022103117-appb-000004
是输出向量,
Figure PCTCN2022103117-appb-000005
是偏移向量,W是权重矩阵(也称系数),α()是激活函数。每一层仅仅是对输入向量
Figure PCTCN2022103117-appb-000006
经过如此简单的操作得到输出向量
Figure PCTCN2022103117-appb-000007
由于DNN层数多,则系数W和偏移向量
Figure PCTCN2022103117-appb-000008
的数量也就很多了。这些参数在DNN中的定义如下所述:以系数W为例:假设在一个三层的DNN中,第二层的第4个神经元到第三层的第2个神经元的线性系数定义为
Figure PCTCN2022103117-appb-000009
上标3代表系数W所在的层数,而下标对应的是输出的第三层索引2和输入的第二层索引4。总结就是:第L-1层的第k个神经元到第L层的第j个神经元的系数定义为
Figure PCTCN2022103117-appb-000010
需要注意的是,输入层是没有W参数的。在深度神经网络中,更多的隐含层让网络更能够刻画现实世界中的复杂情形。理论上而言,参数越多的模型复杂度越高,“容量”也就越大,也就意味着它能完成更复杂的学习任务。训练深度神经网络的也就是学习权重矩阵的过程,其最终目的是得到训练好的深度神经网络的所有层的权重矩阵(由很多层的向量W形成的权重矩阵)。
(3)图(Graph):
图为包括至少一个节点以及至少一条边的数据结构。在一些场景中,图中的节点可以映射为实体,图中的边可以映射为实体与实体之间的关系。图可以是有向图或无向图。当然,图还可以包括节点以及边以外的其他数据,例如节点的标签以及边的标签等。在一个示例性场景中,应用于好友推荐的场景中,图中的每个节点可以表示一个用户,图中的每条边可以表示不同用户之间的社交关系,图中每个节点的数据为用户的画像数据以及用户的行为数据,例如用户的年龄、职业、爱好、学历等。又如,应用于在商品推荐的场景中,图中的每个节点可以表示一个用户或一个商品,图中的每条边可以表示用户与商品之间的交互关系,例如购买关系、收藏关系等。又如,应用于金融风控的场景中,图中的每个节点可以表示账号、交易或资金。图中的边可以表示资金的流动关系,例如图中的环路可以表示循环转账。再如,应用于网络系统中网元之间连接关系确定的场景中,图中的每个节点可以表示一个网元,例如路由器、交换机、终端等,图中的每条边可以表示不同网元之间的连接关系。
(4)图神经网络(graph neural network,GNN):
GNN是一种带有结构信息的深度学习方法,可以用于计算节点当前的状态。图神经网络的信息传递按照给定的图结构进行,可以根据相邻节点更新每个节点的状态。具体地,其可以根据当前节点的结构图,以神经网络作为点信息的聚合函数,将所有相邻节点的信息传递到当前节点,结合当前节点的状态进行更新。
(5)损失函数
在训练深度神经网络的过程中,因为希望深度神经网络的输出尽可能的接近真正想要预测的值,所以可以通过比较当前网络的预测值和真正想要的目标值,再根据两者之间的差异情况来更新每一层神经网络的权重向量(当然,在第一次更新之前通常会有初始化的过程,即为深度神经网络中的各层预先配置参数),比如,如果网络的预测值高了,就调整权重向量让它预测低一些,不断的调整,直到深度神经网络能够预测出真正想要的目标值或与真正想要的目标值非常接近的值。因此,就需要预先定义“如何比较预测值和目标值之间的差异”,这便是损失函数(loss function)或目标函数(objective function),它们是用于衡量预测值和目标值的差异的重要方程。其中,以损失函数举例,损失函数的输出值(loss)越高表示差异越大,那么深度神经网络的训练就变成了尽可能缩小这个loss的过程。
(6)反向传播算法
卷积神经网络可以采用误差反向传播(back propagation,BP)算法在训练过程中修正初始的超分辨率模型中参数的大小,使得超分辨率模型的重建误差损失越来越小。具体地,前向传递输入信号直至输出会产生误差损失,通过反向传播误差损失信息来更新初始的超分辨率模型中参数,从而使误差损失收敛。反向传播算法是以误差损失为主导的反向传播运动,旨在得到最优的超分辨率模型的参数,例如权重矩阵。
(7)注意力机制(attention mechanism)
注意力机制模仿了生物观察行为的内部过程,即一种将内部经验和外部感觉对齐从而增加部分区域的观察精细度的机制,能够利用有限的注意力资源从大量信息中快速筛选出高价值信息。注意力机制可以快速提取稀疏数据的重要特征,因而被广泛用于自然语言处理任务,特别是机器翻译。而自注意力机制(self-attention mechanism)是注意力机制的改进,其减少了对外部信息的依赖,更擅长捕捉数据或特征的内部相关性。注意力机制的本质思想可以改写为如下公式:
其中,Lx=||Source||代表Source的长度,公式含义即将Source中的构成元素想象成是由一系列的数据对构成,此时给定目标Target中的某个元素Query,通过计算Query和各个Key的相似性或者相关性,得到每个Key对应Value的权重系数,然后对Value进行加权求和,即得到了最终的Attention数值。所以本质上Attention机制是对Source中元素的Value值进行加权求和,而Query和Key用来计算对应Value的权重系数。从概念上理解,把Attention可以理解为从大量信息中有选择地筛选出少量重要信息并聚焦到这些重要信息上,忽略大多不重要的信息。聚焦的过程体现在权重系数的计算上,权重越大越聚焦于其对应的Value值上,即权重代表了信息的重要性,而Value是其对应的信息。自注意力机制可以理解为内部Attention(intra attention),Attention机制发生在Target的元素Query和Source中的所有元素之间,自注意力机制指的是在Source内部元素之间或者Target内部元素之间 发生的Attention机制,也可以理解为Target=Source这种特殊情况下的注意力计算机制,其具体计算过程是一样的,只是计算对象发生了变化而已。
图为包括至少一个节点以及至少一条边的数据结构。在一些场景中,图中的节点可以映射为对象(或者称之为实体),图中的边可以映射为实体与实体之间的关系。图可以是有向图或无向图。当然,图还可以包括节点以及边以外的其他数据,例如节点的标签以及边的标签等。在一个示例性场景中,应用于好友推荐的场景中,图中的每个节点可以表示一个用户,图中的每条边可以表示不同用户之间的社交关系,图中每个节点的数据为用户的画像数据以及用户的行为数据,例如用户的年龄、职业、爱好、学历等。又如,应用于在商品推荐的场景中,图中的每个节点可以表示一个用户或一个商品,图中的每条边可以表示用户与商品之间的交互关系,例如购买关系、收藏关系等。又如,应用于金融风控的场景中,图中的每个节点可以表示账号、交易或资金。
图的解释器用于根据图的信息(例如包括节点的信息以及边的信息)来得到各个节点对于某一节点的状态的影响程度。在现有的实现中,通过基于扰动的解释方法来实现图的解释,该方法的思想是将图的信息输入到用于实现目标任务的图神经网络(graph neural network,GNN)中,目标任务可以用于预测某一个节点的状态,通过对输入的图的信息进行扰动,观察GNN模型的输出,从而确定输入的图的信息中各个节点对GNN模型对预测节点的状态所起到的作用,该作用可以作为对于某一节点的状态的影响程度。
然而,上述方式仅仅能够得到节点对于节点的状态的影响程度,图解释的结果不完整(例如,并不能得到针对于节点之间的边对于节点的状态的影响程度)。
为了解决上述问题,本申请提供了一种模型训练方法,参照图6,图6为本申请实施例提供的一种模型训练方法的实施例示意,如图6示出的那样,本申请实施例提供的一种模型训练方法包括:
601、获取图的信息图的信息,所述图包括多个节点以及节点之间的边,所述图的信息包括节点的信息和边的信息,每个所述节点对应一个对象,所述节点的信息包括对象的属性,所述边的信息包括对象之间的关系。
本申请实施例中,步骤601的执行主体可以为云侧的服务器,服务器可以接收来自终端设备发送的图的信息,进而服务器可以获取到图的信息。
本申请实施例中,步骤601的执行主体可以为终端设备,终端设备可以为便携式移动设备,例如但不限于移动或便携式计算设备(如智能手机)、个人计算机、服务器计算机、手持式设备(例如平板)或膝上型设备、多处理器系统、游戏控制台或控制器、基于微处理器的系统、机顶盒、可编程消费电子产品、移动电话、具有可穿戴或配件形状因子(例如,手表、眼镜、头戴式耳机或耳塞)的移动计算和/或通信设备、网络PC、小型计算机、大型计算机、包括上面的系统或设备中的任何一种的分布式计算环境等等。
为了方便描述,以下不对执行主体的形态进行区分,都描述为训练设备。
其中,针对于待解释的图,可以获取到图的信息,图的信息可以包括多个节点以及节点之间的边,所述图的信息包括节点的信息和边的信息,每个所述节点对应一个对象,所 述节点的信息包括对象的属性,所述边的信息包括对象之间的关系。
其中,以节点对应的对象为人物为例,人物的属性可以为性别、年龄、职业、收入、爱好以及受教育程度中的至少一种,其中,性别可以为男或者女,年龄可以为0-100之间的数字,职业可以为教师、程序员、厨师等等,爱好可以为篮球、网球、跑步等等,受教育程度可以为小学、初中、高中、大学等等;本申请并不限定对象的属性的具体类型。
其中,以节点对应的对象为物品为例,物品可以为实体物品,或者是虚拟物品,例如可以为应用程序(application,APP)、音视频、网页以及新闻资讯等物品,物品的属性可以为物品名称、开发者、安装包大小、品类以及好评度中的至少一种,其中,以物品为应用程序为例,物品的品类可以为聊天类、跑酷类游戏、办公类等等,好评度可以为针对于物品的打分、评论等;本申请并不限定物品的属性的具体类型。
其中,以节点对应的对象为人物为例,对象之间的关系可以为亲属关系、经济上的关系(例如股权关联、贸易关联等)。
在训练时,上述图的信息可以作为要训练的神经网络的输入,此外,还可以获取到训练过程中使用的标签信息(或者称之为真值groundtruth),具体可以和要训练的神经网络中GNN要实现的任务相关,例如,GNN可以用于预测节点对应的对象的状态(例如执行针对于状态的二分类问题),例如,GNN可以预测各个节点对应的对象是否存在经济风险(例如是否会出现还贷能力不足的问题),则标签信息可以指示节点对应的对象实际是否出现经济风险。
602、根据所述图的信息,得到第一特征表示以及第二特征表示,所述第一特征表示为节点的特征表示,所述第二特征表示为边的特征表示。
在一种可能的实现中,可以将图的信息输入到特征提取网络中(在训练的前馈过程中实现),以得到每个节点的第一特征表示以及每个边的第二特征表示。
其中,针对于每个节点,可以将包括节点自身以及附近的节点的信息(例如每个节点的k阶子图的信息,k大于1)输入到特征提取网络中,以得到每个节点的嵌入表示(embedding)。节点的嵌入表示可以包括多个维度(或者称之为通道)的特征。
在一种可能的实现中,可以将每个节点的嵌入表示和节点的信息进行融合(例如进行拼接,得到第一特征表示),该第一特征表示可以作为节点的异构信息。
其中,针对于每个边,可以将边所在的两端的节点的第一特征表示以及其自身的边的信息进行融合,得到边的第二特征表示(也就是边的异构信息)。
通过上述方式,在包含不同类型的节点的异构图中,不同类型的节点对应不同维度的特征,同一维度的特征其含义也可能存在差异。异构图中的边因类型不一,也需要进行有区分的表征。对于节点:本实施例通过将图结构信息(节点的嵌入表示)和原始特征(节点的信息)进行融合的方式,可以得到表示节点异构信息的特征。对于边:本实施例通过提取边所在首尾节点的嵌入表示以及边自身所带属性(边的信息)进行融合表征,可以得到表示边的异构信息的特征。进而实现了异构图中节点和边的准确的异构信息表示。
在一种可能的实现中,上述特征提取网络可以但不限于为多层金字塔模型。嵌入表示 可以为特征向量的形式。
603、根据每个所述节点的第一特征表示,通过第一神经网络,得到第一权重,所述第一权重为节点的权重;所述第一权重用于与对应的第一特征表示进行融合,以得到第三特征表示。
在一种可能的实现中,可以将每个所述节点的第一特征表示输入到第一神经网络中,其中,第一神经网络可以为基于注意力机制的神经网络,第一神经网络可以根据输入的特征表示,得到对应的第一权重(该权重随着网络的更新,而逐渐具备确定的语义含义)。
在一种可能的实现中,针对于不同类型的节点可以使用不同的神经网络(例如参数数值不同的神经网络),针对于每个节点都进行上述步骤的处理,可以得到节点的特征掩膜(该掩膜可以包括每个节点对应的第一权重)。
该第一权重可以与对应的第一特征表示进行融合(例如加权,也就是基于权重的乘积运算),以得到第三特征表示。基于第一权重对第一特征表示进行加权,相当于对第一特征表示施加了扰动,相当于第一神经网络的作用根据第一特征表示来得到施加的扰动的大小,由于输入到后续任务网络(例如GNN)中的输入为施加了扰动后的特征(也就是第三特征表示),随着模型的更新,该扰动会存在着一个趋势:对于网络执行任务的精度影响较大的节点,其第一权重会被赋予的越来越大(也就是干扰会越来越小),对于网络执行任务的精度影响较小的节点,其权重会被赋予的越来越小(也就是干扰会越来越大),进而第一权重就可以表征出节点的影响程度。
在一种可能的实现中,第一特征表示可以包括多个维度的特征,第一权重可以包括针对于每个维度的特征的权重,在融合时,可以各个权重与第一特征表示中对应维度的特征进行加权。
604、根据每个边的第二特征表示,通过第二神经网络,得到第二权重,所述第二权重为边的权重。
在一种可能的实现中,可以将每个边的第二特征表示输入到第二神经网络中,其中,第二神经网络可以为基于注意力机制的神经网络,第二神经网络可以根据输入的特征表示,得到对应的第二权重(该权重随着网络的更新,而逐渐具备确定的语义含义)。
在一种可能的实现中,该第二权重可以输入到后续的任务网络(例如GNN)中,来作为任务网络在处理对应的边的信息时对边施加的权重,例如,任务网络中会存在针对于各个边的权重的设定的参数(通常情况下,默认各个边的权重相同),进而可以将任务网络中针对于各个边的权重的设定的参数设置为对应的第二权重。通过上述方式,相当于对第二特征表示施加了扰动,相当于第二神经网络的作用根据第二特征表示来得到施加的扰动的大小,随着模型的更新,该扰动会存在着一个趋势:对于网络执行任务的精度影响较大的边,其第二权重会被赋予的越来越大(也就是干扰会越来越小),对于网络执行任务的精度影响较小的边,其第二权重会被赋予的越来越小(也就是干扰会越来越大),进而第二权重就可以表征出边的影响程度。
605、根据所述第三特征表示和所述第二权重,通过图神经网络GNN,得到第一损失,所述第一损失用于确定损失函数。
在一种可能的实现中,可以将上述得到的第三特征表示和所述第二权重输入到任务网络(例如GNN)中,得到输出结果(例如,GNN用于实现目标任务,则输出结果为目标任务的执行结果),例如,若目标任务为预测各个节点对应的人物是否存在经济风险,则输出结果可以为各个节点对应的人物的存在经济风险的预测结果。
基于输出结果和图的标签信息,可以得到第一损失(用于表示输出结果和标签信息之间的差异),进而可以基于第一损失来确定损失函数。
在一种可能的实现中,上述第一权重可以表示出对应的节点对于所述GNN在执行所述目标任务时的正向影响程度,然而,在一种实现中,该节点的第一权重被设置的较大时,网络的处理精度较高,而该节点的第一权重被设置的较小时,网络的处理精度仍然较高,或者下降的很少,则该节点的影响程度依然很低,因此,仅通过一个维度的权重(例如正向影响程度)并不能准确的表征出节点的实际影响程度。本申请实施例中,通过多个维度的权重来参数模型的前馈过程,来准确的表征出节点的实际影响程度。
在一种可能的实现中,可以根据所述第一权重,获取第三权重,所述第三权重为节点的权重,所述第三权重为对应的节点对于所述GNN在执行所述目标任务时的反向影响程度;所述第三权重用于与对应的第一特征表示进行融合,以得到第四特征表示;根据所述第四特征表示,通过图神经网络GNN,得到第二损失,所述第二损失用于确定所述损失函数。例如,在第一权重较大,第三权重较小时,第一损失可以表示该节点的权重较大时对应模型的精度,第二损失可以表示该节点的权重较小时对应模型的精度,若该节点的第一权重被设置的较大时,网络的处理精度较高,而该节点的第一权重被设置的较小时,网络的处理精度仍然较高,或者下降的很少,则随着模型的更新,第一权重会逐渐变小,进而可以更准确的描述出节点的实际影响程度,提高了网络的精度。
在一种可能的实现中,所述第一权重表示为小于1的正数,所述第三权重与对应的第一权重的加和为1。例如,第一权重为0.9,第三权重为0.1。
在一种可能的实现中,上述第一权重可以称之为节点的正掩膜,第三权重可以称之为节点的负掩膜。
类似的,针对于边,也可以通过上述正负掩膜的方式构建损失函数,例如,所述GNN用于执行目标任务,所述第二权重指示对应的边对于所述GNN在执行所述目标任务时的正向影响程度,可以根据所述第二权重,获取第四权重,所述第四权重为边的权重,所述第四权重指示对应的边对于所述GNN在执行所述目标任务时的反向影响程度;根据所述第四权重,通过图神经网络GNN,得到第三损失,所述第三损失用于确定所述损失函数。
在一种可能的实现中,所述第一权重表示为小于1的正数,所述第四权重与对应的第二权重的加和为1。
接下来介绍一个损失函数的具体示例:损失函数可以包括三部分:
(1)施加掩膜,对模型分类正确性的影响;
(2)施加负掩膜对模型分类正确性的影响;
(3)掩膜的方差。
其中,(1)(2)的共同作用使得优化朝生成有利于GNN模型预测的掩膜更新,重要的节点和边会分配更多的权重,无关的特征和边的权重不断降低,因果关系不断增强。
(3)的作用是为了增加掩膜的方差,让掩膜对节点和边有更好的区分度,提高解释质量。损失函数的具体表示可以如图7所示。其中,masked pred表示施加掩膜后,GNN模型的预测结果。
Figure PCTCN2022103117-appb-000011
表示施加负掩膜后,GNN模型的预测结果。var表示求方差的函数。
606、根据所述损失函数,更新所述第一注意力网络、所述第二注意力网络以及所述GNN。
在训练时,通过优化损失函数,反向传播更新解释器(第一神经网络、第二神经网格)。
推理时,如图8所示,可以输入待解释节点所在的k阶子图,通过特征提取和第一神经网络以及第二神经网络的前向计算,可以得到特征掩膜和边掩膜,分别作为节点特征的解释和边的解释。
接下来使用风控领域的模拟数据,验证解释本申请实施例的效果和性能。
其中,节点类型主要有法人和客户,边的类型有五种:包括持卡人,股权关联等。预测模型为异构图转换器(Heterogeneous Graph Transformer,HGT),作用是预测客户是否为高风险客户(是否存在债项违约风险)。的基本要求是提供预测为高风险客户的特征维度和关系维度的解释。在模型训练的过程中,可以执行如下步骤:
(1)从数据中提取节点所在的子图和对应标签,作为输入
(2)提取异构信息,生成feature inputs和edge inputs。
(3)将(2)中的feature inputs和edge inputs输入对应的特征注意力网络和边注意力网络,计算得到特征掩膜和边掩膜,进而得到基于正掩膜的new features.根据正掩膜计算负的掩膜,得到对应的负的边掩膜和new features.
(4)根据(3)的输出,分别输入HGT预测模型,进行推理预测。根据损失函数计算loss,反向传播更新解释器的参数。
重复(1)~(4)直到模型收敛或循环次数达到预设的步长。
(5)使用训练完成的解释器进行推理,得到对应高风险客户的解释。
图9为上述实施例的解释效果展示。深灰色节点表示预测为高风险的客户,浅灰色表示正常客户。
如图9所示,对预测为高风险的客户1给出特征维度和关系维度解释。特征维度的解释体现发现客户1的年龄、累计发放金额,行为评分这三个特征对预测客户1为高风险作用最大,关系维度的解释体现在客户1和高风险的法人4之间存在股权关联关系,从而导致客户1为高风险。从解释效率上来看,GNNexplainer生成单样本解释需要4-7s,而本发明生成单样本解释的时间是10ms。
如表1所示,本申请实施例设计了异构信息提取模块,通过设置注意力网络生成特征 掩膜和边掩膜,设置基于因果增强的损失函数来优化解释器,解释器的训练是基于所有训练数据,保证解释是局部最佳global optimal的。训练完成的解释器生成解释时不需要重训练,解释耗时少效率高。
表1
Figure PCTCN2022103117-appb-000012
如表2所示,本发明与现有方法在公开数据集上的性能对比。可以看出,本发明解释的准确度均大幅高于现有方法,平均单样例解释时间平均提高5倍。
表2
Figure PCTCN2022103117-appb-000013
本申请实施例提供了一种模型训练方法,所述方法包括:获取图的信息图的信息,所述图包括多个节点以及节点之间的边,所述图的信息包括节点的信息和边的信息,每个所述节点对应一个对象,所述节点的信息包括对象的属性,所述边的信息包括对象之间的关系;根据所述图的信息,得到第一特征表示以及第二特征表示,所述第一特征表示为节点的特征表示,所述第二特征表示为边的特征表示;根据每个所述节点的第一特征表示,通过第一神经网络,得到第一权重,所述第一权重为节点的权重;所述第一权重用于与对应的第一特征表示进行融合,以得到第三特征表示;根据每个边的第二特征表示,通过第二神经网络,得到第二权重,所述第二权重为边的权重;根据所述第三特征表示和所述第二权重,通过图神经网络GNN,得到第一损失,所述第一损失用于确定损失函数;根据所述损失函数,更新所述第一注意力网络、所述第二注意力网络以及所述GNN。
该第一权重可以与对应的第一特征表示进行融合,相当于对第一特征表示施加了扰动,相当于第一神经网络的作用根据第一特征表示来得到施加的扰动的大小,由于输入到后续任务网络(例如GNN)中的输入为施加了扰动后的特征(也就是第三特征表示),随着模型的更新,该扰动会存在着一个趋势:对于网络执行任务的精度影响较大的节点,其第一 权重会被赋予的越来越大(也就是干扰会越来越小),对于网络执行任务的精度影响较小的节点,其权重会被赋予的越来越小(也就是干扰会越来越大),进而第一权重就可以表征出节点的影响程度。类似的,该第二权重可以输入到后续的任务网络(例如GNN)中,来作为任务网络在处理对应的边的信息时对边施加的权重,例如,任务网络中会存在针对于各个边的权重的设定的参数(通常情况下,默认各个边的权重相同),进而可以将任务网络中针对于各个边的权重的设定的参数设置为对应的第二权重。通过上述方式,相当于对第二特征表示施加了扰动,相当于第二神经网络的作用根据第二特征表示来得到施加的扰动的大小,随着模型的更新,该扰动会存在着一个趋势:对于网络执行任务的精度影响较大的边,其第二权重会被赋予的越来越大(也就是干扰会越来越小),对于网络执行任务的精度影响较小的边,其第二权重会被赋予的越来越小(也就是干扰会越来越大),进而第二权重就可以表征出边的影响程度。
通过上述方式训练得到的第一神经网络和第二神经网络可以作为图的解释器来判断各个节点以及节点之间关系的重要程度,相当于可以得到相比现有技术更完整的图解释结果。
以上从模型训练的角度对推荐方法进行了介绍,接下来从模型的推理角度介绍本申请实施例提供的一种数据处理方法:
参照图10,图10为本申请实施例提供的一种数据处理方法的流程示意,如图10所示,本申请实施例提供的一种数据处理方法包括:
1001、获取图的信息,所述图的信息包括多个节点以及节点之间的边,所述图的信息包括节点的信息和边的信息,每个所述节点对应一个对象,所述节点的信息包括对象的属性,所述边的信息包括对象之间的关系;
关于步骤1001的具体描述,可以参照上述实施例中步骤601的介绍,这里不再赘述。
1002、根据所述图的信息,得到第一特征表示以及第二特征表示,所述第一特征表示为节点的特征表示,所述第二特征表示为边的特征表示;
关于步骤1002的具体描述,可以参照上述实施例中步骤602的介绍,这里不再赘述。
1003、根据每个所述节点的第一特征表示,通过第一神经网络,得到第一权重,所述第一权重为节点的权重;所述第一权重用于表示对应的节点在所述图中的重要程度;
其中,第一神经网络可以为通过图6对应的模型训练方法得到的。
1004、根据每个边的第二特征表示,通过第二神经网络,得到第二权重,所述第二权重为边的权重;所述第二权重用于表示对应的边在所述图中的重要程度。
其中,第二神经网络可以为通过图6对应的模型训练方法得到的。
在一种可能的实现中,所述第一特征表示包括通过特征网络得到的节点的嵌入表示(embedding)以及对应的节点的信息;或者,
所述第二特征表示包括边两端的节点的第一特征表示以及对应的边的信息。
在一种可能的实现中,所述第一特征表示包括多个维度的特征,所述第一权重包括每个所述维度的特征对应的权重;或者,
所述第二特征表示包括多个维度的特征,所述第二权重包括每个所述维度的特征对应 的权重。
在一种可能的实现中,所述第一神经网络或所述第二神经网络为基于注意力机制的神经网络。
参照图11,图11为本申请实施例提供的一种模型训练装置的结构示意,如图11所示,本申请实施例提供的一种模型训练装置1100包括:
获取模块1101,用于获取图的信息图的信息,所述图包括多个节点以及节点之间的边,所述图的信息包括节点的信息和边的信息,每个所述节点对应一个对象,所述节点的信息包括对象的属性,所述边的信息包括对象之间的关系;
其中,关于获取模块1101的具体介绍可以参照上述实施例中步骤601的描述,这里不再赘述。
处理模块1102,用于根据所述图的信息,得到第一特征表示以及第二特征表示,所述第一特征表示为节点的特征表示,所述第二特征表示为边的特征表示;
其中,关于处理模块1102的具体介绍可以参照上述实施例中步骤602至步骤605的描述,这里不再赘述。
根据每个所述节点的第一特征表示,通过第一神经网络,得到第一权重,所述第一权重为节点的权重;所述第一权重用于与对应的第一特征表示进行融合,以得到第三特征表示;
根据每个边的第二特征表示,通过第二神经网络,得到第二权重,所述第二权重为边的权重;
根据所述第三特征表示和所述第二权重,通过图神经网络GNN,得到第一损失,所述第一损失用于确定损失函数;
模型更新模块1103,用于根据所述损失函数,更新所述第一注意力网络、所述第二注意力网络以及所述GNN。
其中,关于模型更新模块1103的具体介绍可以参照上述实施例中步骤606的描述,这里不再赘述。
通过上述方式训练得到的第一神经网络和第二神经网络可以作为图的解释器来判断各个节点以及节点之间关系的重要程度,相当于可以得到相比现有技术更完整的图解释结果。
在一种可能的实现中,所述GNN用于执行目标任务,所述第一权重为对应的节点对于所述GNN在执行所述目标任务时的正向影响程度,所述获取模块,还用于:
根据所述第一权重,获取第三权重,所述第三权重为节点的权重,所述第三权重为对应的节点对于所述GNN在执行所述目标任务时的反向影响程度;所述第三权重用于与对应的第一特征表示进行融合,以得到第四特征表示;
所述处理模块,还用于:根据所述第四特征表示,通过图神经网络GNN,得到第二损失,所述第二损失用于确定所述损失函数。
在一种可能的实现中,所述第一权重表示为小于1的正数,所述第三权重与对应的第一权重的加和为1。
在一种可能的实现中,所述GNN用于执行目标任务,所述第二权重指示对应的边对于所述GNN在执行所述目标任务时的正向影响程度,所述获取模块,还用于:
根据所述第二权重,获取第四权重,所述第四权重为边的权重,所述第四权重指示对应的边对于所述GNN在执行所述目标任务时的反向影响程度;
所述处理模块,还用于:根据所述第四权重,通过图神经网络GNN,得到第三损失,所述第三损失用于确定所述损失函数。
在一种可能的实现中,所述第一权重表示为小于1的正数,所述第四权重与对应的第二权重的加和为1。
在一种可能的实现中,所述第一特征表示包括通过特征网络得到的节点的嵌入表示(embedding)以及对应的节点的信息;或者,
所述第二特征表示包括边两端的节点的嵌入表示以及所述边的信息。
在一种可能的实现中,所述第一特征表示包括多个维度的特征,所述第一权重包括每个所述维度的特征对应的权重;或者,
所述第二特征表示包括多个维度的特征,所述第二权重包括每个所述维度的特征对应的权重。
在一种可能的实现中,所述第一神经网络或所述第二神经网络为基于注意力机制的神经网络。
在一种可能的实现中,所述融合,包括:
加权。
在一种可能的实现中,所述对象为人物,不同节点对应于不同的人物,所述边指示所述人物之间的亲属关系或经济关系,所述GNN用于根据所述图的信息,预测至少一个所述人物是否存在经济风险。
参照图12,图12为本申请实施例提供一种数据处理装置的结构示意,如图12所示,本申请实施例的数据处理装置1200,包括:
获取模块1201,用于获取图的信息,所述图的信息包括多个节点以及节点之间的边,所述图的信息包括节点的信息和边的信息,每个所述节点对应一个对象,所述节点的信息包括对象的属性,所述边的信息包括对象之间的关系;
其中,关于获取模块1201的具体描述可以参照上述实施例中步骤1001的介绍,这里不再赘述。
处理模块1202,用于根据所述图的信息,得到第一特征表示以及第二特征表示,所述第一特征表示为节点的特征表示,所述第二特征表示为边的特征表示;
根据每个所述节点的第一特征表示,通过第一神经网络,得到第一权重,所述第一权重为节点的权重;所述第一权重用于表示对应的节点在所述图中的重要程度;
根据每个边的第二特征表示,通过第二神经网络,得到第二权重,所述第二权重为边的权重;所述第二权重用于表示对应的边在所述图中的重要程度。
其中,关于获取模块1202的具体描述可以参照上述实施例中步骤1002至步骤1004的介绍,这里不再赘述。
在一种可能的实现中,所述第一特征表示包括通过特征网络得到的节点的嵌入表示(embedding)以及对应的节点的信息;或者,
所述第二特征表示包括边两端的节点的第一特征表示以及对应的边的信息。
在一种可能的实现中,所述第一特征表示包括多个维度的特征,所述第一权重包括每个所述维度的特征对应的权重;或者,
所述第二特征表示包括多个维度的特征,所述第二权重包括每个所述维度的特征对应的权重。
在一种可能的实现中,所述第一神经网络或所述第二神经网络为基于注意力机制的神经网络。
接下来介绍本申请实施例提供的一种执行设备,请参阅图13,图13为本申请实施例提供的执行设备的一种结构示意图,执行设备1300具体可以表现为手机、平板、笔记本电脑、智能穿戴设备、服务器等,此处不做限定。其中,执行设备1300上可以部署有图12对应实施例中所描述的推荐装置,用于实现图10对应实施例中推荐方法的功能。具体的,执行设备1300包括:接收器1301、发射器1302、处理器1303和存储器1304(其中执行设备1300中的处理器1303的数量可以一个或多个),其中,处理器1303可以包括应用处理器13031和通信处理器13032。在本申请的一些实施例中,接收器1301、发射器1302、处理器1303和存储器1304可通过总线或其它方式连接。
存储器1304可以包括只读存储器和随机存取存储器,并向处理器1303提供指令和数据。存储器1304的一部分还可以包括非易失性随机存取存储器(non-volatile random access memory,NVRAM)。存储器1304存储有处理器和操作指令、可执行模块或者数据结构,或者它们的子集,或者它们的扩展集,其中,操作指令可包括各种操作指令,用于实现各种操作。
处理器1303控制执行设备的操作。具体的应用中,执行设备的各个组件通过总线系统耦合在一起,其中总线系统除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都称为总线系统。
上述本申请实施例揭示的方法可以应用于处理器1303中,或者由处理器1303实现。 处理器1303可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器1303中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器1303可以是通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器、以及视觉处理器(vision processing unit,VPU)、张量处理器(tensor processing unit,TPU)等适用于AI运算的处理器,还可进一步包括专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。该处理器1303可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器1304,处理器1303读取存储器1304中的信息,结合其硬件完成上述实施例中步骤1001至步骤1004的步骤。
接收器1301可用于接收输入的数字或字符信息,以及产生与执行设备的相关设置以及功能控制有关的信号输入。发射器1302可用于通过第一接口输出数字或字符信息;发射器1302还可用于通过第一接口向磁盘组发送指令,以修改磁盘组中的数据;发射器1302还可以包括显示屏等显示设备。
本申请实施例还提供了一种训练设备,请参阅图14,图14是本申请实施例提供的训练设备一种结构示意图,具体的,训练设备1400由一个或多个服务器实现,训练设备1400可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)1414(例如,一个或一个以上处理器)和存储器1432,一个或一个以上存储应用程序1442或数据1444的存储介质1430(例如一个或一个以上海量存储设备)。其中,存储器1432和存储介质1430可以是短暂存储或持久存储。存储在存储介质1430的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对训练设备中的一系列指令操作。更进一步地,中央处理器1414可以设置为与存储介质1430通信,在训练设备1400上执行存储介质1430中的一系列指令操作。
训练设备1400还可以包括一个或一个以上电源1426,一个或一个以上有线或无线网络接口1450,一个或一个以上输入输出接口1458;或,一个或一个以上操作系统1441,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。
具体的,训练设备可以进行上述实施例中步骤601至步骤606的步骤。
本申请实施例中还提供一种包括计算机程序产品,当其在计算机上运行时,使得计算机执行如前述执行设备所执行的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。
本申请实施例中还提供一种计算机可读存储介质,该计算机可读存储介质中存储有用于进行信号处理的程序,当其在计算机上运行时,使得计算机执行如前述执行设备所执行 的步骤,或者,使得计算机执行如前述训练设备所执行的步骤。
本申请实施例提供的执行设备、训练设备或终端设备具体可以为芯片,芯片包括:处理单元和通信单元,所述处理单元例如可以是处理器,所述通信单元例如可以是输入/输出接口、管脚或电路等。该处理单元可执行存储单元存储的计算机执行指令,以使执行设备内的芯片执行上述实施例描述的数据处理方法,或者,以使训练设备内的芯片执行上述实施例描述的数据处理方法。可选地,所述存储单元为所述芯片内的存储单元,如寄存器、缓存等,所述存储单元还可以是所述无线接入设备端内的位于所述芯片外部的存储单元,如只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)等。
具体的,请参阅图15,图15为本申请实施例提供的芯片的一种结构示意图,所述芯片可以表现为神经网络处理器NPU1500,NPU 1500作为协处理器挂载到主CPU(Host CPU)上,由Host CPU分配任务。NPU的核心部分为运算电路1503,通过控制器1504控制运算电路1503提取存储器中的矩阵数据并进行乘法运算。
NPU 1500可以通过内部的各个器件之间的相互配合,来实现图6所描述的实施例中提供的模型训练方法以及图10所描述的实施例中提供的数据处理方法。
更具体的,在一些实现中,NPU 1500中的运算电路1503内部包括多个处理单元(Process Engine,PE)。在一些实现中,运算电路1503是二维脉动阵列。运算电路1503还可以是一维脉动阵列或者能够执行例如乘法和加法这样的数学运算的其它电子线路。在一些实现中,运算电路1503是通用的矩阵处理器。
举例来说,假设有输入矩阵A,权重矩阵B,输出矩阵C。运算电路从权重存储器1502中取矩阵B相应的数据,并缓存在运算电路中每一个PE上。运算电路从输入存储器1501中取矩阵A数据与矩阵B进行矩阵运算,得到的矩阵的部分结果或最终结果,保存在累加器(accumulator)1508中。
统一存储器1506用于存放输入数据以及输出数据。权重数据直接通过存储单元访问控制器(Direct Memory Access Controller,DMAC)1505,DMAC被搬运到权重存储器1502中。输入数据也通过DMAC被搬运到统一存储器1506中。
BIU为Bus Interface Unit即,总线接口单元1510,用于AXI总线与DMAC和取指存储器(Instruction Fetch Buffer,IFB)1509的交互。
总线接口单元1510(Bus Interface Unit,简称BIU),用于取指存储器1509从外部存储器获取指令,还用于存储单元访问控制器1505从外部存储器获取输入矩阵A或者权重矩阵B的原数据。
DMAC主要用于将外部存储器DDR中的输入数据搬运到统一存储器1506或将权重数据搬运到权重存储器1502中或将输入数据数据搬运到输入存储器1501中。
向量计算单元1507包括多个运算处理单元,在需要的情况下,对运算电路1503的输出做进一步处理,如向量乘,向量加,指数运算,对数运算,大小比较等等。主要用于神经网络中非卷积/全连接层网络计算,如Batch Normalization(批归一化),像素级求和,对特 征平面进行上采样等。
在一些实现中,向量计算单元1507能将经处理的输出的向量存储到统一存储器1506。例如,向量计算单元1507可以将线性函数;或,非线性函数应用到运算电路1503的输出,例如对卷积层提取的特征平面进行线性插值,再例如累加值的向量,用以生成激活值。在一些实现中,向量计算单元1507生成归一化的值、像素级求和的值,或二者均有。在一些实现中,处理过的输出的向量能够用作到运算电路1503的激活输入,例如用于在神经网络中的后续层中的使用。
控制器1504连接的取指存储器(instruction fetch buffer)1509,用于存储控制器1504使用的指令;
统一存储器1506,输入存储器1501,权重存储器1502以及取指存储器1509均为On-Chip存储器。外部存储器私有于该NPU硬件架构。
其中,上述任一处提到的处理器,可以是一个通用中央处理器,微处理器,ASIC,或一个或多个用于控制上述程序执行的集成电路。
另外需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本申请提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件的方式来实现,当然也可以通过专用硬件包括专用集成电路、专用CPU、专用存储器、专用元器件等来实现。一般情况下,凡由计算机程序完成的功能都可以很容易地用相应的硬件来实现,而且,用来实现同一功能的具体硬件结构也可以是多种多样的,例如模拟电路、数字电路或专用电路等。但是,对本申请而言更多情况下软件程序实现是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘、U盘、移动硬盘、ROM、RAM、磁碟或者光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,训练设备,或者网络设备等)执行本申请各个实施例所述的方法。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、训练设备或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向 另一个网站站点、计算机、训练设备或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的训练设备、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(Solid State Disk,SSD))等。

Claims (23)

  1. 一种模型训练方法,其特征在于,所述方法包括:
    获取图的信息,所述图包括多个节点以及节点之间的边,所述图的信息包括节点的信息和边的信息,每个所述节点对应一个对象,所述节点的信息包括对象的属性,所述边的信息包括对象之间的关系;
    根据所述图的信息,得到第一特征表示以及第二特征表示,所述第一特征表示为节点的特征表示,所述第二特征表示为边的特征表示;
    根据每个所述节点的第一特征表示,通过第一神经网络,得到第一权重,所述第一权重为节点的权重;所述第一权重用于与对应的第一特征表示进行融合,以得到第三特征表示;
    根据每个边的第二特征表示,通过第二神经网络,得到第二权重,所述第二权重为边的权重;
    根据所述第三特征表示和所述第二权重,通过图神经网络GNN,得到第一损失,所述第一损失用于确定损失函数;
    根据所述损失函数,更新所述第一注意力网络、所述第二注意力网络以及所述GNN。
  2. 根据权利要求1所述的方法,其特征在于,所述GNN用于执行目标任务,所述第一权重为对应的节点对于所述GNN在执行所述目标任务时的正向影响程度,所述方法还包括:
    根据所述第一权重,获取第三权重,所述第三权重为节点的权重,所述第三权重为对应的节点对于所述GNN在执行所述目标任务时的反向影响程度;所述第三权重用于与对应的第一特征表示进行融合,以得到第四特征表示;
    根据所述第四特征表示,通过图神经网络GNN,得到第二损失,所述第二损失用于确定所述损失函数。
  3. 根据权利要求2所述的方法,其特征在于,所述第一权重表示为小于1的正数,所述第三权重与对应的第一权重的加和为1。
  4. 根据权利要求1至3任一所述的方法,其特征在于,所述GNN用于执行目标任务,所述第二权重指示对应的边对于所述GNN在执行所述目标任务时的正向影响程度,所述方法还包括:
    根据所述第二权重,获取第四权重,所述第四权重为边的权重,所述第四权重指示对应的边对于所述GNN在执行所述目标任务时的反向影响程度;
    根据所述第四权重,通过图神经网络GNN,得到第三损失,所述第三损失用于确定所述损失函数。
  5. 根据权利要求4所述的方法,其特征在于,所述第一权重表示为小于1的正数,所 述第四权重与对应的第二权重的加和为1。
  6. 根据权利要求1至5任一所述的方法,其特征在于,
    所述第一特征表示包括通过特征网络得到的节点的嵌入表示(embedding)以及对应的节点的信息;或者,
    所述第二特征表示包括边两端的节点的第一特征表示以及对应的边的信息。
  7. 根据权利要求1至6任一所述的方法,其特征在于,所述第一特征表示包括多个维度的特征,所述第一权重包括每个所述维度的特征对应的权重;或者,
    所述第二特征表示包括多个维度的特征,所述第二权重包括每个所述维度的特征对应的权重。
  8. 根据权利要求1至7任一所述的方法,其特征在于,所述第一神经网络或所述第二神经网络为基于注意力机制的神经网络。
  9. 根据权利要求1至8任一所述的方法,其特征在于,所述融合,包括:
    加权。
  10. 根据权利要求1至9任一所述的方法,其特征在于,所述对象为人物,不同节点对应于不同的人物,所述边指示所述人物之间的亲属关系或经济关系,所述GNN用于根据所述图的信息,预测至少一个所述人物是否存在经济风险。
  11. 一种模型训练装置,其特征在于,所述装置包括:
    获取模块,用于获取图的信息图的信息,所述图包括多个节点以及节点之间的边,所述图的信息包括节点的信息和边的信息,每个所述节点对应一个对象,所述节点的信息包括对象的属性,所述边的信息包括对象之间的关系;
    处理模块,用于根据所述图的信息,得到第一特征表示以及第二特征表示,所述第一特征表示为节点的特征表示,所述第二特征表示为边的特征表示;
    根据每个所述节点的第一特征表示,通过第一神经网络,得到第一权重,所述第一权重为节点的权重;所述第一权重用于与对应的第一特征表示进行融合,以得到第三特征表示;
    根据每个边的第二特征表示,通过第二神经网络,得到第二权重,所述第二权重为边的权重第二权重,所述第二权重为边的权重;
    根据所述第三特征表示和所述第二权重,通过图神经网络GNN,得到第一损失,所述第一损失用于确定损失函数;
    模型更新模块,用于根据所述损失函数,更新所述第一注意力网络、所述第二注意力网络以及所述GNN。
  12. 根据权利要求11所述的装置,其特征在于,所述GNN用于执行目标任务,所述第一权重为对应的节点对于所述GNN在执行所述目标任务时的正向影响程度,所述获取模块,还用于:
    根据所述第一权重,获取第三权重,所述第三权重为节点的权重,所述第三权重为对应的节点对于所述GNN在执行所述目标任务时的反向影响程度;所述第三权重用于与对应的第一特征表示进行融合,以得到第四特征表示;
    所述处理模块,还用于:根据所述第四特征表示,通过图神经网络GNN,得到第二损失,所述第二损失用于确定所述损失函数。
  13. 根据权利要求12所述的装置,其特征在于,所述第一权重表示为小于1的正数,所述第三权重与对应的第一权重的加和为1。
  14. 根据权利要求11至13任一所述的装置,其特征在于,所述GNN用于执行目标任务,所述第二权重指示对应的边对于所述GNN在执行所述目标任务时的正向影响程度,所述获取模块,还用于:
    根据所述第二权重,获取第四权重,所述第四权重为边的权重,所述第四权重指示对应的边对于所述GNN在执行所述目标任务时的反向影响程度;
    所述处理模块,还用于:根据所述第四权重,通过图神经网络GNN,得到第三损失,所述第三损失用于确定所述损失函数。
  15. 根据权利要求14所述的装置,其特征在于,所述第一权重表示为小于1的正数,所述第四权重与对应的第二权重的加和为1。
  16. 根据权利要求11至15任一所述的装置,其特征在于,
    所述第一特征表示包括通过特征网络得到的节点的嵌入表示(embedding)以及对应的节点的信息;或者,
    所述第二特征表示包括边两端的节点的嵌入表示以及所述边的信息。
  17. 根据权利要求11至16任一所述的装置,其特征在于,所述第一特征表示包括多个维度的特征,所述第一权重包括每个所述维度的特征对应的权重;或者,
    所述第二特征表示包括多个维度的特征,所述第二权重包括每个所述维度的特征对应的权重。
  18. 根据权利要求11至17任一所述的装置,其特征在于,所述第一神经网络或所述第二神经网络为基于注意力机制的神经网络。
  19. 根据权利要求11至18任一所述的装置,其特征在于,所述融合,包括:
    加权。
  20. 根据权利要求11至19任一所述的装置,其特征在于,所述对象为人物,不同节点对应于不同的人物,所述边指示所述人物之间的亲属关系或经济关系,所述GNN用于根据所述图的信息,预测至少一个所述人物是否存在经济风险。
  21. 一种计算设备,其特征在于,所述计算设备包括存储器和处理器;所述存储器存储有代码,所述处理器被配置为获取所述代码,并执行如权利要求1至10任一所述的方法。
  22. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有一个或多个指令,所述指令在由一个或多个计算机执行时使得所述一个或多个计算机实施权利要求1至10任一所述的方法。
  23. 一种计算机程序产品,包括代码,其特征在于,在所述代码被执行时用于实现如权利要求1至10任一所述的方法。
PCT/CN2022/103117 2022-06-30 2022-06-30 一种模型训练方法以及相关设备 WO2024000512A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/103117 WO2024000512A1 (zh) 2022-06-30 2022-06-30 一种模型训练方法以及相关设备

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/103117 WO2024000512A1 (zh) 2022-06-30 2022-06-30 一种模型训练方法以及相关设备

Publications (1)

Publication Number Publication Date
WO2024000512A1 true WO2024000512A1 (zh) 2024-01-04

Family

ID=89383844

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/103117 WO2024000512A1 (zh) 2022-06-30 2022-06-30 一种模型训练方法以及相关设备

Country Status (1)

Country Link
WO (1) WO2024000512A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200380342A1 (en) * 2019-05-31 2020-12-03 XNOR.ai, Inc. Neural network wiring discovery
CN113850381A (zh) * 2021-09-15 2021-12-28 支付宝(杭州)信息技术有限公司 一种图神经网络训练方法及装置
CN113989574A (zh) * 2021-11-04 2022-01-28 中国科学技术大学 图像解释方法、图像解释装置、电子设备和存储介质
CN114637923A (zh) * 2022-05-19 2022-06-17 之江实验室 基于层次注意力图神经网络的数据信息推荐方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200380342A1 (en) * 2019-05-31 2020-12-03 XNOR.ai, Inc. Neural network wiring discovery
CN113850381A (zh) * 2021-09-15 2021-12-28 支付宝(杭州)信息技术有限公司 一种图神经网络训练方法及装置
CN113989574A (zh) * 2021-11-04 2022-01-28 中国科学技术大学 图像解释方法、图像解释装置、电子设备和存储介质
CN114637923A (zh) * 2022-05-19 2022-06-17 之江实验室 基于层次注意力图神经网络的数据信息推荐方法和装置

Similar Documents

Publication Publication Date Title
WO2021047593A1 (zh) 推荐模型的训练方法、预测选择概率的方法及装置
US20210012198A1 (en) Method for training deep neural network and apparatus
WO2022022274A1 (zh) 一种模型训练方法及装置
WO2024041479A1 (zh) 一种数据处理方法及其装置
WO2023217127A1 (zh) 一种因果关系确定方法及相关设备
WO2022179586A1 (zh) 一种模型训练方法及其相关联设备
WO2023185925A1 (zh) 一种数据处理方法及相关装置
WO2024002167A1 (zh) 一种操作预测方法及相关装置
WO2024083121A1 (zh) 一种数据处理方法及其装置
WO2023207487A1 (zh) 一种电路走线确定方法及相关设备
WO2021127982A1 (zh) 语音情感识别方法、智能装置和计算机可读存储介质
WO2024041483A1 (zh) 一种推荐方法及相关装置
CN112529149A (zh) 一种数据处理方法及相关装置
CN115879508A (zh) 一种数据处理方法及相关装置
CN115238909A (zh) 一种基于联邦学习的数据价值评估方法及其相关设备
WO2024046473A1 (zh) 一种数据处理方法及其装置
WO2024017282A1 (zh) 一种数据处理方法及其装置
WO2023246735A1 (zh) 一种项目推荐方法及其相关设备
WO2024000512A1 (zh) 一种模型训练方法以及相关设备
CN116843022A (zh) 一种数据处理方法及相关装置
CN116883715A (zh) 一种数据处理方法及其装置
CN116308640A (zh) 一种推荐方法及相关装置
CN116204709A (zh) 一种数据处理方法及相关装置
CN115618065A (zh) 一种数据处理方法及相关设备
WO2023050143A1 (zh) 一种推荐模型训练方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22948614

Country of ref document: EP

Kind code of ref document: A1