TransformersΒΆ

This example shows the different transforming algorithms available in pyts.preprocessing.

../../_images/sphx_glr_plot_transformers_001.png
import matplotlib.pyplot as plt
from pyts.datasets import load_gunpoint
from pyts.preprocessing import PowerTransformer, QuantileTransformer

X, _, _, _ = load_gunpoint(return_X_y=True)
n_timestamps = X.shape[1]

# Scale the data with different scaling algorithms
X_power = PowerTransformer().transform(X)
X_quantile = QuantileTransformer(n_quantiles=n_timestamps).transform(X)

# Show the results for the first time series
plt.figure(figsize=(8, 6))
plt.plot(X[0], '--', label='Original')
plt.plot(X_power[0], '--', label='PowerTransformer')
plt.plot(X_quantile[0], '--', label='QuantileTransformer')
plt.legend(loc='best', fontsize=12)
plt.title('Transforming time series', fontsize=16)
plt.tight_layout()
plt.show()

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

Gallery generated by Sphinx-Gallery