-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
`
def oneVsAll(X, y, num_labels, lambda_):
# Some useful variables
m, n = X.shape
# You need to return the following variables correctly
all_theta = np.zeros((num_labels, n + 1))
# Add ones to the X data matrix
X = np.concatenate([np.ones((m, 1)), X], axis=1)
# ====================== YOUR CODE HERE ======================
initial_theta = np.zeros((n+1,1))
options = {'maxiter': 50}
for c in np.arange(1, num_labels+1):
res = optimize.minimize(lrCostFunction,
initial_theta,
(X, (y == c), lambda_),
jac=True,
method='TNC',
options=options)
all_theta[c-1] = res.x
# ============================================================
return all_theta
`
Hi,Dib,
Could you please tell me what's wrong with my code? I am confused.
Thanks.
Metadata
Metadata
Assignees
Labels
No labels