# Calories Burned Prediction with Python

Machine Learning Project on Calories burned prediction with Python.

We all know that the amount of calories we burn is all dependent on the number of physical movements and exercises we do. In this article, I will take you through a very simple Machine Learning task on Calories Burned Prediction with Python programming language.

## Calories Burned Prediction with Python

I will start this machine learning project on the task of calories burned prediction with Python by importing the libraries and datasets that we need:

Also, Read – 100+ Machine Learning Projects Solved and Explained.

Now let’s read the datasets and merge them for further analysis:

Now let’s visualize the dataset to see what we are going to work with in terms of Calories burned vs Duration of Exercise:

Now we need to create the features and a response:

```X = df.loc[:, ['Intercept', 'Duration']]
y = df.loc[:, 'Calories']```

Now, I will implement a linear regression algorithm without using any library to demonstrate how we can prepare our own machine learning algorithm:

```Intercept calculated by hand: -21.82810252605084
Slope calculated by hand:  7.169783349587853```
```print('Exercising for 15.5 minutes will burn an estimated {:.2f} calories.'.format(
by_hand_coefs + by_hand_coefs * 15.5))```
`Exercising for 15.5 minutes will burn an estimated 89.30 calories.`

Now to verify that we have created a good algorithm let’s use the linear regression model provided by Scikit-Learn:

```Intercept from library: -21.82810252605087
Slope from library: 7.169783349587856```

As you can see our prediction of algorithm created by me is very similar to the prediction of linear regression model provided by Scikit-Learn library in Python.

I hope you liked this article on a very simple Machine Learning project on calories burned prediction with Python programming language. Feel free to ask your valuable questions in the comments section below. #### I am a programmer from India, and I am here to guide you with Data Science, Machine Learning, Python, and C++ for free. I hope you will learn a lot in your journey towards Coding, Machine Learning and Artificial Intelligence with me.

1. Great comparison excercise, using theorical regresion and sci.kit.learn library, thanks Aman

• thanks for your valuable feedback, keep visiting us

2. SSR

Really a great work Aman. Thanks for sharing with the public.

• Thanks, Keep visiting

3. Rohan K S

i am not able to download the dataset, please can you help me out to get the dataset