0
$\begingroup$

I've recently started playing SciKit ML. I just got my hands on classification algorithms (SGDClassifier, LinearSVC) and I'm not sure how to properly represent feature labels.

Suppose I'm trying to predict a football match outcome. Given N features the result is either 1=WIN or X=DRAW or 2=LOSS. Can/should I label my features using string values?

Eg.:

X_train = [[n0, n1, …, nn], …]
y_train = ['1', 'X', '2', …]

Or maybe I should use boolean matrices instead, like [win,draw,loss], eg:

y_train = [[1,0,0], [0,1,0], [0,0,1], …]

Or maybe I should use a single digit to map each label 1=win and 0=draw, -1=loss, eg:

y_train = [1, 0, -1]

Which one would be best to pick and why? I'm a newbie, thank you for your patience.

$\endgroup$

1 Answer 1

1
$\begingroup$

Mutually exclusive classes are usually integers; in your case, win=0, draw=1, loss=2 (for instance).

It is mostly a convention and is convenient for implementation.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.