-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Description
the function dataset3Params on Excercice6 declares an array calls 'my_array' but uses another undeclared one called 'err_array'
`def dataset3Params(X, y, Xval, yval):
C = 1
sigma = 0.3
# ====================== YOUR CODE HERE ======================
C_array = np.array([0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30])
sigma_array = np.array([0.01, 0.03, 0.1, 0.3, 1, 3, 10, 30])
**my_array** = np.zeros([C_array.size, sigma_array.size])
for i in np.arange(C_array.size):
for j in np.arange(sigma_array.size):
model= utils.svmTrain(X, y, C_array[i], gaussianKernel, args=(sigma_array[j],))
predictions = utils.svmPredict(model, Xval)
pred_error = np.mean(predictions != yval)
**err_array**[i, j] = pred_error
ind = np.unravel_index(np.argmin(err_array, axis = None), err_array.shape)
C = C_array[ind[0]]
sigma = sigma_array[ind[1]]
# ============================================================
return C, sigma`
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels