A relay selection method is proposed for physical-layer security in multi-hop decode-and-forward (DF) relaying systems. In the proposed method, cooperative relays are selected to maximize the achievable secrecy rates under DF-relaying constraints by the classification method. Artificial neural networks (ANNs), which are used for machine learning, are applied to classify the set of cooperative relays based on the channel state information of all nodes. Simulation results show that the proposed method can achieve near-optimal performance for an exhaustive search method for all combinations of relay selection, while computation time are reduced significantly. Furthermore, the proposed method outperforms the best relay selection method, in which the best relay in terms of secrecy performance is selected among active ones.