Innovative Applications of Machine Learning

Aarti Last Updated : 10 May, 2022
10 min read

This article was published as a part of the Data Science Blogathon.

Introduction

Nowadays, Machine learning is being used in various areas in the health business, including the development of improved medical processes, patient records and data management, and the treatment of chronic diseases. Healthcare firms may use machine learning to meet rising demand, cut costs, and enhance operations.

The application of machine learning in healthcare is not new, as digitization has taken over every business. Sharing, conveying, and acquiring data is becoming increasingly important. Artificial intelligence, big data, and machine learning can all help with the problems that massive volumes of data can cause. On the other hand, machine learning can help practitioners treat diseases more effectively by recognizing them earlier and providing more individualized care.

In this article, We will see basic concepts about machine learning, Applications of machine learning in the healthcare domain, and we will look at some existing apps that have already been developed to solve various health issues. Our focus is to predict calories burned by looking at the calories burned dataset by using Machine Learning Model in Python. And based on that, we will derive various insights that will help us understand the weightage of each feature and how they are interrelated to one another.

Evolution of Artificial Intelligence

Application of Machine Learning
Fig 1: Evolution of AI  

By the 1950s, Artificial Intelligence (AI) came into the picture, a branch of computer science that could create intelligent machines. So basically, we can say that Artificial intelligence can mimic human behaviour.

By the 1980s, Machine learning (ML) comes into the picture, which can learn independently. All machine learning counts as Artificial intelligence, but all AI doesn’t count as machine learning.

By the 2010s, Deep learning (DL) came with the advanced feature of machine learning. It is also called a deep artificial neural network. Deep understanding is also defined as it can give the ability computers to learn without doing any programming.

Now we will see a basic introduction to machine learning and its algorithms. After then, we will see various applications of ML in the healthcare domain.

Introduction to ML

Machine learning (ML) can extract and combine knowledge based on many observations and develop and extend itself by acquiring new knowledge rather than being programmed with it.

Application of Machine Learning

Fig 2: Machine Learning

 Now we will see how the Machine Learning model works:

Application of Machine Learning
Fig 3: Machine Learning Process [1]

As we can see in the above figure, the first step is data collection. In which you have to collect data from different sources. Data can be according to your requirement like Image, text, video, audio, etc. The next step is data preprocessing, in which you have to clean your data with some preprocessing techniques because data may be noisy. Now you have to feed some data to your model; that is what we call as training phase. Now your model is successfully trained with some data. So it’s time to it’s your model and checks the result that your model accurately classified your data or not. So this is how machine learning models work.

There are various machine learning algorithms available. So we will briefly see all types of algorithms in the next section.

Machine Learning Algorithms

Machine Learning Algorithms
Fig 4: Category of Machine Learning Algorithms 

Supervised Learning

Supervised Learning
Fig 5: Example of Supervised Learning [2]

To understand this algorithm, let’s take an example. Imagine yourself to be a little child, and you are going somewhere by car with your parents. Now Imagine you have seen some trees from the window, and as you cannot recognize the tree, you ask your parents which tree is that? So your parents will tell you that, dear, this is a mango tree. So, to get better at it, your parents will show you different types of trees on your journey every time.

While returning home, your parents check your ability to recognize trees and ask you to identify the tree type. And then they tell you whether it is correct or wrong. If you get it wrong, you ask for the right answer. After going through the answers, you make sure that you don’t repeat the same mistake. This improves your problem-solving ability. As a result, you recognize tree types that are not known to your parents.

This is how supervised learning algorithms work. You have to provide labelled Input to your model, and then you have to check for your model’s ability if it can correctly recognize or not.

The GIF above demonstrates an excellent example of supervised learning where the robot learns to recognize dinosaurs and then tries to identify them on its own as humans gave training.

Unsupervised Learning

Unsupervised Learning | Application of Machine Learning
Fig 6: Example of Unsupervised Learning [3]

In the case of unsupervised learning algorithms, NO labelled input is given to your model. The algorithm learns things by itself. The algorithm will identify common patterns in Input data and, based on that pattern, classify data into similar groups.

The GIF above demonstrates an excellent example of unsupervised learning where the robot learns things on its own and comes up with a conclusion. The robot will identify the same pattern animals from input Images and then put them into a similar group.

Reinforcement Learning

Reinforcement Learning is a branch of machine learning. An agent learns how to behave in a given environment by executing specific actions and watching the rewards/results it receives.

