This paper demonstrates the development of a thermal error model that is applied on the feed axis of machine tools and based on the neural network. This model can accurately predict the value of the axial thermal error that appears on machine feed axis. In principle, there is the generalized regression neural network (GRNN), which has the good nonlinear mapping ability and serves to construct the error model. About variables, the data of temperature and axial thermal error of machine feed axis are the inputs and outputs, respectively. The particle swarm optimization (PSO) is a component of this model, which serves to optimize the smoothing factor in GRNN, and the particle swarm optimization-based generalized regression neural network (PSO-GRNN) model is built. From experiment, the datum is acquired from a machining centre in four different feed rates. Thereafter, the back propagation (BP) neural network model, the traditional GRNN model, and the PSO-GRNN model were established, and the data collected from the experimentation are input in three models for prediction. Compared with the other two models used in this paper, the PSO-GRNN model can maintain higher prediction accuracy at different feed speed, and the prediction accuracy of it changes less in different feed rates. The proposed model solved the problem of generalization ability of the neural network at different feed rate, which shows good performance and lays a good foundation for further research like thermal error compensation.