Open source component link prediction method and device, electronic equipment and storage medium

Through the neural network model and knowledge graph technology, the attribute feature vectors of open source components are extracted and a dependency graph is generated, which solves the problem of low efficiency of open source component dependency management in the existing technology and achieves more efficient component management and maintenance.

CN118535205APending Publication Date: 2024-08-23CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410581449.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-11
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

The existing technology lacks an effective link prediction method to manage and maintain the dependencies of large-scale open source components, resulting in low developer efficiency.

Method used

The open source component link prediction method based on the neural network model is used to obtain the attribute information of the component to be predicted, extract the feature vector, and use the pre-built knowledge graph to train the dependency prediction model to generate a dependency graph that represents the components.

Benefits of technology

It improves the management and maintenance efficiency of open source components and helps developers better understand and manage the relationships between open source components by generating accurate dependency graphs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535205A
    Figure CN118535205A
Patent Text Reader

Abstract

The invention discloses an open source component link prediction method and device, electronic equipment and a storage medium, which are used for solving the problem that a developer is low in open source component management and maintenance efficiency, and the method comprises the following steps: responding to an open source component link prediction request; obtaining attribute information of a to-be-predicted open source component, and performing feature extraction on the attribute information of the to-be-predicted open source component to obtain an attribute feature vector of the to-be-predicted open source component; and inputting the attribute feature vector of the open source component to be predicted into the trained dependency relationship prediction model to obtain a dependency relationship prediction result, the dependency relationship prediction model is obtained by training based on a preset neural network model according to attribute information of sample open source components extracted from a constructed first knowledge graph representing the dependency relationship between the open source components and the dependency relationship between the sample open source components; and according to the attribute information of the to-be-predicted open source components and the dependency relationship prediction result, generating a second knowledge graph correspondingly representing the dependency relationship between the to-be-predicted open source components.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network security technology, and in particular to an open source component link prediction method, device, electronic device and storage medium. Background Art

[0002] Open source components are third-party components that can be used in software application development. Developers can use open source components to speed up the development process and reduce development costs. In the open source field, there are usually close dependencies between different software application development projects. This dependency is crucial for developers, as it allows them to clearly know which projects are completed by relying on their own open source components, and which other open source components their own projects rely on.

[0003] However, there is currently a lack of relevant technologies for applying link prediction technology to the field of network security, especially for the prediction of large-scale open source component dependencies, which leads to low efficiency for developers to manage and maintain open source components. Summary of the invention

[0004] In order to solve the problem of low efficiency in developers' management and maintenance of open source components, the embodiments of the present application provide an open source component link prediction method, device, electronic device and storage medium.

[0005] In a first aspect, an embodiment of the present application provides an open source component link prediction method, including:

[0006] Responding to open source component link prediction requests;

[0007] Acquiring attribute information of the open source component to be predicted, and performing feature extraction on the attribute information of the open source component to be predicted to obtain an attribute feature vector of the open source component to be predicted;

[0008] Inputting the attribute feature vector of the open source component to be predicted into the trained dependency prediction model to obtain a dependency prediction result, wherein the dependency prediction model is obtained by training based on a preset neural network model according to the attribute information of the sample open source component extracted from the first knowledge graph that characterizes the dependency relationship between the open source components and the dependency relationship between the sample open source components;

[0009] A corresponding second knowledge graph representing the dependency relationships between the open source components to be predicted is generated according to the attribute information of the open source components to be predicted and the dependency prediction results.

[0010] In one implementation, feature extraction is performed on the attribute information of the open source component to be predicted to obtain the attribute feature vector of the open source component to be predicted, specifically including:

[0011] The attribute information of the open source component to be predicted is represented by feature dimensionality reduction according to a preset word embedding model to obtain an attribute feature vector of the open source component to be predicted.

[0012] In one embodiment, the dependency relationship prediction model is obtained by training in the following manner:

[0013] Sampling the open source components included in the first knowledge graph to obtain sampled open source components;

[0014] Extracting open source components with dependencies from the sampled open source components as positive sample open source components, and extracting open source components without dependencies as negative sample open source components;

[0015] Building a sampling knowledge graph based on the sampled open source components;

[0016] Generate an adjacency matrix corresponding to the sampled knowledge graph according to the weight of the dependency relationship between every two sampled open source components;

[0017] According to the attribute information of the positive sample open source component, the attribute information of the negative sample open source component and the adjacency matrix corresponding to the sampled knowledge graph, the dependency relationship prediction model is obtained by training based on the preset neural network model.

[0018] In one embodiment, according to the attribute information of the positive sample open source component, the attribute information of the negative sample open source component and the adjacency matrix corresponding to the sampled knowledge graph, the dependency relationship prediction model is obtained by training based on the preset neural network model, specifically including:

[0019] Respectively perform feature dimension reduction representation on the attribute information of each positive sample open source component and each negative sample open source component according to the preset word embedding model to obtain an attribute feature vector of each positive sample open source component and an attribute feature vector of each negative sample open source component;

[0020] Generate an attribute feature vector matrix of the sample open source components according to the attribute feature vectors of each positive sample open source component and the attribute feature vectors of each negative sample open source component;

[0021] The preset neural network model is trained according to the attribute feature vector matrix of the sample open source component and the adjacency matrix corresponding to the sampled knowledge graph to obtain the dependency prediction model.

[0022] In one embodiment, after constructing a sampled knowledge graph according to the sampled open source components, the method further includes:

[0023] Obtaining topological structure information of the first knowledge graph and attribute feature vectors of open source components in the first knowledge graph; and

[0024] Obtaining topological structure information of the sampled knowledge graph and attribute feature vectors of the sampled open source components;

[0025] Performing a t hypothesis test on the topological structure information of the first knowledge graph and the topological structure information of the sampled knowledge graph; and

[0026] Performing a t hypothesis test on the attribute feature vectors of the open source components in the first knowledge graph and the attribute feature vectors of the sampled open source components;

[0027] If it is determined that any t hypothesis test fails, resampling is performed.

[0028] In one embodiment, the topological structure information includes at least one of the following information: degree distribution information, clustering coefficient information and diameter information, wherein the degree distribution represents the distribution of the number of edges connected to each node in the knowledge graph, the clustering coefficient represents the degree of clustering between each node in the knowledge graph, and the diameter represents the number of edges contained in the maximum path in the knowledge graph.

[0029] In a second aspect, an embodiment of the present application provides an open source component link prediction device, including:

[0030] A response unit, configured to respond to an open source component link prediction request;

[0031] A feature extraction unit, used to obtain attribute information of the open source component to be predicted, and perform feature extraction on the attribute information of the open source component to be predicted to obtain an attribute feature vector of the open source component to be predicted;

[0032] A prediction unit, configured to input the attribute feature vector of the open source component to be predicted into a trained dependency prediction model to obtain a dependency prediction result, wherein the dependency prediction model is obtained by training based on a preset neural network model according to the attribute information of the sample open source component extracted from a pre-built first knowledge graph representing the dependency relationship between the open source components and the dependency relationship between the sample open source components;

[0033] A generating unit is used to generate a corresponding second knowledge graph representing the dependency relationship between the open source components to be predicted according to the attribute information of the open source components to be predicted and the dependency prediction result.

[0034] In one implementation, the feature extraction unit is specifically configured to perform feature dimension reduction representation on the attribute information of the open source component to be predicted according to a preset word embedding model to obtain an attribute feature vector of the open source component to be predicted.

[0035] In one embodiment, the prediction unit is specifically used to train and obtain the dependency prediction model in the following manner: sampling the open source components contained in the first knowledge graph to obtain sampled open source components; extracting open source components with dependencies as positive sample open source components and open source components without dependencies as negative sample open source components from the sampled open source components; constructing a sampled knowledge graph based on the sampled open source components; generating an adjacency matrix corresponding to the sampled knowledge graph based on the weight of the dependency between every two sampled open source components; and obtaining the dependency prediction model by training based on the preset neural network model according to the attribute information of the positive sample open source components, the attribute information of the negative sample open source components and the adjacency matrix corresponding to the sampled knowledge graph.

[0036] In one embodiment, the prediction unit is specifically used to perform feature dimensionality reduction representation on the attribute information of each positive sample open source component and each negative sample open source component according to the preset word embedding model, so as to obtain the attribute feature vector of each positive sample open source component and the attribute feature vector of each negative sample open source component; generate the attribute feature vector matrix of the sample open source component according to the attribute feature vector matrix of each positive sample open source component and the attribute feature vector of each negative sample open source component; train the preset neural network model according to the attribute feature vector matrix of the sample open source component and the adjacency matrix corresponding to the sampled knowledge graph, so as to obtain the dependency prediction model.

[0037] In one embodiment, the device further comprises:

[0038] A first acquisition unit is used to acquire topological structure information of the first knowledge graph and attribute feature vectors of the open source components in the first knowledge graph after constructing the sampled knowledge graph according to the sampled open source components;

[0039] A second acquisition unit is used to acquire the topological structure information of the sampled knowledge graph and the attribute feature vector of the sampled open source component;

[0040] A first testing unit, used to perform a t hypothesis test on the topological structure information of the first knowledge graph and the topological structure information of the sampled knowledge graph;

[0041] A second testing unit, configured to perform a t hypothesis test on the attribute feature vectors of the open source components in the first knowledge graph and the attribute feature vectors of the sampled open source components;

[0042] The sampling unit is used to resample if any t hypothesis test is determined to fail.

[0043] In one embodiment, the topological structure information includes at least one of the following information: degree distribution information, clustering coefficient information and diameter information, wherein the degree distribution represents the distribution of the number of edges connected to each node in the knowledge graph, the clustering coefficient represents the degree of clustering between each node in the knowledge graph, and the diameter represents the number of edges contained in the maximum path in the knowledge graph.

[0044] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the open source component link prediction method described in the present application when executing the program.

[0045] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, which, when executed by a processor, implements the steps in the open source component link prediction method described in the present application.

[0046] The beneficial effects of this application are as follows:

[0047] The open source component link prediction method, device, electronic device and storage medium provided in the embodiments of the present application obtain attribute information of the open source component to be predicted in response to an open source component link prediction request, and perform feature extraction on the attribute information of the open source component to be predicted to obtain an attribute feature vector of the open source component to be predicted, and input the attribute feature vector of the open source component to be predicted into a dependency prediction model to obtain a dependency prediction result, wherein the dependency prediction model is obtained by training based on a preset neural network model according to the attribute information of the sample open source components extracted from a pre-constructed first knowledge graph representing the dependency relationship between the open source components and the dependency relationship between the sample open source components, and then, a corresponding second knowledge graph representing the dependency relationship between the open source components to be predicted is generated according to the attribute information of the open source components to be predicted and the dependency prediction result. In an embodiment of the present application, a dependency prediction model is trained based on a preset neural network model based on the attribute information of sample open source components and the dependency relationships between sample open source components extracted from a first knowledge graph constructed to characterize the dependency relationships between open source components. The dependency relationships of the open source components to be predicted are predicted based on the extracted attribute feature vectors and the trained dependency prediction model to obtain dependency prediction results. A corresponding second knowledge graph is generated based on the attribute information of the open source components to be predicted and the dependency prediction results. The second knowledge graph includes links of the dependency relationships between the open source components to be predicted. Therefore, developers can manage and maintain open source components more efficiently through the predicted open source component links.

[0048] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0050] Figure 1 A schematic diagram of an application scenario of the open source component link prediction method provided in an embodiment of the present application;

[0051] Figure 2 A schematic diagram of the implementation process of the open source component link prediction method provided in the embodiment of the present application;

[0052] Figure 3 A schematic diagram of the training process of the dependency prediction model provided in the embodiment of the present application;

[0053] Figure 4 A schematic diagram of the implementation process of performing t-hypothesis verification on the topological structure information of the first knowledge graph and the sampled knowledge graph and the attribute feature vector of the open source component provided in the embodiment of the present application;

[0054] Figure 5 An example diagram of the second knowledge graph provided in the embodiment of the present application;

[0055] Figure 6 A schematic diagram of the structure of an open source component link prediction device provided in an embodiment of the present application;

[0056] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0057] In order to solve the problem of low efficiency in developers' management and maintenance of open source components, the embodiments of the present application provide an open source component link prediction method, device, electronic device and storage medium.

[0058] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.

[0059] First reference Figure 1, which is a schematic diagram of an application scenario of the open source component link prediction method provided in an embodiment of the present application, and may include a terminal 101 and a server 102. The server 102 responds to an open source component link prediction request sent by a user (which may be a developer) through the terminal 101. The server obtains the attribute information of the open source component to be predicted, and performs feature extraction on the attribute information of the open source component to be predicted to obtain the attribute feature vector of the open source component to be predicted. The attribute feature vector of the open source component to be predicted is input into a dependency prediction model to obtain a dependency prediction result, wherein the dependency prediction model is obtained by training based on a preset neural network model according to the attribute information of the sample open source component extracted from a pre-constructed first knowledge graph representing the dependency relationship between the open source components and the dependency relationship between the sample open source components. Furthermore, the server 102 generates a corresponding second knowledge graph representing the dependency relationship between the open source components to be predicted according to the attribute information of the open source component to be predicted and the dependency prediction result, and returns the generated second knowledge graph to the terminal 101 for the user to view.

[0060] The server 102 may be an independent physical server or a cloud server that provides basic cloud computing services such as cloud servers, cloud databases, and cloud storage. The terminal 101 may be, but is not limited to, a smart phone, a tablet computer, a laptop computer, a desktop computer, etc. The server 102 and the terminal 101 may be connected via a network, which is not limited in the present embodiment.

[0061] Based on the above application scenarios, the following will refer to the attached Figures 2 to 5 The exemplary embodiments of the present application are described in more detail. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principle of the present application, and the implementation of the present application is not limited in any way. On the contrary, the implementation of the present application can be applied to any applicable scenario.

[0062] like Figure 2 As shown, it is a schematic diagram of the implementation process of the open source component link prediction method provided in an embodiment of the present application. The open source component link prediction method can be applied to the above-mentioned server 102, and specifically may include the following steps:

[0063] S21. Respond to the open source component link prediction request.

[0064] During specific implementation, the server receives an open source component link prediction request sent by the terminal. The open source component link prediction request may carry attribute information of the open source component to be predicted. The attribute information of the open source component includes description information of the open source component, which may include text attribute information and digital attribute information, wherein the text attribute may include but is not limited to at least one of the following information: open source component name information, version number information, developer information and license information, etc. The digital attribute information may include but is not limited to the release date information of the open source component, which is not limited in the embodiments of the present application. The release date information of the open source component can be used as a timestamp to identify the release time of the open source component. The open source components to be predicted may be a group of newly developed open source components, or a group of historical open source components, or a combination of newly developed open source components and historical open source components, which is not limited in the embodiments of the present application.

[0065] In one embodiment, the server may also locally store a list of correspondences between the identification information of the open source components and the attribute information of the open source components. The open source component link prediction may also carry the identification information of the open source components to be predicted instead of the attribute information of the open source components to be predicted. The server may search for the attribute information of the open source components corresponding to the identification information of each open source component to be predicted from the list of correspondences between the identification information of the local open source components and the attribute information of the open source components based on the identification information of the open source components to be predicted.

[0066] S22: Acquire attribute information of the open source component to be predicted, and perform feature extraction on the attribute information of the open source component to be predicted to obtain an attribute feature vector of the open source component to be predicted.

[0067] In specific implementation, when the open source component link prediction request received by the server carries the attribute information of the open source component to be predicted, the attribute information of each open source component to be predicted can be extracted from the open source component link prediction request; when the open source component link prediction request received by the server carries the identification information of the open source component to be predicted, the attribute information of the open source component corresponding to the identification information of each open source component to be predicted can be determined according to the correspondence between the identification information of the open source component and the attribute information of the open source component.

[0068] After obtaining the attribute information of the open source component to be predicted, for each attribute information of the open source component to be predicted, the attribute information of the open source component to be predicted is represented by feature dimensionality reduction according to a preset word embedding model to obtain an attribute feature vector of the open source component to be predicted.

[0069] Specifically, for the attribute information of each open source component to be predicted, the text attribute information and the digital attribute information of the open source component to be predicted can be spliced ​​and input into the preset word embedding model for feature dimensionality reduction representation to obtain the attribute feature vector of the open source component to be predicted of a set length after dimensionality reduction, wherein the preset word embedding model can be but is not limited to the Word2Vec model, GloVe (Global Vectors for Word Representation, global vector word embedding) model, etc., and the set length can be set to 16 bits or 32 bits, which is not limited in the embodiments of the present application. After obtaining the attribute feature vectors of all open source components to be predicted, the attribute feature vectors of all open source components to be predicted are combined into a feature vector matrix: (a1, a2, a3, …, a n ), where n represents the number of open source components to be predicted, a1~a n Represents the attribute feature vector of the open source components 1 to n to be predicted.

[0070] In an embodiment of the present application, word embedding technology is used to reduce the attribute information of the open source component to a low-dimensional vector space for feature extraction, which can save computing resources and improve link prediction efficiency.

[0071] S23. Input the attribute feature vector of the open source component to be predicted into the trained dependency prediction model to obtain a dependency prediction result.

[0072] In specific implementation, the dependency prediction model is obtained by training based on a preset neural network model based on the attribute information of sample open source components and the dependencies between sample open source components extracted from a pre-built first knowledge graph that characterizes the dependencies between open source components. The dependency prediction model is used to predict the dependencies between open source components.

[0073] During implementation, a knowledge graph representing the dependencies between open source components is pre-constructed, which can be recorded as a first knowledge graph. In the knowledge graph representing the dependencies between open source components, the attribute information of the open source components is used as a node, and the dependency between two adjacent nodes, that is, the dependency between two open source components with dependencies, is used as an edge between two adjacent nodes. In an embodiment of the present application, the attribute information of the public open source components and the dependencies between the open source components can be obtained from the Maven central database, and a first knowledge graph is constructed based on the obtained attribute information of the open source components and the dependencies between the open source components, wherein the dependency types may include but are not limited to: compile, test, runtime, provided, system, etc., and the software development stage may include three stages: compile, test, and runtime. Each dependency type represents a different combination of effective range and dependency transfer, and the specific definition is shown in Table 1:

[0074]

[0075]

[0076] Different dependency types correspond to valid ranges. Taking the open source component spring-core in Table 1 as an example, the dependency type compile means that the open source component will be used in the three development stages of software development: compile, test, and runtime.

[0077] Furthermore, the attribute information of the sample open source components and the dependency relationship between the sample open source components can be extracted from the constructed first knowledge graph, and a dependency relationship prediction model can be obtained by training based on a preset neural network model.

[0078] Specifically, by Figure 3 The process shown in the figure is used to train and obtain a dependency prediction model, which may include the following steps:

[0079] S31. Sampling the open source components included in the first knowledge graph to obtain sampled open source components.

[0080] In an embodiment of the present application, since the data scale of the constructed first knowledge graph is large, when training the dependency prediction model, if the data in the entire first knowledge graph is used, the computing requirements are high. Therefore, the open source components in the first knowledge graph can be sampled first to obtain sampled open source components.

[0081] In specific implementation, the following sampling algorithms may be used, but are not limited to, to sample the open source components contained in the first knowledge graph: random sampling algorithm, weighted random sampling algorithm, roulette wheel selection algorithm, etc., which are not limited in the embodiments of the present application. The embodiment of the present application uses the roulette wheel selection algorithm as an example to sample the open source components, and uses the degree of each open source component (i.e., node) in the first knowledge graph as the fitness value of the corresponding open source component. The open source components in the first knowledge graph are sampled according to the fitness function to obtain the sampled open source components. The larger the fitness value, the higher the probability of being selected, where the degree of an open source component refers to the number of edges connected to the open source component (node).

[0082] S32. Extract open source components with dependencies from the sampled open source components as positive sample open source components, and open source components without dependencies as negative sample open source components.

[0083] In specific implementation, in order to evaluate the model effect, the sampled open source components can be divided into training sets and data sets according to the set ratio based on the dependencies, that is, the number of edges. For example, the open source components containing 80% of the edges can be used as the training set, and the remaining open source components containing 20% ​​of the edges can be used as the test set.

[0084] During implementation, the sampled open source components with dependencies in the training set are taken as positive sample open source components, and the sampled open source components without dependencies in the training set are taken as negative sample open source components. For example, assuming that there is a dependency relationship (i.e., edge) C between open source component A and open source component B, then A, B, and the dependency relationship C between A and B are taken as a group of positive samples. If there is no dependency relationship between open source component A and open source component B, then A and B are taken as a group of negative samples. To ensure the accuracy of the model, pairs of open source components that are unlikely to have dependencies in real scenarios can be selected as negative samples, such as two open source components with completely unrelated functions.

[0085] S33. Build a sampling knowledge graph based on the sampled open source components.

[0086] In specific implementation, a sampling knowledge graph is constructed based on the attribute information of the sampled open source components in the training set and the dependencies between the sampled open source components.

[0087] In one embodiment, in order to ensure that the sampled open source components can represent the information and structure of the overall first knowledge graph, after sampling the open source components contained in the first knowledge graph to obtain the sampled open source components and constructing the sampled knowledge graph, a t hypothesis test can be performed on the topological structure information of the first knowledge graph and the topological structure information of the sampled knowledge graph, as well as a t hypothesis test on the attribute feature vectors of the open source components in the first knowledge graph and the attribute feature vectors of the sampled open source components, so as to determine whether the sampled open source components can represent the information and structural characteristics of the overall first knowledge graph. If the t hypothesis test passes, the sampled open source components can be used to train the dependency prediction model. Otherwise, re-sampling is performed until the t hypothesis test passes.

[0088] Specifically, you can follow the following Figure 4 The process shown performs a t-hypothesis check on the first knowledge graph, the topological structure information of the adopted knowledge graph, and the attribute feature vector of the open source component, including the following steps:

[0089] S41. Obtain topological structure information of the first knowledge graph and attribute feature vectors of open source components in the first knowledge graph.

[0090] In specific implementations, the topological structure information includes at least one of the following information: degree distribution information, clustering coefficient information and diameter information. The degree distribution represents the distribution of the number of edges connected to each node in the knowledge graph, the clustering coefficient represents the degree of clustering between each node in the knowledge graph, and the diameter represents the number of edges contained in the maximum path in the knowledge graph.

[0091] In this step, the distribution of the number of edges connected to each open source component in the first knowledge graph can be counted. For example, the distribution of the number of edges connected to each open source component in the first knowledge graph is: 0, 1, 2, 3, 5, 6, ..., m, where the maximum number of edges connected to a certain open source component is m. The clustering coefficient (such as the overall clustering coefficient) of the first knowledge graph and the number of edges contained in the maximum path can also be counted. Among them, the clustering coefficient mainly describes the characteristics of the knowledge graph. Some nodes in the first knowledge graph are connected in pairs. Two connected nodes are also called adjacent points. Then, there are many triangles in the first knowledge graph, and the corresponding three nodes are connected in pairs to form closed three-point groups. In addition, it also includes open three-point groups, that is, three nodes connected by two edges (i.e., triangles with one edge missing). The two types of three-point groups constitute all connected three-point groups. The overall clustering coefficient of the first knowledge graph is obtained by calculating the ratio of the number of all closed three-point groups in the first knowledge graph to the total number of all connected three-point groups (the sum of the number of closed three-point groups and the number of open three-point groups).

[0092] The preset word embedding model in step S22 is used to perform dimensionality reduction representation on the attribute information of each open source component in the first knowledge graph to obtain the attribute feature vector of each open source component in the first knowledge graph, and the attribute feature vectors of all open source components in the first knowledge graph are combined into a corresponding feature vector matrix.

