Skip to content

Commit

Permalink
Fixing Errors
Browse files Browse the repository at this point in the history
  • Loading branch information
vivek3141 committed Mar 25, 2019
1 parent b5d82af commit a0eb90d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ml/linear_regression/lreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,13 @@ def fit(self, data, labels, lr=0.01, graph=False, steps=1000, init_theta=(1, 1))
:param init_theta: Initial theta values
:return: Cost of the model
"""
theta = init_theta
x = data
y = labels
n = len(x)
self.theta = lin_reg.fit(list(data), list(
labels), lr, steps, list(init_theta), len(data))

if graph:
x_line = np.array([min(x), max(x)])
x_line = np.array([min(data), max(data)])
y_line = self.theta[0] * x_line + self.theta[1]
plt.scatter(x, y, c="RED")
plt.scatter(data, labels, c="RED")
plt.plot(x_line, y_line)
plt.show()
return
Expand Down

0 comments on commit a0eb90d

Please sign in to comment.