.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "glr_examples/analysis/plot_decision_regions.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_glr_examples_analysis_plot_decision_regions.py: ================================================= Plot decision regions ================================================= displays the decision region for the training data reduced to two principal component axes. .. GENERATED FROM PYTHON SOURCE LINES 10-13 .. code-block:: Python # Author: L.Kouadio # Licence: BSD-3-clause .. GENERATED FROM PYTHON SOURCE LINES 14-17 Fetch the test data and do select the numerical features and impute the missing values .. GENERATED FROM PYTHON SOURCE LINES 17-30 .. code-block:: Python from watex.datasets import fetch_data from watex.exlib.sklearn import SimpleImputer, LogisticRegression from watex.analysis.decomposition import decision_region from watex.utils import selectfeatures data= fetch_data("bagoue original").get('data=dfy1') # encoded flow categories y = data.flow ; X= data.drop(columns='flow') # select the numerical features X =selectfeatures(X, include ='number') # imputed the missing data X = SimpleImputer().fit_transform(X) lr_clf = LogisticRegression(multi_class ='ovr', random_state =1, solver ='lbfgs') _=decision_region(X, y, clf=lr_clf, split = True, view ='Xt') # test set view .. image-sg:: /glr_examples/analysis/images/sphx_glr_plot_decision_regions_001.png :alt: plot decision regions :srcset: /glr_examples/analysis/images/sphx_glr_plot_decision_regions_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/docs/checkouts/readthedocs.org/user_builds/watex/checkouts/0.3.2/watex/analysis/decomposition.py:256: UserWarning: You passed a edgecolor/edgecolors ('black') for an unfilled marker ('x'). Matplotlib is ignoring the edgecolor in favor of the facecolor. This behavior may change in the future. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.275 seconds) .. _sphx_glr_download_glr_examples_analysis_plot_decision_regions.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/watex/watex/0.3.X?urlpath=lab/tree/notebooks/glr_examples/analysis/plot_decision_regions.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_decision_regions.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_decision_regions.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_