.. 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_auto_examples_plot_feature_rep_mix_example.py: ============================ Simple FeatureRepMix Example ============================ This example demonstrates how to use the FeatureRepMix on segmented data. Although not shown here, FeatureRepMix can be used with Pype in place of FeatureRep. See API documentation for an example. .. rst-class:: sphx-glr-script-out Out: .. code-block:: none After segmentation: X: [[[ 0 1 2 3] [ 4 5 6 7] [ 8 9 10 11]]] y: [False] After column-wise feature extraction: a_min_0 ... e_max_3 0 0 ... 11 [1 rows x 8 columns] | .. code-block:: default # Author: Matthias Gazzari # License: BSD from seglearn.transform import Segment, FeatureRep, FeatureRepMix from seglearn.feature_functions import minimum, maximum from seglearn.base import TS_Data import numpy as np import pandas as pd # Single multivariate time series with 3 samples of 4 variables X = [np.array([[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]])] # Time series target y = [np.array([True, False, False])] segment = Segment(width=3, overlap=1) X, y, _ = segment.fit_transform(X, y) print('After segmentation:') print("X:", X) print("y: ", y) union = FeatureRepMix([ ('a', FeatureRep(features={'min': minimum}), 0), ('b', FeatureRep(features={'min': minimum}), 1), ('c', FeatureRep(features={'min': minimum}), [2, 3]), ('d', FeatureRep(features={'max': maximum}), slice(0, 2)), ('e', FeatureRep(features={'max': maximum}), [False, False, True, True]), ]) X = union.fit_transform(X, y) print('After column-wise feature extraction:') df = pd.DataFrame(data=X, columns=union.f_labels) print(df) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.013 seconds) .. _sphx_glr_download_auto_examples_plot_feature_rep_mix_example.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_feature_rep_mix_example.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_feature_rep_mix_example.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_