Last active
October 12, 2021 13:43
-
-
Save lucasastorian/2919fee08aece037d8af0946b0cd7a26 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| feature_importances = pd.DataFrame(columns=['mean', 'std']) | |
| for feature in features: | |
| # Calculate an array of OOS CV scores (placeholder function) | |
| cv_scores = get_cv_scores(rf, X[feature], y, sample_weights) | |
| # Set the mean and std OOS score for each feature | |
| feature_importances[feature, 'mean'] = cv_scores.mean() | |
| feature_importances[feature, 'std'] = cv_scores.std() * cv_scores.shape[0]**-.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment