.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/distributions/continuous_1d/plot_distribution_normal_fitting.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_auto_examples_distributions_continuous_1d_plot_distribution_normal_fitting.py: Distribution fitting ================================== This examples showcases the calculation of a distributions parameters based on fitting available data .. GENERATED FROM PYTHON SOURCE LINES 10-11 Initially we have to import the necessary modules. .. GENERATED FROM PYTHON SOURCE LINES 14-17 .. code-block:: default from UQpy.distributions.collection.Normal import Normal .. GENERATED FROM PYTHON SOURCE LINES 18-24 Define a Normal distribution and use the fit method. ------------------------------------------------------ Parameters to be learnt should be instantiated as None. Note that the fit method of each distribution returns a dictionary containing as keys the names of parameters and its values are their data fitted values. .. GENERATED FROM PYTHON SOURCE LINES 27-36 .. code-block:: default normal1 = Normal(loc=None, scale=None) fitted_parameters1 = normal1.fit(data=[-4, 2, 2, 1]) print(fitted_parameters1) normal2 = Normal(loc=0., scale=None) fitted_parameters2 = normal2.fit(data=[-4, 2, 2, 1]) print(fitted_parameters2) .. rst-class:: sphx-glr-script-out .. code-block:: none {'loc': 0.25, 'scale': 2.48746859276655} {'loc': 0.0, 'scale': 2.5} .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.001 seconds) .. _sphx_glr_download_auto_examples_distributions_continuous_1d_plot_distribution_normal_fitting.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/SURGroup/UQpy/master?urlpath=lab/tree/notebooks/auto_examples/distributions/continuous_1d/plot_distribution_normal_fitting.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_distribution_normal_fitting.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_distribution_normal_fitting.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_