.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "csi/transform_tutorial.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. .. rst-class:: sphx-glr-example-title .. _sphx_glr_csi_transform_tutorial.py: CSI Preprocessing.transform Tutorial ============================================================== .. GENERATED FROM PYTHON SOURCE LINES 7-10 .. code-block:: Python # !pip install pysensing .. GENERATED FROM PYTHON SOURCE LINES 11-13 In this tutorial, we will be implementing a simple csi.preprocessing.transform tutorial using the pysensing library. .. GENERATED FROM PYTHON SOURCE LINES 13-18 .. code-block:: Python import sys sys.path.append('../..') import pysensing.csi.preprocessing.transform as transform import numpy as np .. GENERATED FROM PYTHON SOURCE LINES 19-21 remove_nan ----------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 21-32 .. code-block:: Python # remove_nan is a function that removes NaN values from the input data. It can replace NaN values with zero, mean, or median values. test_data = [1, None, 3, np.inf, None, 6, -np.inf, 8, 9] test_data1 = transform.remove_nan(test_data, interpolation_method='zero') print(test_data1) test_data2 = transform.remove_nan(test_data, interpolation_method='mean') print(test_data2) test_data3 = transform.remove_nan(test_data, interpolation_method='median') print(test_data3) .. rst-class:: sphx-glr-script-out .. code-block:: none [1, 0, 3, 0, 0, 6, 0, 8, 9] [1, 5.4, 3, 5.4, 5.4, 6, 5.4, 8, 9] [1, 6, 3, 6, 6, 6, 6, 8, 9] .. GENERATED FROM PYTHON SOURCE LINES 33-36 normalization ------------------------ normalization is a function that normalizes the input data. .. GENERATED FROM PYTHON SOURCE LINES 36-41 .. code-block:: Python test_data4 = transform.normalization(test_data1) print(test_data4) .. rst-class:: sphx-glr-script-out .. code-block:: none [0.11111111 0. 0.33333333 0. 0. 0.66666667 0. 0.88888889 1. ] .. GENERATED FROM PYTHON SOURCE LINES 42-43 And that's it. We're done with our CSI augmentation.normalization tutorials. Thanks for reading. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.765 seconds) .. _sphx_glr_download_csi_transform_tutorial.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: transform_tutorial.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: transform_tutorial.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_