[0093] S42. Obtain the topological structure information of the sampled knowledge graph and the attribute feature vectors of the sampled open source components.

[0094] In specific implementation, the distribution of the number of edges connected to each sampled open source component in the sampled knowledge graph can be counted, and the clustering coefficient of the sampled knowledge graph and the number of edges contained in the maximum path can also be counted.

[0095] The preset word embedding model in step S22 is used to perform dimensionality reduction representation on the attribute information of each sampled open source component in the sampled knowledge graph to obtain the attribute feature vector of each sampled open source component in the sampled knowledge graph, and the attribute feature vectors of all sampled open source components in the sampled knowledge graph are combined into a corresponding feature vector matrix.

[0096] S43. Perform a t hypothesis test on the topological structure information of the first knowledge graph and the topological structure information of the sampled knowledge graph.

[0097] During specific implementation, the t hypothesis test can be performed on the topological structure information of any first knowledge graph and the topological structure information of the sampled knowledge graph, or the t hypothesis test can be performed on the topological structure information of multiple first knowledge graphs and the topological structure information of the sampled knowledge graphs respectively, which is not limited to the embodiments of the present application.

[0098] Specifically, a t hypothesis test can be performed on the degree distribution information of the first knowledge graph and the degree distribution information of the sampled knowledge graph to determine whether the calculated p-value is less than a preset threshold; a t hypothesis test can also be performed on the clustering coefficient information of the first knowledge graph and the clustering coefficient information of the sampled knowledge graph to determine whether the calculated p-value is less than a preset threshold; a t hypothesis test can also be performed on the diameter information of the first knowledge graph and the diameter information of the sampled knowledge graph to determine whether the calculated p-value is less than a preset threshold, where the preset threshold can be set to 0.05.

[0099] The t hypothesis test may also be performed on any two of the above three types of topological structure information, or the t hypothesis test may be performed on all three types of topological structure information, which is not limited in the embodiment of the present application.

[0100] S44. Perform a t hypothesis test on the attribute feature vectors of the open source components in the first knowledge graph and the attribute feature vectors of the sampled open source components.

[0101] In specific implementation, a t hypothesis test is performed on the feature vector matrix corresponding to the attribute feature vector of the open source component in the first knowledge graph and the feature vector matrix corresponding to the attribute feature vector of the sampled open source component to determine whether the calculated p-value is less than a preset threshold.

[0102] S45. If it is determined that any t hypothesis test fails, re-sampling is performed.

[0103] In specific implementation, if it is determined that the corresponding p-value calculated by any topological structure information and attribute feature vector participating in the t hypothesis test is greater than or equal to a preset threshold, it is determined that the sampled open source component cannot represent the information and structural characteristics of the entire first knowledge graph, it is determined that the t hypothesis test has not passed, and the open source components in the first knowledge graph are re-sampled; if it is determined that the corresponding p-values ​​calculated by the topological structure information and attribute feature vector participating in the t hypothesis test are both less than the preset threshold, it is determined that the sampled open source component can represent the information and structural characteristics of the entire first knowledge graph, it is determined that the t hypothesis test has passed, and the sampled open source component is used to train the dependency prediction model.

[0104] S34. Generate an adjacency matrix corresponding to the sampled knowledge graph according to the weight of the dependency relationship between every two sampled open source components.

[0105] In the knowledge graph, the adjacency matrix represents the matrix of adjacent relationships between nodes. In the embodiment of the present application, corresponding weights are set in advance for the dependency relationships between open source components according to the types of dependency relationships, and the adjacency matrix corresponding to the sampled knowledge graph is represented by a matrix composed of the weights of the dependency relationships between every two adopted open source components in the sampled knowledge graph.

[0106] Specifically, when setting the weight of the dependency, it can be set according to the importance of the type of dependency. For example, the weight of the dependency that is comepile and the weight of the dependency that is system can be set to 1, that is: complile =W system = 1, set the dependency to provided and runtime circles are both 0.8, that is: W provided =W runtime =0.8, and set the weight of the dependency test to 0.5, that is: W test =0.5, which is not limited in the present embodiment. Assuming that the sampled knowledge graph contains M sampled open source components, the adjacency matrix of the sampled knowledge graph is an M×M matrix:

[0107]

[0108] Among them, W 11represents the weight of the dependency between the sampled open source component 1 and itself, W 12 represents the weight of the dependency relationship between the sampled open source component 1 and the sampled open source component 2, and so on. 1M represents the weight of the dependency relationship between the sampled open source component 1 and the sampled open source component M; W 21 The weight of the dependency between the sampled open source component 2 and the sampled open source component 1, W 22 represents the weight of the dependency relationship between the sampled open source component 2 and itself, and so on. 2M W represents the weight of the dependency relationship between the sampled open source component 2 and the sampled open source component M; M1 represents the weight of the dependency between the sampled open source component M and the sampled open source component 1, W M2 represents the weight of the dependency relationship between the sampled open source component M and the sampled open source component 2, and so on. MM The weight of the dependency relationship between the sampled open source component M and itself. The weight of the dependency relationship between each sampled open source component and itself can be set to 0, that is: W 11 =W 22 =W MM =0, for any two sampled open source components, if there is no dependency between them, the weight of the dependency between them is set to -1. If one of the two sampled open source components depends on the other sampled open source component, but the other way around, the weight of the dependency between the sampled open source components without dependency is set to 0. For example, if the dependency between sampled open source component 1 and sampled open source component 2 is test, then W 12 = 0.5, and the sampled open source component 2 does not depend on the sampled open source component 1, then W 21 = 0, there is no dependency between the sampled open source component 2 and the sampled open source component 3, and there is no dependency between the sampled open source component 3 and the sampled open source component 2, then W 23 =W 32 =-1.

[0109] S35. According to the attribute information of the positive sample open source components, the attribute information of the negative sample open source components and the adjacency matrix corresponding to the sampled knowledge graph, training is performed based on a preset neural network model to obtain a dependency prediction model.

