Background: Ventilator weaning protocols are commonly implemented for patients receiving mechanical ventilation. However, the rate of extubation failure remains high despite the protocols. This study investigated the usefulness and accuracy of ventilator weaning through machine learning to predict successful extubation. Methods: We retrospectively evaluated the data of patients who underwent intubation for respiratory failure and received mechanical ventilation in the intensive care unit (ICU). Data on 57 factors including patient demographics, vital signs, laboratory data, and data from ventilator were extracted. Extubation failure was defined as re-intubation within 72 hours of extubation. For supervised learning, the data were labeled requirement of intubation or not. We used three learning algorithms (Random Forest, XGBoost, and LightGBM) to predict successful extubation. We also analyzed important features and evaluated the area under curve (AUC) and prediction metrics. Results: Overall, 13 of the 117 included patients required re-intubation. LightGBM had the highest AUC (0.950), followed by XGBoost (0.946) and Random Forest (0.930). The accuracy, precision, and recall performance were 0.897, 0.910, and 4 0.909, for Random Forest; 0.910, 0.912, and 0.931 for XGBoost; and 0.927, 0.915, and 0.960 for LightGBM, respectively. The most important feature was the duration of mechanical ventilation followed by the fraction of inspired oxygen, positive end-expiratory pressure, maximum and mean airway pressures, and Glasgow Coma Scale. Conclusions: Machine learning could predict successful extubation among patients on mechanical ventilation in the ICU. LightGBM has the highest overall performance. The duration of mechanical ventilation was the most important feature in all models.