2
$\begingroup$

I have a dataset as below:

     Key Attr1 Attr2 Attr3 Attr4 Attr5 Attr6
     kd1 l1    l2     l3    l4   l5     l6
     kd1 l1    l7     l8    l9   l5     l10
     kd1 l11   l12    l13   l14  l5     l10
     kd1 ..................................
      .
      .
      .
     kd2 ..................................
     kd2 ..................................
      .
      .
     kd3 ..................................
      .
      .
      .

For each instance, I have multiple combinations of target outputs(Attr1-Attr6). Whenever I use multilabel libraries, I get a single combination of outputs.

I want a ranked list(top 3) of target label classifications for each key given as input.

For example:

predict('kd1') should return the following:

res = [ [l1,l7,l8,l9,l10], [l1,l2,l3,l4,l5,l6], [l11,l12,l13,l14,l5,l10] ]

Here res[0] is the best combination, res[1] is the second best combination and so on.

How do I go about that?

$\endgroup$
0
$\begingroup$

the task seems very hard to understand what you want to achieve as you say that there several equally good representation for each data key... In other words, you say following?

kd1 = l1 + l2 + l3 + l4 + l5 + l6
kd1 = l1 + l7 + l8 + l9   l5 + l10
kd1 = l11 + l12 + l13 + l14 + l5 + l10
kd1 = ...
|improve this answer|||||
$\endgroup$
  • $\begingroup$ No, Not 'equally good' because the combination of labels can repeat different number of times. For example kd1 = l1 + l2 + ... can occur 23 times in the dataframe and kd1 = l11 + l12 + l13 + ... can occur only 3 times. Here each combination of target labels has a different occurence count. I hope this makes it more clear. $\endgroup$ – EmperorPenguin Jan 5 '19 at 13:30
  • $\begingroup$ Currently I've concatenated the targets and made a new column called 'targetsTogether' so it reduces to a multi-class classification and then predict_proba gives the other possible combination probabilities. Then I split the output back into labels. But i want to know if there's another way $\endgroup$ – EmperorPenguin Jan 5 '19 at 13:35
  • $\begingroup$ so the order in dataframe matters, saying that kd1 = l1 + l2 + l3 + l4 + l5 + l6 is better then kd1 = l1 + l7 + l8 + l9 l5 + l10... and how much better? I think that it would be great to give an simple real-world example / illustrations. Is it like anmal describtion where atributes are eye, head, leg, etc.? $\endgroup$ – Jirka B. Jan 6 '19 at 10:16

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.