# A Link Prediction Method Based on Neural Networks
## 4 Method  
### Neural Networks (NN)  
Neural networks have many successful applications in solving various problems related to prediction, classification and regression [53]. There are three basic layers in neural networks, including input layer, hidden layer and output layer, as shown in Figure 1. Usually, the data form of neural networks is arrays. As we know, a network is always expressed as an adjacency matrix. It is impossible to train the neural network as input data because using the adjacency matrix as the input of neural networks would require the dimension size that can represent \(2^{N^{2}}\) adjacency matrices, where \(N\) is the number of nodes in the network. Here, a new network representation called link list (LL) is applied that contains binary elements representing existence of node pairs among all possible combinations \(\left(\begin{array}{c}N\\ 2\end{array}\right)\). Generally, the possible links are \(L=\{\)(1, 2), (1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5), (3, 4), (3, 5), (4, 5)\(\}\) for an undirected network with \(N=5\). If four of the links exist by \(L=\{\)(1, 4), (2, 3), (2, 4), (3, 5)\(\}\), then \(LL=\{\)0 0 1 0 1 1 0 0 1 0\(\}\). In this way, the network's adjacency matrix is transformed into an array, and link prediction of a network is achieved by the neural network method. The neural network is trained based on original scale-free networks as the input data and optimized networks by link prediction models as the desired output data. Specifically, we first generate scale-free networks with specified requirements as original data, and the link prediction models obtain the optimized networks. Then, the adjacency matrix of the networks is transformed into the link list. In the training of the neural network, the input is the link list of the original scale-free networks and the output is the link list of the optimized networks generated by the link prediction models. It solves the problem that neural networks cannot train network data.  
The original networks are scale-free networks with the initial number of nodes \(N_{0}=3\) and link density \(M_{0}=2\) for \(N=30\), \(N=50\), \(N=80\) and \(N=100\). The link prediction method based on neural networks is evaluated by the network efficiency and global network structure reliability. In order to verify the feasibility and advantages of link prediction based on neural networks, we use the traditional link prediction models as the performance reference models. In experiments, we assume that the number of links increased by link prediction models is equal to the number of network's nodes. We randomly generate a database of 10 data sets which have scale-free networks with the same number of nodes as the input data of the neural network; 80% of them are training data and 20% are test data. In the neural network method, the number of hidden layers is set to 4 [54]. The maximum training epochs is 1000, the training goal is 0.00001 and the neural network's learning rate is set to 0.001.  
We performed two kinds of experiments on scale-free networks with \(N=30\), 50, 80 and 100, and analyze the results by MATLAB. First, we randomly generated several scale-free networks with a specified number of nodes as data sets. In Experiment 1, the input data are different networks with the same number of nodes, and the output data are optimized networks obtained by the same link prediction model. We found that the traditional link prediction models have different advantages for different networks. Therefore, in order to give full play to the advantages of different link prediction models to obtain the more optimized networks, we carried out Experiment 2, in which the input data are the  
Figure 1: Neural network model.  
same network and the output data are the optimized networks generated by different link prediction models.