Skip to content

Commit 58ee8e7

Browse files
committed
Pushing the docs to dev/ for branch: master, commit f7a987ab530f5993d715b36f3af132dfad946db4
1 parent edc66de commit 58ee8e7

File tree

1,208 files changed

+3680
-3677
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,208 files changed

+3680
-3677
lines changed
Binary file not shown.

dev/_downloads/9481da9ed1cbf016109715bdf7e79a6f/plot_permutation_importance.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@
5151
# - ``random_cat`` is a low cardinality categorical variable (3 possible
5252
# values).
5353
X, y = fetch_openml("titanic", version=1, as_frame=True, return_X_y=True)
54-
X['random_cat'] = np.random.randint(3, size=X.shape[0])
55-
X['random_num'] = np.random.randn(X.shape[0])
54+
rng = np.random.RandomState(seed=42)
55+
X['random_cat'] = rng.randint(3, size=X.shape[0])
56+
X['random_num'] = rng.randn(X.shape[0])
5657

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

dev/_downloads/9e4e8e1cf9e1bc7322177aeb4a2af787/plot_permutation_importance.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
},
4545
"outputs": [],
4646
"source": [
47-
"X, y = fetch_openml(\"titanic\", version=1, as_frame=True, return_X_y=True)\nX['random_cat'] = np.random.randint(3, size=X.shape[0])\nX['random_num'] = np.random.randn(X.shape[0])\n\ncategorical_columns = ['pclass', 'sex', 'embarked', 'random_cat']\nnumerical_columns = ['age', 'sibsp', 'parch', 'fare', 'random_num']\n\nX = X[categorical_columns + numerical_columns]\n\nX_train, X_test, y_train, y_test = train_test_split(\n X, y, stratify=y, random_state=42)\n\ncategorical_pipe = Pipeline([\n ('imputer', SimpleImputer(strategy='constant', fill_value='missing')),\n ('onehot', OneHotEncoder(handle_unknown='ignore'))\n])\nnumerical_pipe = Pipeline([\n ('imputer', SimpleImputer(strategy='mean'))\n])\n\npreprocessing = ColumnTransformer(\n [('cat', categorical_pipe, categorical_columns),\n ('num', numerical_pipe, numerical_columns)])\n\nrf = Pipeline([\n ('preprocess', preprocessing),\n ('classifier', RandomForestClassifier(random_state=42))\n])\nrf.fit(X_train, y_train)"
47+
"X, y = fetch_openml(\"titanic\", version=1, as_frame=True, return_X_y=True)\nrng = np.random.RandomState(seed=42)\nX['random_cat'] = rng.randint(3, size=X.shape[0])\nX['random_num'] = rng.randn(X.shape[0])\n\ncategorical_columns = ['pclass', 'sex', 'embarked', 'random_cat']\nnumerical_columns = ['age', 'sibsp', 'parch', 'fare', 'random_num']\n\nX = X[categorical_columns + numerical_columns]\n\nX_train, X_test, y_train, y_test = train_test_split(\n X, y, stratify=y, random_state=42)\n\ncategorical_pipe = Pipeline([\n ('imputer', SimpleImputer(strategy='constant', fill_value='missing')),\n ('onehot', OneHotEncoder(handle_unknown='ignore'))\n])\nnumerical_pipe = Pipeline([\n ('imputer', SimpleImputer(strategy='mean'))\n])\n\npreprocessing = ColumnTransformer(\n [('cat', categorical_pipe, categorical_columns),\n ('num', numerical_pipe, numerical_columns)])\n\nrf = Pipeline([\n ('preprocess', preprocessing),\n ('classifier', RandomForestClassifier(random_state=42))\n])\nrf.fit(X_train, y_train)"
4848
]
4949
},
5050
{
Binary file not shown.

dev/_downloads/scikit-learn-docs.pdf

-13 KB
Binary file not shown.

dev/_images/iris.png

0 Bytes
342 Bytes
342 Bytes
639 Bytes
639 Bytes

0 commit comments

Comments
 (0)