Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typo in err_array #18

Open
Maqil opened this issue Mar 31, 2022 · 0 comments
Open

Typo in err_array #18

Maqil opened this issue Mar 31, 2022 · 0 comments

Comments

@Maqil
Copy link

Maqil commented Mar 31, 2022

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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant