Skip to content

Commit

Permalink
DOC adds a random seed to plot_permutation_importance example (scikit…
Browse files Browse the repository at this point in the history
  • Loading branch information
adrinjalali authored and NicolasHug committed Sep 23, 2019
1 parent d26a969 commit f7a987a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/inspection/plot_permutation_importance.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@
# - ``random_cat`` is a low cardinality categorical variable (3 possible
# values).
X, y = fetch_openml("titanic", version=1, as_frame=True, return_X_y=True)
X['random_cat'] = np.random.randint(3, size=X.shape[0])
X['random_num'] = np.random.randn(X.shape[0])
rng = np.random.RandomState(seed=42)
X['random_cat'] = rng.randint(3, size=X.shape[0])
X['random_num'] = rng.randn(X.shape[0])

categorical_columns = ['pclass', 'sex', 'embarked', 'random_cat']
numerical_columns = ['age', 'sibsp', 'parch', 'fare', 'random_num']
Expand Down

0 comments on commit f7a987a

Please sign in to comment.