Problem 3: Extract and Display Feature Importances
Easypython
Problem Description
Write a Python program that trains a Random Forest on a dataset with 3 named features, and prints each feature alongside its importance score, sorted from most to least important.
Input
A labeled dataset with 3 features and their names.
Output
Each feature name paired with its importance score, sorted descending.
Constraints
- At least 8 labeled training examples.
Example Input
textfeatures=["hours_studied","attendance","previous_score"]
Example Output
textprevious_score: 0.50 hours_studied: 0.30 attendance: 0.20
Concepts Covered
feature_importances_, sorting, zip().