As an important participant in mineralization, the study of granite is helpful to understand the geochemical process of tungsten-tin mineralization and distinguish the ore-bearing property of rock mass. In this paper, the data of major elements and rare earth elements of tungsten-bearing granite, tungsten-tin-bearing granite and non-ore-bearing granite in Nanling area are collected, a total of 466 sets of data of 42 rock masses. The geochemical characteristics of the three types of rock masses are summarized and compared.The relationship between ore-bearing properties and geochemical characteristics of rock mass is explored from the perspective of data-driven and machine learning. The restricted Boltzmann machine is used to train the auto-encoder neural network to eliminate the dimensional difference between major elements and rare earth elements, and the intermediate features are extracted. Then the intermediate features are input into random forest and multi-layer BP neural network to establish AE-RF and AE-BP rock mass ore-bearing classification models. The importance of classification characteristics is output by random forest. The results show that the evolution degree of tungsten-bearing granite is slightly higher, followed by tungsten-tin-bearing granite, and the ore-free granite is the lowest.Both models have high accuracy ( > 90 % ) on the test set, and the practical application effect of the AE-BP model on the blind test set is better. Six groups of rock masses were randomly selected as the blind test set. Among the 21 rock masses, the correct rate of 13 rock masses was greater than 80 %, the correct rate of two rock masses was greater than 70 % less than 80 %, and the correct rate of two rock masses was greater than 50 % less than 70 %. There are four rock mass accuracy is less than 50 %. Major elements such as iron, manganese, phosphorus, calcium and magnesium and light and heavy rare earth elements are important features to distinguish the three types of rock masses. The similarity of geochemical characteristics and the difference of tungsten-tin deposit types will lead to the wrong classification of the model, and it is pointed out that the Beitou rock mass has certain metallogenic potential. The main elements such as iron, manganese, phosphorus, calcium and magnesium determine whether the rock mass can contain ore, while light rare earth is an important index to distinguish tungsten-bearing rock mass and tungsten-tin-bearing rock mass. It is believed that the degree of differentiation and evolution of magma determines whether the rock mass can contain ore, and the addition of mantle-derived materials is to distinguish whether the rock mass contains tungsten or tungsten-tin.