Note
Go to the end to download the full example code.
CSI Preprocessing.transform Tutorial¶
# !pip install pysensing
In this tutorial, we will be implementing a simple csi.preprocessing.transform tutorial using the pysensing library.
import sys
sys.path.append('../..')
import pysensing.csi.preprocessing.transform as transform
import numpy as np
remove_nan¶
# 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)
[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]
normalization¶
normalization is a function that normalizes the input data.
test_data4 = transform.normalization(test_data1)
print(test_data4)
[0.11111111 0. 0.33333333 0. 0. 0.66666667
0. 0.88888889 1. ]
And that’s it. We’re done with our CSI augmentation.normalization tutorials. Thanks for reading.
Total running time of the script: (0 minutes 1.157 seconds)