Snake-like robots, with their complex and multi-jointed structure, hold great potential for navigating complex environments. However, real-time manipulation of their movements can be challenging. As such, achieving autonomous mobility for these robots is a major area of research. This paper introduces a new machine learning-based control framework that utilizes a clustering algorithm to classify training data into multiple clusters. The motion control of snake-like robots involves multiple regression problems due to the multi-parameter control strategy. To address this, we propose a novel strategy that uses data from previous training to convert multiple regressions into a single regression problem for parameter modification. Our experimental results demonstrate the adaptability of the robots in different pipe environments using our algorithm framework.