To compensate the thermal deformation error of NC(numerical control) gear hobbing machine tools and improve the accuracy of gear machining,based on the clustering regression analysis theory, temperature measurement points are optimized to compensate thermal error. Accordingly a thermal model is set up by using least squares theory, and experimental result shows that the model is very accurate. A thermal error differential helix compensation scheme is proposed,which adopts direct compensation outside completely and can achieve real-time compensation for thermal error independently. Compared with other compensation methods,this one is unlimited to the openness of NC system and has a great popularity.