Double values for x making a problem


I have problem in the following code:

training_set, validation_set = train_test_split(aaron_judge, random_state = 1) for i in range(6): for k in range(6): classifier = SVC(kernel = 'rbf', gamma = [i], C = [k])[['plate_x', 'plate_z']], training_set.type) current = classifier.score(validation_set[['plate_x', 'plate_z']], validation_set.type ) if maximum < current: maximum = current cecko = k icko = i print(maximum, cecko, icko)

The thrown error is: TypeError: must be real number, not list
I guess the problem is this: [[‘plate_x’, ‘plate_z’]]
but I need both values as the ‘x_value’ consists of both of these while the label consists of only the ‘type’ column.
What should I do? Or what is exactly the problem?

When you’re creating classifier, you don’t need the [ ] around i or k.
It’s expecting those values to be numbers, but the brackets make it treat them as a list - hence the error.

The rest looks good as far as I can see.

Right!! Thank you very much!

1 Like