The current research is aimed at studying the application of machine learning algorithms for the early prediction and detection of lung cancer taking the images of CT scans and MR scans. In this respect, the dataset from kaggle includes 3200 images from diverse sources, which are pre-processed and applied for the process of feature extraction, using traditional methods and deep learning systems, which include Convolutional Neural Networks, VGG-16, VGG-19, and RNN, while after the training the systems are evaluated in accordance with precision, recall, f1 score, and accuracy. As a result, it is evidenced that the best model is VGG-19 with the highest accuracy of 97.86%, while follows VGG-19 the VGG-16 the CNN model, and the RNN, implying effective implications for clinical practice. Certainly, the results of the research help to create a non-invasive, effective, and fast tool, using by clinicians in their practice. The use of machine learning algorithms for the process of early prediction and detection would be helpful for the timely treatment of patients and personalized treatment plans. In such a way, based on the current research, it could be summarized that the best models are constantly developed and gradually implemented in practice. However, more significant collaboration between the researchers, clinicians, and the industry is needed to have the full implementation of applied methods in practice, having fast results and timely actions taken by clinicians.