Let’s look at the Mario game as an example. For example, let’s say our reinforcement learning bot is learning to play Mario. I am sure you have also played Super Mario Game in your childhood, and if you played it, you already know how hard it is. What if I told you that a computer could solve the game without knowing all of the rules? The computer will learn the first level of the game without our help; it will learn independently. Let’s get started. The reinforcement learning process can be represented as an iterative loop like this:

Fig 7: Example of Reinforcement Learning[4]

In the above GIF, we can see that Mario can move and jump in the left and right directions. But when Mario jumps on the flower, he will get a Reward for getting gun power, but if Mario touches the monster, he will lose his gun powder as a negative Reward. So by getting Negative and Positive rewards, Mario will Learn based on tips called Reward-Based learning.

Applications of Machine Learning

The following are typical applications of machine learning:

Fig 8: Application of Machine Learning

 

Machine Learning Application in Healthcare

Machine learning aims to make machines more lucrative, efficient, and dependable. On the other hand, the doctor’s knowledge is the machine learning tool in a healthcare system. Because a patient requires human contact and care at all times, this is something that neither machine learning nor any other technology can replace. An automated machine can provide a more efficient service. The top ten machine learning applications in healthcare are described here.

Machine Learning Application in Healthcare
Fig 9: Machine Learning Application in Healthcare

ML Based Healthcare Apps

People have been dependent on numerous mobile apps to solve their health difficulties in this era of smartphones and other technologies.

Here are some of the top Mobile App for healthcare:

1) MigraineBuddy  is an excellent healthcare app that adopts ML to forecast the possibility of a headache and recommends ways to prevent it.
2) Happify – is an app that takes a creative approach to deal with mental health issues. It features engaging events, including games and other activities led by Anna, a digital AI instructor.
3) 
ADA-AI Doctor – Users may enter their conditions using the app’s instant messaging feature. Easy questions are asked by ADA’s AI technology to get a deeper understanding of the user’s conditions.
4) Binah.AI – is a fitness tracking app that analyses light waves from the cheeks from a smartphone camera to check the face in around 2 minutes and reports symptoms like heart rate, mental stress, blood pressure, etc.
5) SkinVision expands your ability to self-examine your skin and elevates your knowledge of when to act, how, and why along with the most reliable personalized skin health advice and health path recommendation.
6) Sensely – A virtual reality nursing assistant avatar that visits the patient once or several times a day is seen here. The avatar can request that the patient examine their weight and blood pressure.
7) PathAI – employs machine learning to help pathologists make quicker and more accurate diagnoses.

 We will see one Interesting Application of Machine Learning in the Healthcare Domain. So you will get a clear idea of how machine learning works in the Healthcare Industry.

Calories Burnt Prediction Using ML with Python

Calories in our diet give us energy in the form of heat, which allows our bodies to function. This means we need to consume a specific number of calories to stay alive. However, if we consume too many calories, we will be at risk of many diseases, resulting in obesity. So there is a need to burn calories, and we do so by conducting exercises and other activities. To figure out how many calories we’ve burned, We’ll build a machine learning model that predicts calories based on some data.

So, let’s get started!

Installing Libraries

I’ve loaded the most common machine learning libraries in Python in this initial stage, such as Pandas, matplotlib, seaborn, and NumPy. Python is the most versatile and practical programming language I’ve ever used.
import numpy as np
import pandas as pd

import matplotlib.pyplot as plt

import seaborn as sns

from sklearn.model_selection import train_test_split

from xgboost import XGBRegressor

from sklearn import metrics

Importing Data

In this implementation, I have used a dataset from Kaggle[5]. Dataset contains  2 .csv files named calories.csv and excercise.csv

The following code is to load data from the calories.csv file to the pandas dataframe and print the first 5 rows in the dataset:

# loading the data from csv file to a Pandas DataFrame

calories = pd.read_csv('/content/calories.csv')

 

# print the first 5 rows of the dataframe

calories.head()

Now we need to load another file that is excercise.csv file which contains different parameters which we are going to use for calorie burn.

exercise_data = pd.read_csv('/content/exercise.csv')
exercise_data.head()

Now the question arises in our mind that we are predicting calories burned based on the duration of exercise, and we can say that person is going for a walk for 30 minutes and calculating calories burned. Another person is going running for 30 minutes. So we can say that obviously, the calories burned by a person going running are more than the person going for a walk. So how we will predict based on the only duration of exercise?

