The invention discloses an automatic feature construction method based on an attention mechanism and reinforcement learning, and the method sequentially comprises the following steps: 1, giving a dataset DTR of a classification problem, including a numerical type feature set S, setting the parameter maximum iteration number maxIterations, and setting the value of an embedded size as embeddingSize; and 2, transmitting the data set and the parameters into the automatic feature construction method, and operating to obtain a classification result. According to the method, a feature generator based on a self-attention mechanism and a feature selector based on reinforcement learning are included, generated features are continuously explored and utilized through iteration, feature generation ofa test set is guided through a globally optimal feature generation and selection scheme in limited steps, and therefore an optimal classification result is automatically obtained.