[0110] In specific implementation, the dependency relationship prediction model can be trained according to the following steps:

[0111] Step 1: Perform feature dimensionality reduction on the attribute information of each positive sample open source component and each negative sample open source component according to a preset word embedding model to obtain an attribute feature vector of each positive sample open source component and an attribute feature vector of each negative sample open source component.

[0112] In specific implementation, the preset word embedding model in step S22 is used to perform feature dimension reduction representation on the attribute information of each positive sample open source component and each negative sample open source component to obtain the attribute feature vector of each positive sample open source component and the attribute feature vector of each negative sample open source component.

[0113] Step 2: Generate an attribute feature vector matrix of the sample open source components based on the attribute feature vectors of each positive sample open source component and the attribute feature vectors of each negative sample open source component.

[0114] In specific implementation, the attribute feature vectors of all positive sample open source components and the attribute feature vectors of all negative sample open source components are combined into a corresponding feature vector matrix, that is, the attribute feature vector matrix of the sample open source components.

[0115] Step 3: Train the preset neural network model based on the attribute feature vector matrix of the sample open source component and the adjacency matrix corresponding to the sampled knowledge graph to obtain a dependency prediction model.

[0116] During specific implementation, the preset neural network model may adopt a graph neural network model, which may be, but is not limited to, the following models: GCN (Graph Convolutional Network) model, GraphSAGE (Graph Sample and Aggregate) model, GAT (Graph Attention Networks) model, etc.

[0117] During training, the attribute feature vector matrix of the sample open source components and the adjacency matrix corresponding to the sampled knowledge graph are input into the preset neural network model to predict the dependency relationship between each two sample open source components. According to the error between the actual dependency relationship between each two sample open source components and the predicted dependency relationship between each two sample open source components, the parameters of the preset graph neural network model are iteratively optimized until the preset graph neural network model converges to obtain the dependency prediction model. Then, the trained dependency prediction model is used to predict the dependency relationship between the open source components in the test set, and the predicted dependency relationship is compared with the actual dependency relationship. Evaluation indicators such as recall rate, precision rate and F1 value are calculated to evaluate the trained dependency model.

[0118] In an embodiment of the present application, when conducting a dependency prediction model, the type of dependency between open source components is taken into consideration for the first time, and the dependency is weighted according to the type of dependency. A corresponding adjacency matrix is ​​generated according to the weights of the dependency between different sampled open source components in the sampled knowledge graph. The dependency prediction model is trained in combination with the attribute feature vectors of the sample open source components, thereby improving the accuracy of the dependency prediction model.

[0119] After extracting features from the attribute information of the open source component to be predicted to obtain the attribute feature vector of the open source component to be predicted, and forming the attribute feature vector matrix corresponding to the open source component to be predicted by combining all the attribute feature vectors of the open source components to be predicted, the feature vector matrix corresponding to the open source component to be predicted is input into the trained dependency prediction model to obtain the dependency prediction results between different predicted open source components. The dependency prediction results include two categories: the existence of dependency and the type of dependency, and the non-existence of dependency.

[0120] S24. Generate a corresponding second knowledge graph representing the dependency relationships between the open source components to be predicted based on the attribute information of the open source components to be predicted and the dependency prediction results.

[0121] In the specific implementation, a second knowledge graph representing the dependency relationship between the open source components to be predicted is constructed according to the attribute information of the open source components to be predicted and the dependency relationship prediction results between the open source components to be predicted, wherein the attribute information of the open source components to be predicted is used as the node, and the dependency relationship between different open source components to be predicted is used as the edge, and the link relationship of the open source components to be predicted is composed of each node and edge.

[0122] like Figure 5 As shown, it is an example diagram of the constructed second knowledge graph. Assume that the open source components to be predicted include A1~A11, A1 depends on A2, such as: the dependency relationship between A1 and A2 is: test, A3~A7 and A9 all depend on A1, such as: the dependency relationship between A3 and A1 is: compile, the dependency relationship between A4 and A1 is: runtime, and other dependencies are no longer listed one by one. A9 and A10 both depend on A4, and A11 has no dependency relationship with A1~A10.

[0123] The open source component link prediction method provided in the embodiment of the present application obtains the attribute information of the open source component to be predicted in response to the open source component link prediction request, and performs feature extraction on the attribute information of the open source component to be predicted to obtain the attribute feature vector of the open source component to be predicted, and inputs the attribute feature vector of the open source component to be predicted into the dependency prediction model to obtain the dependency prediction result, wherein the dependency prediction model is obtained by training based on a preset neural network model according to the attribute information of the sample open source components extracted from the pre-constructed first knowledge graph representing the dependency relationship between the open source components and the dependency relationship between the sample open source components, and then, generates a corresponding second knowledge graph representing the dependency relationship between the open source components to be predicted according to the attribute information of the open source components to be predicted and the dependency prediction result. The embodiment of the present application proposes to perform open source component link prediction based on a massive open source component dependency knowledge graph, and train a dependency prediction model based on a preset neural network model based on the attribute information of sample open source components and the dependency relationships between sample open source components extracted from a first knowledge graph that characterizes the dependency relationships between open source components. The dependency relationships of the open source components to be predicted are predicted based on the extracted attribute feature vectors and the trained dependency prediction model to obtain dependency prediction results, and then a corresponding second knowledge graph is generated based on the attribute information of the open source components to be predicted and the dependency prediction results. The second knowledge graph includes the links of the dependency relationships between the open source components to be predicted, so that developers can manage and maintain the open source components more efficiently through the predicted open source component links.

[0124] Based on the same inventive concept, an embodiment of the present application also provides an open source component link prediction device. Since the principle of solving the problem by the above-mentioned open source component link prediction device is similar to the above-mentioned open source component link prediction method, the implementation of the above-mentioned device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0125] like Figure 6 As shown, it is a schematic diagram of the structure of the open source component link prediction device provided in an embodiment of the present application, which may include:

[0126] A response unit 51, configured to respond to an open source component link prediction request;

