
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples/learning_ml/example_gmr.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_examples_learning_ml_example_gmr.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_learning_ml_example_gmr.py:


GMR
=================

This example shows how to use the GMR to learn a human demonstration motion.

.. GENERATED FROM PYTHON SOURCE LINES 7-19

.. code-block:: default

    import numpy as np

    import rofunc as rf

    data = np.load('../../data/LFD_ML/pbd/' + 'test_001.npy', allow_pickle=True, encoding="latin1")[()]

    demos_x = data['x']  # Position data
    demos_dx = data['dx']  # Velocity data
    demos_xdx = [np.hstack([_x, _dx]) for _x, _dx in zip(demos_x, demos_dx)]  # Position-velocity

    representation = rf.ml.GMR(demos_x, demos_dx, demos_xdx, plot=True)
    representation.fit()


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 0.000 seconds)


.. _sphx_glr_download_examples_learning_ml_example_gmr.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example




    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: example_gmr.py <example_gmr.py>`

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: example_gmr.ipynb <example_gmr.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
