first
download the dataset links in this link
https://drive.google.com/drive/folders/1tzFtW4qGA3nyYErD-zjvmSppTikIYyEy?usp=sharing
SOURCE CODE:#used to get top five rows in the dataset
df.describe()
df.isnull().sum()
df.info()
x=df.Hours
x.head()
y=df.Scores
y.head()
iterations=1000
n=len(df)
n
n=len(df)
c=0
m=0
L=0.01
loss = []
for i in range(1000):
y_pred=m * x + c
MSE=(1/n)*sum((y_pred-y)**2)
dm=(2/n)*sum(x*(y_pred-y))
dc=(2/n)*sum((y_pred-y))
c=c-L*dc
m=m-L*dm
loss.append(MSE)
print(m,c)
ypred = m*x+c
ypred
plt.scatter(x,y,color="blue")
plt.plot(x,y_pred)
plt.xlabel("Study hours")
plt.ylabel("Scores")
plt.title("Study hours vs Scores")
plt.plot(loss)
plt.xlabel("iterations")
plt.ylabel("loss")
Output:
DATA_HEAD :
DATA_DESCRIBE :
m & c :
GRAPHS:
In the
given link the above code available
https://colab.research.google.com/drive/1IVGE5m52soY-aJ9ZfsysoKKtfLYJOPrc?usp=sharing
Comments