[0127] A feature extraction unit 52 is used to obtain attribute information of the open source component to be predicted, and perform feature extraction on the attribute information of the open source component to be predicted to obtain an attribute feature vector of the open source component to be predicted;

[0128] A prediction unit 53 is used to input the attribute feature vector of the open source component to be predicted into a trained dependency prediction model to obtain a dependency prediction result, wherein the dependency prediction model is obtained by training based on a preset neural network model according to the attribute information of the sample open source component extracted from the first knowledge graph that characterizes the dependency relationship between the open source components and the dependency relationship between the sample open source components;

[0129] The generating unit 54 is used to generate a corresponding second knowledge graph representing the dependency relationship between the open source components to be predicted according to the attribute information of the open source components to be predicted and the dependency prediction result.

[0130] In one implementation, the feature extraction unit 52 is specifically configured to perform feature dimension reduction representation on the attribute information of the open source component to be predicted according to a preset word embedding model to obtain an attribute feature vector of the open source component to be predicted.

[0131] In one embodiment, the prediction unit 53 is specifically used to train and obtain the dependency prediction model in the following manner: sampling the open source components contained in the first knowledge graph to obtain sampled open source components; extracting open source components with dependencies as positive sample open source components and open source components without dependencies as negative sample open source components from the sampled open source components; constructing a sampled knowledge graph based on the sampled open source components; generating an adjacency matrix corresponding to the sampled knowledge graph based on the weight of the dependency relationship between every two sampled open source components; and obtaining the dependency prediction model by training based on the preset neural network model according to the attribute information of the positive sample open source components, the attribute information of the negative sample open source components and the adjacency matrix corresponding to the sampled knowledge graph.

[0132] In one embodiment, the prediction unit 53 is specifically used to perform feature dimensionality reduction representation on the attribute information of each positive sample open source component and each negative sample open source component according to the preset word embedding model, so as to obtain the attribute feature vector of each positive sample open source component and the attribute feature vector of each negative sample open source component; generate the attribute feature vector matrix of the sample open source component according to the attribute feature vector matrix of each positive sample open source component and the attribute feature vector of each negative sample open source component; train the preset neural network model according to the attribute feature vector matrix of the sample open source component and the adjacency matrix corresponding to the sampled knowledge graph, so as to obtain the dependency prediction model.

[0133] In one embodiment, the device further comprises:

[0134] A first acquisition unit is used to acquire topological structure information of the first knowledge graph and attribute feature vectors of the open source components in the first knowledge graph after constructing the sampled knowledge graph according to the sampled open source components;

[0135] A second acquisition unit is used to acquire the topological structure information of the sampled knowledge graph and the attribute feature vector of the sampled open source component;

[0136] A first testing unit, used to perform a t hypothesis test on the topological structure information of the first knowledge graph and the topological structure information of the sampled knowledge graph;

[0137] A second testing unit, configured to perform a t hypothesis test on the attribute feature vectors of the open source components in the first knowledge graph and the attribute feature vectors of the sampled open source components;

[0138] The sampling unit is used to resample if any t hypothesis test is determined to fail.

[0139] In one embodiment, the topological structure information includes at least one of the following information: degree distribution information, clustering coefficient information and diameter information, wherein the degree distribution represents the distribution of the number of edges connected to each node in the knowledge graph, the clustering coefficient represents the degree of clustering between each node in the knowledge graph, and the diameter represents the number of edges contained in the maximum path in the knowledge graph.

[0140] Based on the same technical concept, the present application embodiment also provides an electronic device 600, referring to Figure 7 As shown, the electronic device 600 is used to implement the open source component link prediction method described in the above method embodiment. The electronic device 600 of this embodiment may include: a memory 601, a processor 602, and a computer program stored in the memory and executable on the processor, such as an open source component link prediction program. When the processor executes the computer program, the steps in each of the above open source component link prediction method embodiments are implemented.

[0141] The specific connection medium between the memory 601 and the processor 602 is not limited in the embodiment of the present application. Figure 7 In the embodiment, the memory 601 and the processor 602 are connected via a bus 603. The bus 603 is Figure 7 The connection between other components is shown by bold lines, which is only for schematic illustration and is not intended to be limiting. The bus 603 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0142] The memory 601 may be a volatile memory, such as a random-access memory (RAM); the memory 601 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), or the memory 601 may be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 601 may be a combination of the above memories.

[0143] Processor 602 is used to implement the open source component link prediction method provided in the embodiment of the present application.

[0144] An embodiment of the present application also provides a computer-readable storage medium that stores computer-executable instructions required to execute the above-mentioned processor, which includes a program required to execute the above-mentioned processor.

[0145] In some possible implementations, various aspects of the open source component link prediction method provided in the present application may also be implemented in the form of a program product, which includes a program code. When the program product is run on an electronic device, the program code is used to enable the electronic device to execute the steps of the open source component link prediction method according to various exemplary implementations of the present application described above in this specification.

[0146] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0147] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (apparatus), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0148] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0149] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0150] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0151] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. An open source component link prediction method, characterized in that: include: Responding to open source component link prediction requests; Acquiring attribute information of the open source component to be predicted, and performing feature extraction on the attribute information of the open source component to be predicted to obtain an attribute feature vector of the open source component to be predicted; Inputting the attribute feature vector of the open source component to be predicted into the trained dependency prediction model to obtain a dependency prediction result, wherein the dependency prediction model is obtained by training based on a preset neural network model according to the attribute information of the sample open source component extracted from the first knowledge graph that characterizes the dependency relationship between the open source components and the dependency relationship between the sample open source components; A corresponding second knowledge graph representing the dependency relationships between the open source components to be predicted is generated according to the attribute information of the open source components to be predicted and the dependency prediction results.

2. The method according to claim 1, characterized in that Extracting features from the attribute information of the open source component to be predicted to obtain an attribute feature vector of the open source component to be predicted specifically includes: The attribute information of the open source component to be predicted is represented by feature dimensionality reduction according to a preset word embedding model to obtain an attribute feature vector of the open source component to be predicted.

