Regarding accuracy after submission

here is my code, after submission accuracy is found to be 10% only, how should i improvise the code to get better accuracy.

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

dfx = pd.read_csv(’…/Linear_X_Train.csv’)
dfy = pd.read_csv(’…/Linear_Y_Train.csv’)
dfxx = pd.read_csv(’…/Linear_X_Test.csv’)

x = dfx.to_numpy()
y = dfy.to_numpy()
xx = dfxx.to_numpy()
x_new = (x-x.mean())/x.std()
y_new = y
xx_new = xx
plt.scatter(x_new,y_new)
#plt.show()

#def difference(x_new,y_new,theta):

theta[0] * x_new[i] + theta[1] - y_new[i]

theta[0] * x_new[i] + theta[1] - y_new[i]

def error(x_new,y_new,theta):
er = 0

for i in range(x_new.shape[0]):
    er = er + ( (theta[0] * x_new[i] + theta[1]) - y_new[i]) ** 2 
return er

def gradient(x_new,y_new,theta):
gradi = np.zeros((2,))
for i in range(x_new.shape[0]):
gradi[0] = (theta[0] * x_new[i] + theta[1] - y_new[i]) * x_new[i]
gradi[1] = (theta[0] * x_new[i] + theta[1] - y_new[i])
return gradi

def descent(x_new,y_new,rate=0.001):
theta = np.zeros((2,))
itr = 0
err_list = []
while (itr <= 1000):
e = error(x_new,y_new,theta)
err_list.append(e)
grad = gradient(x_new,y_new,theta)
theta[0] = theta[0] - rate * grad[0]
theta[1] = theta[1] - rate * grad[1]
itr = itr + 1
return theta,err_list

slope_inter,list_error = descent(x_new,y_new,rate=0.001)

plt.plot(list_error)
plt.show()
#print(list_error[0])
#plt.scatter(x_new,y_new,color=‘blue’)
#plt.show()
#plt.scatter(x_new,slope_inter[0]*x_new+slope_inter[1],marker=’^’,color=‘orange’)
#plt.show()
#plt.scatter(xx_new,slope_inter[0]*xx_new+slope_inter[1],marker=’^’,color=‘orange’)
#plt.show()

lm = np.zeros((1250))
lm1 = np.zeros((1250))
for i in range(1250):
lm[i] = slope_inter[0]*xx_new[i]+slope_inter[1]
#print(lm[0],lm[1])
file = np.savetxt(’…/test_y.csv’,lm,delimiter=","‘w+’)

Thanks for sharing code with us because now I want to join the best Machine learning training in Delhi and complete my projects.

Hey Amit,
Please run your code once on the Coding Blocks’ IDE and share the link with me.
I’ll get back to you on how you can improve it.