The imbalanced data sets are often encountered in business, industry and real life applications. In this paper, the novel fitness function in genetic algorithms to optimize neural networks is proposed for solving the classification problems in imbalanced data sets. Not only the parameters of neural networks but also the links-pruning between neurons are regarded as an optimization problem in this study. The fitness function consists of the mean square error, the classification error rate for each class, the distances between the examples and the boundary of classification. The artificial data set and the UCI data sets are used to verify the classifier we proposed. The experimental results showed that the classifier performs better than the conventional back-propagation neural network.