.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "glr_examples/base/plot_ada_stochastic_gd.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_base_plot_ada_stochastic_gd.py: ===================================================== Plot Stochastic Linear Adaptative Neuron Classifier ===================================================== visualizes the mini-batch by applying batch gradient descent to a smaller subset of test data. .. GENERATED FROM PYTHON SOURCE LINES 9-12 .. code-block:: default # Author: L.Kouadio # Licence: BSD-3-clause .. GENERATED FROM PYTHON SOURCE LINES 13-14 fetch data and uses the preprocessed .. GENERATED FROM PYTHON SOURCE LINES 14-29 .. code-block:: default import matplotlib.pyplot as plt from watex.base import AdalineStochasticGradientDescent from watex.analysis import decision_region from watex.datasets import fetch_data X, y = fetch_data ('bagoue prepared data') fig, axe = plt.subplots (1, 2) asgd= AdalineStochasticGradientDescent (n_iter=15, eta=.01).fit(X.toarray(), y ) decision_region(X.toarray(), y, clf=asgd, return_axe=True, axe= axe[0]) # test set view axe[0].set_title ("Adaline - Stochastic Gradient descent") axe[1].plot(range (1, len(asgd.cost_) +1 ), asgd.cost_, marker ="o") axe[1].set_xlabel ("Epochs") axe[1].set_ylabel ("Sum-squared-error") plt.tight_layout() plt.show() .. image-sg:: /glr_examples/base/images/sphx_glr_plot_ada_stochastic_gd_001.png :alt: Adaline - Stochastic Gradient descent :srcset: /glr_examples/base/images/sphx_glr_plot_ada_stochastic_gd_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.2.4/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.412 seconds) .. _sphx_glr_download_glr_examples_base_plot_ada_stochastic_gd.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/master?urlpath=lab/tree/notebooks/glr_examples/base/plot_ada_stochastic_gd.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_ada_stochastic_gd.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_ada_stochastic_gd.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_