2
$\begingroup$

I have been doing a problem in which I have to predict probabilities for each of the labels in a multi-label (four to be precise) classification problem.

Example of a solution:

Id, North,          East,            West,           South
1,  0.71663940211,  0.037567315693,  0.03525987339,  0.0021068944991
...

The training data is of the form where each y(i) is labelled either 0,1,2 or 3 (encoded for N,E,W & S respectively)

I will be grateful if you can just tell me how to approach this problem. Links giving direct insight to the problem will also sufficient.

$\endgroup$
1
$\begingroup$

A question is a bit broaden as you do not specify if you do not know how to do it in theory or how to tackle it with a ML method.

Some of ML methods:

LogisticRegression in sklearn handles multiple class

lr = LogisticRegression()
lr.fit(X, y)
class_probabilities = lr.predict_proba(X)  # outputs the probabilities

You might also want to consider Support Vector Machines.

Theory:

You can do a "one vs rest" when you train a single classifier per class taking the sample of all other classes as negative example. (see wiki article for that)

| improve this answer | |
$\endgroup$
  • $\begingroup$ @Kokatjuhha: Thanks a lot. Just a follow up question. What is the order of the class_probabilities? $\endgroup$ – vizakshat Jun 5 '17 at 6:03
  • 1
    $\begingroup$ @vizakshat classes are ordered as they are in self.classes_. $\endgroup$ – Jekaterina Kokatjuhha Jun 10 '17 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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