Simple Linear Regression
The Simple Linear Regression model import pandas as pd import pylab as pl import matplotlib.pyplot as plt import numpy as np %matplotlib inline #url https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/ML0101ENv3/labs/FuelConsumptionCo2.csv #### Load Data #### df = pd.read_csv("FuelConsumption.csv") cdf = df[['ENGINESIZE','CYLINDERS','FUELCONSUMPTION_COMB','CO2EMISSIONS']] # Taking Engine Size as independent Value i.e., X and Dependent value as Co2 Emission i.e., y X = cdf[['ENGINESIZE']] y = cdf[['CO2EMISSIONS']] #### split dataset into train and test #### ''' Next, we have to split the dataset into training and testing. We will use the training dataset for training the model and then check the performance of the model on the test dataset. For this, we will use the train_test_split method from the library model_selection We are providing a test_size of 1/3 whic...