Skip to content

Commit f018ddc

Browse files
authored
requested changes addressed
1 parent ade3ed3 commit f018ddc

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

machine_learning/logistic_regression.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ def sigmoid_function(z):
3131
def cost_function(h,y):
3232
return (-y*np.log(h)-(1-y)*np.log(1-h)).mean()
3333

34-
# here alpha is the learning rate, X is the featue matrix,y is the target matrix
34+
# here alpha is the learning rate, X is the feature matrix,y is the target matrix
3535
def logistic_reg(alpha,X,y,max_iterations=70000):
3636
converged=False
3737
iterations=0
3838
theta=np.zeros(X.shape[1])
3939

40-
num_iterations=0
40+
4141
while not converged:
4242
z=np.dot(X,theta)
4343
h=sigmoid_function(z)
@@ -46,9 +46,9 @@ def logistic_reg(alpha,X,y,max_iterations=70000):
4646

4747
z=np.dot(X,theta)
4848
h=sigmoid_function(z)
49-
e=cost_function(h,y)
50-
print('J=',e)
51-
J=e
49+
J=cost_function(h,y)
50+
51+
5252

5353
iterations+=1 #update iterations
5454

0 commit comments

Comments
 (0)