0
$\begingroup$

I am using (and loving) Orange 3 for some projects at my school and have a question:

When using Python and e.g. doing a RandomForest Classification, I can easily access the feature importances by feature_importances_

In Orange 3 there seems to be no feature to access that in the visual programming interface (would be a great add-on), so I tried to write my own python script in orange...

I linked the RandomForest Classifier to the Python script widget's in_classifier and have the following code:

print(in_classifier)
importances = in_classifier.feature_importances_

The result is however:

Random Forest Classification {'random_state': 0, 'n_estimators': 500, 'n_jobs': 1, 'min_samples_leaf': 1, 'max_leaf_nodes': None, 'max_features': 'auto', 'bootstrap': True, 'verbose': 0, 'max_depth': None, 'oob_score': False, 'min_samples_split': 2, 'class_weight': None, 'min_weight_fraction_leaf': 0.0, 'criterion': 'gini'}
    Traceback (most recent call last):
      File "", line 1, in 
      File "", line 2, in 
    AttributeError: 'RandomForestClassifier' object has no attribute 'feature_importances_'

=> I don't understand whey the RandomForestClassifier Object doesn't provide this array?

Anyone any idea?

many thanks!!

$\endgroup$

1 Answer 1

2
$\begingroup$

You can connect Random Forest widget into Rank widget, which I guess is meant for subset feature selection. See Orange screenshot #19.

Model-based feature selection with Orange Rank widget

$\endgroup$

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.