.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_examples/scikits/plot_param_grid.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr__examples_scikits_plot_param_grid.py: 04. ParamGrid ============= This example shows different configurations of ParamGrid. .. GENERATED FROM PYTHON SOURCE LINES 7-33 .. code-block:: default :lineno-start: 8 # Generic import pandas as pd # Library from sklearn.model_selection import ParameterGrid try: __file__ TERMINAL = True except: TERMINAL = False # ----------------------------- # Sample I # ----------------------------- # Define params params = {'a': [1, 2], 'b': [True, False]} # Create params grid grid = list(ParameterGrid(params)) # Show if TERMINAL: print("\nExample I:") print(pd.DataFrame(grid)) pd.DataFrame(grid) .. raw:: html
a b
0 1 True
1 1 False
2 2 True
3 2 False


.. GENERATED FROM PYTHON SOURCE LINES 35-51 .. code-block:: default :lineno-start: 37 # ----------------------------- # Sample II # ----------------------------- # Define params params = [{'kernel': ['linear']}, {'kernel': ['rbf'], 'gamma': [1, 10]}] # Create params grid grid = list(ParameterGrid(params)) # Show if TERMINAL: print("\nExample II:") print(pd.DataFrame(grid)) pd.DataFrame(grid) .. raw:: html
kernel gamma
0 linear NaN
1 rbf 1.0
2 rbf 10.0


.. GENERATED FROM PYTHON SOURCE LINES 53-69 .. code-block:: default :lineno-start: 54 # ----------------------------- # Sample III # ----------------------------- # Define params params = {'imp': ['simp', 'iimp'], 'scl': ['minmax', 'norm', 'std'], 'est': ['PCA', 'AE']} # Create params grid grid = list(ParameterGrid(params)) # Show if TERMINAL: print("\nExample III:") print(pd.DataFrame(grid)) pd.DataFrame(grid) .. raw:: html
est imp scl
0 PCA simp minmax
1 PCA simp norm
2 PCA simp std
3 PCA iimp minmax
4 PCA iimp norm
5 PCA iimp std
6 AE simp minmax
7 AE simp norm
8 AE simp std
9 AE iimp minmax
10 AE iimp norm
11 AE iimp std


.. GENERATED FROM PYTHON SOURCE LINES 71-87 .. code-block:: default :lineno-start: 73 # ----------------------------- # Sample IV # ----------------------------- # Define params params = [{'imp': ['simp', 'iimp'], 'scl': ['minmax'], 'est': ['PCA']}, {'imp': ['simp', 'iimp'], 'scl': ['std', 'norm'], 'est': ['AE']}] # Create params grid grid = list(ParameterGrid(params)) # Show if TERMINAL: print("\nExample IV:") print(pd.DataFrame(grid)) pd.DataFrame(grid) .. raw:: html
est imp scl
0 PCA simp minmax
1 PCA iimp minmax
2 AE simp std
3 AE simp norm
4 AE iimp std
5 AE iimp norm


.. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.010 seconds) .. _sphx_glr_download__examples_scikits_plot_param_grid.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_param_grid.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_param_grid.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_