I am working on a simple linear regression model,
This is my Python code :
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset=pd.read_csv('sample.csv')
X=dataset.iloc[:,:-1].values
Y=dataset.iloc[:,1].values
from sklearn.model_selection import train_test_split
X_train,X_test,Y_train,Y_test=train_test_split(X,Y,test_size=1/3)
from sklearn.linear_model import LinearRegression
regressor=LinearRegression()
regressor.fit(X_train,Y_train)
plt.scatter(X_train,Y_train,color='red')
plt.plot(X_train,regressor.predict(X_train),color='blue')
plt.title('X vs Y(Training Set)')
plt.xlabel('X')
plt.ylabel('Y')
plt.show()
plt.scatter(X_test,Y_test,color='red')
plt.plot(X_train,regressor.predict(X_train),color='blue')
plt.title('X vs Y(Test Set)')
plt.xlabel('X')[enter image description here][1]
plt.ylabel('Y')
plt.show()`
This is my plot of Training Set Training Set This is my plot of Test Set Test Set
How can I increase the efficiency of my ML model??? This is my first ML model, so all suggestions are welcome. Thanks in Advance