Skip to content

Commit 4cc99d0

Browse files
committed
Pushing the docs to dev/ for branch: master, commit eeddc17a85cd117d55d60b3c3da9a16955d838cf
1 parent de44713 commit 4cc99d0

File tree

1,246 files changed

+3840
-3851
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,246 files changed

+3840
-3851
lines changed
Binary file not shown.

dev/_downloads/26f110ad6cff1a8a7c58b1a00d8b8b5a/plot_column_transformer_mixed_types.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-
"numeric_features = ['age', 'fare']\nnumeric_transformer = Pipeline(steps=[\n ('imputer', SimpleImputer(strategy='median')),\n ('scaler', StandardScaler())])\n\ncategorical_features = ['embarked', 'sex', 'pclass']\ncategorical_transformer = Pipeline(steps=[\n ('imputer', SimpleImputer(strategy='constant', fill_value='missing')),\n ('onehot', OneHotEncoder(handle_unknown='ignore'))])\n\npreprocessor = ColumnTransformer(\n transformers=[\n ('num', numeric_transformer, numeric_features),\n ('cat', categorical_transformer, categorical_features)])\n\n# Append classifier to preprocessing pipeline.\n# Now we have a full prediction pipeline.\nclf = Pipeline(steps=[('preprocessor', preprocessor),\n ('classifier', LogisticRegression())])\n\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2,\n random_state=0)\n\nclf.fit(X_train, y_train)\nprint(\"model score: %.3f\" % clf.score(X_test, y_test))"
47+
"numeric_features = ['age', 'fare']\nnumeric_transformer = Pipeline(steps=[\n ('imputer', SimpleImputer(strategy='median')),\n ('scaler', StandardScaler())])\n\ncategorical_features = ['embarked', 'sex', 'pclass']\ncategorical_transformer = OneHotEncoder(handle_unknown='ignore')\n\npreprocessor = ColumnTransformer(\n transformers=[\n ('num', numeric_transformer, numeric_features),\n ('cat', categorical_transformer, categorical_features)])\n\n# Append classifier to preprocessing pipeline.\n# Now we have a full prediction pipeline.\nclf = Pipeline(steps=[('preprocessor', preprocessor),\n ('classifier', LogisticRegression())])\n\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2,\n random_state=0)\n\nclf.fit(X_train, y_train)\nprint(\"model score: %.3f\" % clf.score(X_test, y_test))"
4848
]
4949
},
5050
{

dev/_downloads/3c3c738275484acc54821615bf72894a/plot_permutation_importance.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,13 @@
6363
X_train, X_test, y_train, y_test = train_test_split(
6464
X, y, stratify=y, random_state=42)
6565

66-
categorical_pipe = Pipeline([
67-
('imputer', SimpleImputer(strategy='constant', fill_value='missing')),
68-
('onehot', OneHotEncoder(handle_unknown='ignore'))
69-
])
66+
categorical_encoder = OneHotEncoder(handle_unknown='ignore')
7067
numerical_pipe = Pipeline([
7168
('imputer', SimpleImputer(strategy='mean'))
7269
])
7370

7471
preprocessing = ColumnTransformer(
75-
[('cat', categorical_pipe, categorical_columns),
72+
[('cat', categorical_encoder, categorical_columns),
7673
('num', numerical_pipe, numerical_columns)])
7774

7875
rf = Pipeline([
@@ -122,8 +119,7 @@
122119
# predictions that generalize to the test set (when the model has enough
123120
# capacity).
124121
ohe = (rf.named_steps['preprocess']
125-
.named_transformers_['cat']
126-
.named_steps['onehot'])
122+
.named_transformers_['cat'])
127123
feature_names = ohe.get_feature_names(input_features=categorical_columns)
128124
feature_names = np.r_[feature_names, numerical_columns]
129125

Binary file not shown.

dev/_downloads/79c38d2f2cb1f2ef7d68e0cc7ea7b4e4/plot_column_transformer_mixed_types.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@
7272
('scaler', StandardScaler())])
7373

7474
categorical_features = ['embarked', 'sex', 'pclass']
75-
categorical_transformer = Pipeline(steps=[
76-
('imputer', SimpleImputer(strategy='constant', fill_value='missing')),
77-
('onehot', OneHotEncoder(handle_unknown='ignore'))])
75+
categorical_transformer = OneHotEncoder(handle_unknown='ignore')
7876

7977
preprocessor = ColumnTransformer(
8078
transformers=[

dev/_downloads/f99bb35c32eb8028063a1428c3999b84/plot_permutation_importance.ipynb

Lines changed: 2 additions & 2 deletions
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)\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)"
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_encoder = OneHotEncoder(handle_unknown='ignore')\nnumerical_pipe = Pipeline([\n ('imputer', SimpleImputer(strategy='mean'))\n])\n\npreprocessing = ColumnTransformer(\n [('cat', categorical_encoder, 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
{
@@ -80,7 +80,7 @@
8080
},
8181
"outputs": [],
8282
"source": [
83-
"ohe = (rf.named_steps['preprocess']\n .named_transformers_['cat']\n .named_steps['onehot'])\nfeature_names = ohe.get_feature_names(input_features=categorical_columns)\nfeature_names = np.r_[feature_names, numerical_columns]\n\ntree_feature_importances = (\n rf.named_steps['classifier'].feature_importances_)\nsorted_idx = tree_feature_importances.argsort()\n\ny_ticks = np.arange(0, len(feature_names))\nfig, ax = plt.subplots()\nax.barh(y_ticks, tree_feature_importances[sorted_idx])\nax.set_yticklabels(feature_names[sorted_idx])\nax.set_yticks(y_ticks)\nax.set_title(\"Random Forest Feature Importances (MDI)\")\nfig.tight_layout()\nplt.show()"
83+
"ohe = (rf.named_steps['preprocess']\n .named_transformers_['cat'])\nfeature_names = ohe.get_feature_names(input_features=categorical_columns)\nfeature_names = np.r_[feature_names, numerical_columns]\n\ntree_feature_importances = (\n rf.named_steps['classifier'].feature_importances_)\nsorted_idx = tree_feature_importances.argsort()\n\ny_ticks = np.arange(0, len(feature_names))\nfig, ax = plt.subplots()\nax.barh(y_ticks, tree_feature_importances[sorted_idx])\nax.set_yticklabels(feature_names[sorted_idx])\nax.set_yticks(y_ticks)\nax.set_title(\"Random Forest Feature Importances (MDI)\")\nfig.tight_layout()\nplt.show()"
8484
]
8585
},
8686
{

dev/_downloads/scikit-learn-docs.pdf

35.1 KB
Binary file not shown.

dev/_images/binder_badge_logo.png

0 Bytes

dev/_images/iris.png

0 Bytes
-101 Bytes
-101 Bytes
173 Bytes
-1.04 KB
-222 Bytes
-222 Bytes
189 Bytes
-112 Bytes
-112 Bytes
36 Bytes
-70 Bytes
-70 Bytes
-122 Bytes
-21 Bytes
-1 Bytes
208 Bytes
1.45 KB
789 Bytes
46 Bytes
46 Bytes
-410 Bytes
-410 Bytes
91 Bytes
91 Bytes
-90 Bytes
-90 Bytes
212 Bytes
212 Bytes
92 Bytes
92 Bytes
69 Bytes
69 Bytes
205 Bytes
76 Bytes
163 Bytes
163 Bytes
-154 Bytes
-16 Bytes
-342 Bytes
-239 Bytes
-81 Bytes
-81 Bytes
-117 Bytes
10 Bytes

dev/_sources/auto_examples/applications/plot_face_recognition.rst.txt

Lines changed: 5 additions & 5 deletions

dev/_sources/auto_examples/applications/plot_model_complexity_influence.rst.txt

Lines changed: 15 additions & 15 deletions

0 commit comments

Comments
 (0)