From 88f728c5889cd451761c859473515ebec7cf8903 Mon Sep 17 00:00:00 2001 From: gayatrig21 <85159749+gayatrig21@users.noreply.github.com> Date: Sat, 26 Feb 2022 11:53:03 +0530 Subject: [PATCH 1/2] Assignment 2 code file --- assignment2.py | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 assignment2.py diff --git a/assignment2.py b/assignment2.py new file mode 100644 index 0000000..1c7015a --- /dev/null +++ b/assignment2.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +"""Assignment2.ipynb + +Automatically generated by Colaboratory. + +Original file is located at + https://colab.research.google.com/drive/1uLqr_xv_w9FyRqQyk7gDjuOH39EVvHXG +""" + +from google.colab import drive +drive.mount('/content/drive') + +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt + +from sklearn.linear_model import LinearRegression +from sklearn.model_selection import train_test_split + +print('Booting into Machine Learning....') + +data=pd.read_csv('/content/drive/MyDrive/hour.csv') + +data.head(10) + +print('Defining variables') +X = data['atemp'] +y = data['registered'] + +plt.scatter(X,y, color='green') + +print('Splitting the data into hour') +X_hour, X_test, y_hour, y_test = train_test_split(X,y,random_state=0) + +plt.scatter(X_hour,y_hour, color='green') + +plt.scatter(X_test,y_test, color='green') + +print('Training the model using X_hour, y_hour') +lr = LinearRegression() + +#print(X_hour) +#print(y_hour) +#print(X_hour.values.reshape(-1,1)) +lr.fit(X_hour.values.reshape(-1,1),y_hour) + +print('Predicting using the trained model - X_hour') +y_pred=lr.predict(X_test.values.reshape(-1,1)) + +print(y_test) #Test data - actual data +print(y_pred) #Model predicted dataset + +plt.scatter(X_hour,y_hour,color='green') +plt.scatter(X_test,y_pred,color='red') + +plt.xticks() +plt.yticks() +plt.show() + +print('Finding intercept & coeff') +print('Intercept', lr.intercept_) +print('Coefficient', lr.coef_) +print(lr.coef_,'x +',lr.intercept_) \ No newline at end of file From 76390beccc6c45c1ce4b572df39f4ee860d0a74a Mon Sep 17 00:00:00 2001 From: gayatrig21 <85159749+gayatrig21@users.noreply.github.com> Date: Sat, 26 Feb 2022 11:54:41 +0530 Subject: [PATCH 2/2] 2020BTECS00210 updated file!! --- Student assignment updates.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Student assignment updates.txt b/Student assignment updates.txt index 9979d7c..c8acc77 100644 --- a/Student assignment updates.txt +++ b/Student assignment updates.txt @@ -1,2 +1,3 @@ -Write your name and PRN no +Name:Gayatri Sopan Gade +PRN:2020BTECS00210 Hello Updated