Skip to content

Commit 55a97ac

Browse files
committed
Pushing the docs to dev/ for branch: master, commit a717619b8b30f52fd0dad7c69e9473d8815f826d
1 parent 90ec119 commit 55a97ac

File tree

1,096 files changed

+3263
-3263
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,096 files changed

+3263
-3263
lines changed
-13 Bytes
Binary file not shown.
-13 Bytes
Binary file not shown.

dev/_downloads/plot_map_data_to_normal.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"outputs": [],
2828
"source": [
29-
"# Author: Eric Chang <[email protected]>\n# Nicolas Hug <[email protected]>\n# License: BSD 3 clause\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom sklearn.preprocessing import PowerTransformer\nfrom sklearn.preprocessing import QuantileTransformer\nfrom sklearn.model_selection import train_test_split\n\nprint(__doc__)\n\n\nN_SAMPLES = 1000\nFONT_SIZE = 6\nBINS = 30\n\n\nrng = np.random.RandomState(304)\nbc = PowerTransformer(method='box-cox')\nyj = PowerTransformer(method='yeo-johnson')\n# n_quantiles is set to the training set size rather than the default value\n# to avoid a warning being raised by this example\nqt = QuantileTransformer(n_quantiles=500, output_distribution='normal',\n random_state=rng)\nsize = (N_SAMPLES, 1)\n\n\n# lognormal distribution\nX_lognormal = rng.lognormal(size=size)\n\n# chi-squared distribution\ndf = 3\nX_chisq = rng.chisquare(df=df, size=size)\n\n# weibull distribution\na = 50\nX_weibull = rng.weibull(a=a, size=size)\n\n# gaussian distribution\nloc = 100\nX_gaussian = rng.normal(loc=loc, size=size)\n\n# uniform distribution\nX_uniform = rng.uniform(low=0, high=1, size=size)\n\n# bimodal distribution\nloc_a, loc_b = 100, 105\nX_a, X_b = rng.normal(loc=loc_a, size=size), rng.normal(loc=loc_b, size=size)\nX_bimodal = np.concatenate([X_a, X_b], axis=0)\n\n\n# create plots\ndistributions = [\n ('Lognormal', X_lognormal),\n ('Chi-squared', X_chisq),\n ('Weibull', X_weibull),\n ('Gaussian', X_gaussian),\n ('Uniform', X_uniform),\n ('Bimodal', X_bimodal)\n]\n\ncolors = ['firebrick', 'darkorange', 'goldenrod',\n 'seagreen', 'royalblue', 'darkorchid']\n\nfig, axes = plt.subplots(nrows=8, ncols=3, figsize=plt.figaspect(2))\naxes = axes.flatten()\naxes_idxs = [(0, 3, 6, 9), (1, 4, 7, 10), (2, 5, 8, 11), (12, 15, 18, 21),\n (13, 16, 19, 22), (14, 17, 20, 23)]\naxes_list = [(axes[i], axes[j], axes[k], axes[l])\n for (i, j, k, l) in axes_idxs]\n\n\nfor distribution, color, axes in zip(distributions, colors, axes_list):\n name, X = distribution\n X_train, X_test = train_test_split(X, test_size=.5)\n\n # perform power transforms and quantile transform\n X_trans_bc = bc.fit(X_train).transform(X_test)\n lmbda_bc = round(bc.lambdas_[0], 2)\n X_trans_yj = yj.fit(X_train).transform(X_test)\n lmbda_yj = round(yj.lambdas_[0], 2)\n X_trans_qt = qt.fit(X_train).transform(X_test)\n\n ax_original, ax_bc, ax_yj, ax_qt = axes\n\n ax_original.hist(X_train, color=color, bins=BINS)\n ax_original.set_title(name, fontsize=FONT_SIZE)\n ax_original.tick_params(axis='both', which='major', labelsize=FONT_SIZE)\n\n for ax, X_trans, meth_name, lmbda in zip(\n (ax_bc, ax_yj, ax_qt),\n (X_trans_bc, X_trans_yj, X_trans_qt),\n ('Box-Cox', 'Yeo-Johnson', 'Quantile transform'),\n (lmbda_bc, lmbda_yj, None)):\n ax.hist(X_trans, color=color, bins=BINS)\n title = 'After {}'.format(meth_name)\n if lmbda is not None:\n title += r'\\n$\\lambda$ = {}'.format(lmbda)\n ax.set_title(title, fontsize=FONT_SIZE)\n ax.tick_params(axis='both', which='major', labelsize=FONT_SIZE)\n ax.set_xlim([-3.5, 3.5])\n\n\nplt.tight_layout()\nplt.show()"
29+
"# Author: Eric Chang <[email protected]>\n# Nicolas Hug <[email protected]>\n# License: BSD 3 clause\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom sklearn.preprocessing import PowerTransformer\nfrom sklearn.preprocessing import QuantileTransformer\nfrom sklearn.model_selection import train_test_split\n\nprint(__doc__)\n\n\nN_SAMPLES = 1000\nFONT_SIZE = 6\nBINS = 30\n\n\nrng = np.random.RandomState(304)\nbc = PowerTransformer(method='box-cox')\nyj = PowerTransformer(method='yeo-johnson')\n# n_quantiles is set to the training set size rather than the default value\n# to avoid a warning being raised by this example\nqt = QuantileTransformer(n_quantiles=500, output_distribution='normal',\n random_state=rng)\nsize = (N_SAMPLES, 1)\n\n\n# lognormal distribution\nX_lognormal = rng.lognormal(size=size)\n\n# chi-squared distribution\ndf = 3\nX_chisq = rng.chisquare(df=df, size=size)\n\n# weibull distribution\na = 50\nX_weibull = rng.weibull(a=a, size=size)\n\n# gaussian distribution\nloc = 100\nX_gaussian = rng.normal(loc=loc, size=size)\n\n# uniform distribution\nX_uniform = rng.uniform(low=0, high=1, size=size)\n\n# bimodal distribution\nloc_a, loc_b = 100, 105\nX_a, X_b = rng.normal(loc=loc_a, size=size), rng.normal(loc=loc_b, size=size)\nX_bimodal = np.concatenate([X_a, X_b], axis=0)\n\n\n# create plots\ndistributions = [\n ('Lognormal', X_lognormal),\n ('Chi-squared', X_chisq),\n ('Weibull', X_weibull),\n ('Gaussian', X_gaussian),\n ('Uniform', X_uniform),\n ('Bimodal', X_bimodal)\n]\n\ncolors = ['#D81B60', '#0188FF', '#FFC107',\n '#B7A2FF', '#000000', '#2EC5AC']\n\nfig, axes = plt.subplots(nrows=8, ncols=3, figsize=plt.figaspect(2))\naxes = axes.flatten()\naxes_idxs = [(0, 3, 6, 9), (1, 4, 7, 10), (2, 5, 8, 11), (12, 15, 18, 21),\n (13, 16, 19, 22), (14, 17, 20, 23)]\naxes_list = [(axes[i], axes[j], axes[k], axes[l])\n for (i, j, k, l) in axes_idxs]\n\n\nfor distribution, color, axes in zip(distributions, colors, axes_list):\n name, X = distribution\n X_train, X_test = train_test_split(X, test_size=.5)\n\n # perform power transforms and quantile transform\n X_trans_bc = bc.fit(X_train).transform(X_test)\n lmbda_bc = round(bc.lambdas_[0], 2)\n X_trans_yj = yj.fit(X_train).transform(X_test)\n lmbda_yj = round(yj.lambdas_[0], 2)\n X_trans_qt = qt.fit(X_train).transform(X_test)\n\n ax_original, ax_bc, ax_yj, ax_qt = axes\n\n ax_original.hist(X_train, color=color, bins=BINS)\n ax_original.set_title(name, fontsize=FONT_SIZE)\n ax_original.tick_params(axis='both', which='major', labelsize=FONT_SIZE)\n\n for ax, X_trans, meth_name, lmbda in zip(\n (ax_bc, ax_yj, ax_qt),\n (X_trans_bc, X_trans_yj, X_trans_qt),\n ('Box-Cox', 'Yeo-Johnson', 'Quantile transform'),\n (lmbda_bc, lmbda_yj, None)):\n ax.hist(X_trans, color=color, bins=BINS)\n title = 'After {}'.format(meth_name)\n if lmbda is not None:\n title += r'\\n$\\lambda$ = {}'.format(lmbda)\n ax.set_title(title, fontsize=FONT_SIZE)\n ax.tick_params(axis='both', which='major', labelsize=FONT_SIZE)\n ax.set_xlim([-3.5, 3.5])\n\n\nplt.tight_layout()\nplt.show()"
3030
]
3131
}
3232
],

dev/_downloads/plot_map_data_to_normal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@
9494
('Bimodal', X_bimodal)
9595
]
9696

97-
colors = ['firebrick', 'darkorange', 'goldenrod',
98-
'seagreen', 'royalblue', 'darkorchid']
97+
colors = ['#D81B60', '#0188FF', '#FFC107',
98+
'#B7A2FF', '#000000', '#2EC5AC']
9999

100100
fig, axes = plt.subplots(nrows=8, ncols=3, figsize=plt.figaspect(2))
101101
axes = axes.flatten()

dev/_downloads/scikit-learn-docs.pdf

9.67 KB
Binary file not shown.

dev/_images/iris.png

0 Bytes
-928 Bytes
-928 Bytes
-680 Bytes
-680 Bytes

0 commit comments

Comments
 (0)