0
$\begingroup$

Here is the sample data I have:

Tag 1(Val: X), Tag 2(Val: Y), Tag 3(Val: Z), Label (Val: P)

Tag 1(Val: A), Tag 2(Val: B), Tag 3(Val: C), Label (Val: Q)

Tag 1(Val: D), Tag 2(Val: E), Tag 3(Val: F), Label (Val: R)

Tag 1(Val: G), Tag 2(Val: H), Tag 3(Val: I), Label (Val: S)

I am using Scikit Learn Random Forest Classifier. I want the Classifier to give higher priority to certain inputs. For Example: 100x priority to Tag 1: 10x priority to Tag 2: 1x priority to Tag 3.

Does Scikit-Learn have any parameters where I can specify this?

[Since the purpose of the Random Forest is to learn the priority of the inputs, is my question nonsensical?]

Appreciate your insight and support.

$\endgroup$
1
  • $\begingroup$ Is label your output? If so, you can give parameter class_weight while fitting model. $\endgroup$
    – Ankit Seth
    Commented Feb 22, 2018 at 5:21

1 Answer 1

2
$\begingroup$

You've kind of answered your own question there!

One of the strengths of machine learning with algorithms like Random Forests is that they are able to determine the feature (input) importance themselves. My advice would not be to weight them for now (not sure you actually can with SKLearn's RF) and let the model determine it itself.

What you can do is give additional weight to the rows (observations) of your data set, or give additional weight to different classes of the label (for example, if there aren't many 'P's in your label but they're important, you can bump up their weight relative to the other classes).

$\endgroup$
1
  • $\begingroup$ I agree that setting initial weights is unnecessary for random forests. Have a look at the algorithm for decision trees: You will see that Tag 1 will automatically be selected if it is more important than the other tags. Other algorithms, Neural Networks for instance, do benefit from good starting value. They can ensure that the algorithm does not get stuck in suboptimal local minima. $\endgroup$ Commented Feb 22, 2018 at 10:00

Your Answer

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

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