3. The method according to claim 2, characterized in that The dependency relationship prediction model is obtained by training in the following way: Sampling the open source components included in the first knowledge graph to obtain sampled open source components; Extracting open source components with dependencies from the sampled open source components as positive sample open source components, and extracting open source components without dependencies as negative sample open source components; Building a sampling knowledge graph based on the sampled open source components; Generate an adjacency matrix corresponding to the sampled knowledge graph according to the weight of the dependency relationship between every two sampled open source components; According to the attribute information of the positive sample open source component, the attribute information of the negative sample open source component and the adjacency matrix corresponding to the sampled knowledge graph, the dependency relationship prediction model is obtained by training based on the preset neural network model.

4. The method according to claim 3, characterized in that According to the attribute information of the positive sample open source component, the attribute information of the negative sample open source component and the adjacency matrix corresponding to the sampled knowledge graph, training is performed based on the preset neural network model to obtain the dependency relationship prediction model, specifically including: Respectively perform feature dimension reduction representation on the attribute information of each positive sample open source component and each negative sample open source component according to the preset word embedding model to obtain an attribute feature vector of each positive sample open source component and an attribute feature vector of each negative sample open source component; Generate an attribute feature vector matrix of the sample open source components according to the attribute feature vectors of each positive sample open source component and the attribute feature vectors of each negative sample open source component; The preset neural network model is trained according to the attribute feature vector matrix of the sample open source component and the adjacency matrix corresponding to the sampled knowledge graph to obtain the dependency prediction model.

5. The method according to claim 3, characterized in that After constructing the sampled knowledge graph according to the sampled open source components, it also includes: Obtaining topological structure information of the first knowledge graph and attribute feature vectors of open source components in the first knowledge graph; and Obtaining topological structure information of the sampled knowledge graph and attribute feature vectors of the sampled open source components; Performing a t hypothesis test on the topological structure information of the first knowledge graph and the topological structure information of the sampled knowledge graph; and Performing a t hypothesis test on the attribute feature vectors of the open source components in the first knowledge graph and the attribute feature vectors of the sampled open source components; If it is determined that any t hypothesis test fails, resampling is performed.

6. The method according to claim 5, characterized in that The topological structure information includes at least one of the following information: degree distribution information, clustering coefficient information and diameter information. The degree distribution represents the distribution of the number of edges connected to each node in the knowledge graph, the clustering coefficient represents the degree of clustering between each node in the knowledge graph, and the diameter represents the number of edges contained in the maximum path in the knowledge graph.

7. An open source component link prediction device, characterized in that: include: A response unit, configured to respond to an open source component link prediction request; A feature extraction unit, used to obtain attribute information of the open source component to be predicted, and perform feature extraction on the attribute information of the open source component to be predicted to obtain an attribute feature vector of the open source component to be predicted; A prediction unit, configured to input the attribute feature vector of the open source component to be predicted into a trained dependency prediction model to obtain a dependency prediction result, wherein the dependency prediction model is obtained by training based on a preset neural network model according to the attribute information of the sample open source component extracted from a pre-built first knowledge graph representing the dependency relationship between the open source components and the dependency relationship between the sample open source components; A generating unit is used to generate a corresponding second knowledge graph representing the dependency relationship between the open source components to be predicted according to the attribute information of the open source components to be predicted and the dependency prediction result.

8. The device according to claim 7, characterized in that The feature extraction unit is specifically used to perform feature dimension reduction representation on the attribute information of the open source component to be predicted according to a preset word embedding model to obtain an attribute feature vector of the open source component to be predicted.

9. The device according to claim 8, characterized in that The prediction unit is specifically used to train and obtain the dependency prediction model in the following manner: sampling the open source components contained in the first knowledge graph to obtain sampled open source components; extracting open source components with dependencies as positive sample open source components and open source components without dependencies as negative sample open source components from the sampled open source components; and constructing a sampled knowledge graph according to the sampled open source components; Generate an adjacency matrix corresponding to the sampled knowledge graph according to the weight of the dependency relationship between every two sampled open source components; According to the attribute information of the positive sample open source component, the attribute information of the negative sample open source component and the adjacency matrix corresponding to the sampled knowledge graph, the dependency relationship prediction model is obtained by training based on the preset neural network model.

10. The device according to claim 9, characterized in that The prediction unit is specifically used to perform feature dimensionality reduction representation on the attribute information of each positive sample open source component and each negative sample open source component according to the preset word embedding model, so as to obtain the attribute feature vector of each positive sample open source component and the attribute feature vector of each negative sample open source component; generate the attribute feature vector matrix of the sample open source component according to the attribute feature vector matrix of each positive sample open source component and the attribute feature vector of each negative sample open source component; train the preset neural network model according to the attribute feature vector matrix of the sample open source component and the adjacency matrix corresponding to the sampled knowledge graph, so as to obtain the dependency prediction model.

11. The device according to claim 9, characterized in that Also includes: A first acquisition unit is used to acquire topological structure information of the first knowledge graph and attribute feature vectors of the open source components in the first knowledge graph after constructing the sampled knowledge graph according to the sampled open source components; A second acquisition unit is used to acquire the topological structure information of the sampled knowledge graph and the attribute feature vector of the sampled open source component; A first testing unit, used to perform a t hypothesis test on the topological structure information of the first knowledge graph and the topological structure information of the sampled knowledge graph; A second testing unit, configured to perform a t hypothesis test on the attribute feature vectors of the open source components in the first knowledge graph and the attribute feature vectors of the sampled open source components; The sampling unit is used to resample if any t hypothesis test is determined to fail.

12. The device according to claim 11, characterized in that The topological structure information includes at least one of the following information: degree distribution information, clustering coefficient information and diameter information. The degree distribution represents the distribution of the number of edges connected to each node in the knowledge graph, the clustering coefficient represents the degree of clustering between each node in the knowledge graph, and the diameter represents the number of edges contained in the maximum path in the knowledge graph.

13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the open source component link prediction method according to any one of claims 1 to 6 is implemented.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps in the open source component link prediction method as described in any one of claims 1 to 6 are implemented.