The development of network technology has brought convenience to people's life, but also provides the convenience for the virus, Trojan and other destructive programs to attack the network. Then, the computer network security is becoming more and more dangerous. Accurately and scientifically predict the risk of network, it can effectively prevent the risk, and reduce the loss caused by the problem of computer network security. Computer network security is an early warning problem of multi index system. So, the traditional linear forecasting method cannot accurately describe the impact of each index on the evaluation results, and the accuracy of the prediction results is low. In order to improve the prediction accuracy of computer network security, this paper presents a new forecasting method for computer network security. Firstly, the evaluation index of computer network security is selected by expert system, and the weight of evaluation index is determined by the expert scoring method. Secondly, we put the index weight into the BP neural network, and use the BP neural network to learn it. Then, the parameters of BP neural network are optimized by the improved particle swarm optimization algorithm. After that, this paper uses a method based on the Fibonacci method principle to find the number of hidden layer node which has the best fitting ability. Finally, we use this algorithm to predict the network security of a certain enterprise in the next six months. The score is 0.67, 0.84, 0.72, 0.87, 0.86 and 0.91, which is close to the actual value of network security.