Saturday, 24 August 2019

Basic steps for applying supervised machine learning algorithm linear regression with python (For beginner and learner only)

Packages need to import

import pandas as pd

import numpy as np

import matplotlib.pyplot as plt

import seaborn as sns

%matplotlib inline

from sklearn.model_selection import train_test_split

from sklearn.linear_model import LinearRegression

from sklearn import metrics


Step 1 - Used pandas for following parameters (importing data , get data info , describe data , data clening and analysis)


step 2 - used seaborn and matplotlib for ploting data in order to visualize it properly some most common visualization are join plot , pair plot ,distplot,scatter plot.


step 3 - split your data in to x and y on the bases of numerical columns 'x contain depennding parameter and y contain prediction paramter )

step 4 - using sklearn train_test_split method split your data in to test and train ex-
x_train , x_test , y_train , y_test = train_test_split(x ,y ,test_size = 0.3 , random_state =101)

step 5 - using regression find ( best fit , coeff_ , intersect )

step 6 - using regression find (predict value of test data )

spet 7 - visualize it accuracy using scatter plot with respect to y_test and prediction using matplotlib

step 8 -calculate mean_absolute_error , mean_squared_error , mean_squared_error with respect to prediction and y_test

step 9 - create dataframe for regression coeff

spet 10 - conclusion based on your analysis

No comments:

Post a Comment