Medical outcomes must be tracked in order to enhance quality initiatives, healthcare management, and mass education. Thoracic surgery data have been acquired for those who underwent major lung surgery for primary lung cancer, a field in which there has been little research and few reliable recommendations have been made for lung cancer patients. Early detection of lung cancer benefits therapy choices and increases the odds of a patient surviving a lung cancer infection. Using a Hybrid Genetic and Support Vector Machine (GA-SVM) methodology, this study proposes a method for identifying lung cancer patients. To estimate postoperative life expectancy, ensemble machine-learning techniques were applied. The article also presents a strategy for estimating a patient’s life expectancy following thoracic surgery after the detection of cancer. To perform the prediction, hybrid machine-learning methods were applied. In ensemble machine-learning algorithms, attribute ranking and selection are critical components of robust health outcome prediction. To enhance the efficacy of algorithms in health data analysis, we propose three attribute ranking and selection procedures. Compared to other machine-learning techniques, GA-SVM achieves an accuracy of 85% and a higher F1 score of 0.92. The proposed algorithm was compared with two recent state-of-the-art techniques and its performance level was ranked superior to those of its counterparts.