Floating structures have become a major part of offshore structure communities as offshore engineering moves from shallow waters to deeper ones. Floating installation ships or platforms are widely used in these engineering operations. Unexpected wave-induced motions affect floating structures, especially in harsh sea conditions. Horizontal motions on the sea surface can be offset by a dynamic positioning system, and heave motions can be controlled by a heave compensation system. Active heave compensation (AHC) systems are applied to control vertical heave motions and improve safety and efficiency. Predictive control based on machine learning prediction algorithms further improves the performance of active heave compensation control systems. This study proposes a predictive control strategy for an active heave compensation system with a machine learning prediction algorithm to minimise the heave motion of crane payload. A predictive active compensation model is presented to verify the proposed predictive control strategy, and proportion–integration–differentiation control with predictive control is adopted. The reliability of back propagation neural network (BPNN) and long short-term memory recurrent neural network (LSTM RNN) prediction algorithms is proven. The influence of the predictive error on compensation performance is analysed by comparing predictive feedforward cases with actual-data feedforward cases. Predictive feedforward control with regular and irregular wave conditions is discussed, and the possible strategies are examined. After implementing the proposed predictive control strategy based on a machine learning algorithm in an active heave compensation system, the heave motion of the payload is reduced considerably. This investigation is expected to contribute to the motion control strategy of floating structures.