In this example, we try to walk through the process of designing a machine learning program that analyzes a set of data and predicts an output. By this example, we like to present a rough sketch of how real-world solutions are made using python and machine learning libraries.
What we are trying to accomplish?
We want to know if money makes people happy from a dataset we have.
What all things we need
- Better Life Index – Edition 2017 <https://stats.oecd.org/index.aspx?DataSetCode=BLI>
- Report for Selected Countries and Subjects <https://tinyurl.com/y8g8yj76>
You will end up with a CSV file and a XLS file Copy both the files to a new folder.
Start a python file with Example1.py and put the codes below
Here we use the application of a simple linear model defined by the following formula
Let Life Satisfaction = L
Let GDP Per Capita = G
This model has two model parameters and
By tweaking these parameters, you can make your model represent any linear function the value of
is defined using utility functions and cost functions, here the utility function tells how good the model is, while the cost function tells how bad our model is. For linear regression problems, people typically use a cost function that measures the distance between the linear model’s predictions and the training examples; the objective is to minimize this distance.
for our case lets assume the following values
We will discuss how we reached these values, when we discuss under the hood mathematics of regression.