So we have another attribute that is heart rate and body temperature. Obviously, for the person who is going running, the heart rate will be more than the person who is walking. So we can distinguish the exercise based on heart rate and body temperature. So there is an indirect relationship between heart rate and activity.

Here we are combining two data frames as follows:

calories_data = pd.concat([exercise_data, calories['Calories']], axis=1)
calories_data.head()

Now, if we want to see detailed information about the dataset like the number of entries, several columns, datatype, null values etc., then we have to write the following code:

# getting some information about the data
calories_data.info()

Data Analysis

Now I want to get some statistical measures of the data like what is the mean age of the persons in the dataset .so we need to write the following code:

# get some statistical measures about the data
calories_data.describe()

Finding the Correlation in the Dataset

1. Positive Correlation

2. Negative Correlation

Suppose one person’s duration and calories are either increasing or decreasing in the same manner. So we can say that both are positively correlated. And if one feature of dataset value increases and another decreases, we can say that they are negatively correlated.

# constructing a heatmap to understand the correlation

correlation = calories_data.corr()
plt.figure(figsize=(10,10))
sns.heatmap(correlation, cbar=True, square=True, fmt='.1f', annot=True, annot_kws={'size':8}, cmap='Blues')

Now we are converting text data into numerical values. So the male is set as 0, and the female is set as 1.

calories_data.replace({"Gender":{'male':0,'female':1}},inplace=True)
calories_data.head()

 

Separating Features

Now we are separating feature columns and target columns. For that, we are taking two-variable X and Y. following code is to remove user id and calories from the data frame, which are not required, and we are storing calories in the Y variable.

X = calories_data.drop(columns=['User_ID','Calories'], axis=1)
Y = calories_data['Calories']
print(X)
print(Y)

Splitting the Data into Training and Testing Data

Here we are splitting 80% dataset as training dataset and 20% dataset into testing dataset.

X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2, random_state=2)

print(X.shape, X_train.shape, X_test.shape)

 

So here we can see that we have 15000 original data, 80% of the original dataset, 12000 and 20% of the original dataset, which is the testing dataset.

Loading Model

Here we are loading the XGBRegressor model and training the model with the training dataset.

# loading the model

model = XGBRegressor()
# training the model with X_train
model.fit(X_train, Y_train)

Now it’s time to determine whether our model accurately predicts calories burned or not. My model can now understand that calories burned will be more if the duration is more or the heart rate is more. So the model will predict calories based on training.

test_data_prediction = model.predict(X_test)
print(test_data_prediction)

Now it’s time to check the result that our model predicts is accurate or not. So we need to compare values predicted by the model with actual values. for that, we are using Mean Absolute error as follows:

mae = metrics.mean_absolute_error(Y_test, test_data_prediction)

So we can build a machine learning model to predict calories burned that accurately, we were able to draw some insights from the data via data analysis and visualization. 

Conclusion

Technology is beginning to play an increasingly crucial role as we enhance our route to value-based services. Any industry will thrive if technological innovation allows for more efficient and productive work operations, precisely what ML applications accomplish. As a result, it’s no script that healthcare app development companies are in high demand. Machine Learning(ML)-based healthcare apps are a fantastic method to help with health management.

The media shown in this article is not owned by Analytics Vidhya and is used at the Author’s discretion. 

I currently working as an Assistant professor in the Information technology department at SAL COLLEGE OF ENGINEERING, AHMEDABAD .I am currently doing Ph.D. in Medical Image processing. My research interest are computer vision, deep learning, machine learning, database etc.

Responses From Readers

Clear

Ankit Vaghela
Ankit Vaghela

Super Awesome Ma'am 👌

Sanjay
Sanjay

Excellent descriptions with all basics knowledge for easy understanding the whole technological techniques.

Anurag Panchal
Anurag Panchal

It's always nice to learn something new and explore new areas, as per current technical advancement from a student perspective this blog has helped a lot to understand various advancement and growth in machine learning in healthcare. Amazing!

Akshay
Akshay

Nice work and nicely explain

Congratulations, You Did It!
Well Done on Completing Your Learning Journey. Stay curious and keep exploring!

We use cookies essential for this site to function well. Please click to help us improve its usefulness with additional cookies. Learn about our use of cookies in our Privacy Policy & Cookies Policy.

Show details