Skip to content
C

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

text
features=["hours_studied","attendance","previous_score"]

Example Output

text
previous_score: 0.50 hours_studied: 0.30 attendance: 0.20

Concepts Covered

feature_importances_, sorting, zip().

Input (stdin)

Output

Run your code to see output here...