An Example of Machine Learning with Scikit

An Example of Machine Learning with Scikit

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

Datasets

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

Then

This model has two model parameters and

By tweaking these parameters, you can make your model represent any linear function the value of

and

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.

 

 

Phone: 512-539-0390
NJ Training Academy Inc , 405 Dry Gulch Bend
Cedar Park, Texas, 78613