Metastatic Adenocarcinoma Classification With Apple CreateML
No coding machine learning in practice, part 2
Lung and colon adenocarcinoma are some of the most common cancers affecting numerous patients throughout the world. They frequently spread to other sites of the body. It is not uncommon that the pathologist is faced with the question if biopsy showing adenocarcinoma originated from lung or colon primary site. Pathologists are often forced to use special stains to help them make this determination.
I used two different machine learning libraries (fastai and Keras) to solve metastatic adenocarcinoma origin in one post and used Lobe application in another. In the current article, I used Apple CreateML for this important problem.
Create ML is a machine learning framework from Apple. The CreateML app is a part of XCode, which can be downloaded free from the Apple App Store. CreateML allows the creation of machine learning models, which can be used in Apple applications. Unfortunately, the app only runs on Mac computers, which is its major limitation. No coding skills are necessary to train, validate, and test the CreateML models.
I used a 2018 MacBook Pro with the latest Mac operating system (11.0.1) and the LC25000 image dataset for this project.
I the following few paragraphs, I will describe the necessary steps to train, validate, and test a machine learning model using Create ML.
My images were organized into training (8000 images) and testing (2000 images) folders. Each of these folders contained class subfolders: colon_aca for colonic adenocarcinoma and lung_aca for lung adenocarcinoma.
The opening screen of CreateML presented me with the choice to edit an existing project or create a new one. I moved to create a new project.
I picked Image Classification for my project. The CreateML has many other options for the image, audio, and tabular data projects.
I named my project Metastatic Adenocarcinoma Project.
And created a new project by pressing the “create” button.
I dragged the training folder to the “Training Data” box and the testing folder to the “Testing Data” box. CreateML automatically picked about 5% of images from the training folder for validation.
I pressed the “Train” button to train and test my model. I did not use any of the augmentation options and went with the default value of 25 iterations.
On my 2018 MacBook Pro, it took 18 minutes to train and 2 minutes to test the model.
The model achieved a 100% training accuracy.
A 100% validation accuracy.
And a 99% testing accuracy.
I also tested it on a random adenocarcinoma image, and the model properly classified it as of colonic origin.
The trained model can be saved locally, exported to the XCode project, or shared through Mail, Messages, or AirDrop with your friends.
In summary, Apple CreateML is an imposing machine learning application. With each year, it gets more robust and provides more machine learning problem type choices. The program will become even more powerful on new Macs containing the Apple Silicon chip M1, which has a 16-core Neural Engine capable of 11 trillion operations per second. The availability for only the Mac platform is the biggest limitation of CreateML. But if you function in the Apple environment, it is a fantastic way to create machine learning models that can be incorporated into the iPhone, iPad, or Mac applications.
Thank you for taking the time to read this post.