From ab076f8c76189d12c6891844ffd6fa3e28d25d31 Mon Sep 17 00:00:00 2001 From: cerlymarco <36955807+cerlymarco@users.noreply.github.com> Date: Thu, 3 Sep 2020 10:29:52 +0200 Subject: [PATCH] Release --- README.md | 16 ++++++++-------- setup.py | 2 +- tsmoothie/smoother.py | 2 +- tsmoothie/utils_func.py | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 5f7a582..efcb764 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # tsmoothie -A python library for timeseries smoothing and outlier detection in a vectorized way. +A python library for time-series smoothing and outlier detection in a vectorized way. ## Overview -tsmoothie computes, in a fast and efficient way, the smoothing of single or multiple timeseries. +tsmoothie computes, in a fast and efficient way, the smoothing of single or multiple time-series. -The smoothing tecniques available are: +The smoothing techniques available are: - Exponential Smoothing - Convolutional Smoothing with various window types (constant, hanning, hamming, bartlett, blackman) @@ -17,7 +17,7 @@ The smoothing tecniques available are: - LOWESS - Kalman Smoothing with customizable components (level, trend, seasonality, long seasonality) -tsmoothie provides the calculation of intervals as result of the smoothing process. This can be useful to identify outliers and anomalies in timeseries. +tsmoothie provides the calculation of intervals as result of the smoothing process. This can be useful to identify outliers and anomalies in time-series. The interval types available are: @@ -28,14 +28,14 @@ The interval types available are: The adoption of this type of intervals depends on the smoothing method used. -tsmoothie can also carry out a sliding smoothing approach. This is possible splitting the timeseries into equal sized pieces and smoothing them independently. As always, this functionality is implemented in a vectorized way through the WindowWrapper class. +tsmoothie can also carry out a sliding smoothing approach. This is possible splitting the time-series into equal sized pieces and smoothing them independently. As always, this functionality is implemented in a vectorized way through the WindowWrapper class. ## Media Blog Posts: -- Timeseries Smoothing for better clustering (cooming soon) -- Timeseries Smoothing for better forecasting (cooming soon) +- [Time Series Smoothing for better Clustering](https://towardsdatascience.com/time-series-smoothing-for-better-clustering-121b98f308e8) +- Time Series Smoothing for better Forecasting (coming soon) ## Installation @@ -119,5 +119,5 @@ for i in range(3): ## References -- Polynomial, Spline, Gaussian and Binner smoothing are carried out building a regression on custom basis expansions. These implementations are based on the amazing intutions of Matthew Drury available [here](https://github.com/madrury/basis-expansions/blob/master/examples/comparison-of-smoothing-methods.ipynb) +- Polynomial, Spline, Gaussian and Binner smoothing are carried out building a regression on custom basis expansions. These implementations are based on the amazing intuitions of Matthew Drury available [here](https://github.com/madrury/basis-expansions/blob/master/examples/comparison-of-smoothing-methods.ipynb) - Time Series Modelling with Unobserved Components, Matteo M. Pelagatti \ No newline at end of file diff --git a/setup.py b/setup.py index 0c2b637..e3ad171 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ HERE = pathlib.Path(__file__).parent -VERSION = '0.1.5' +VERSION = '0.1.6' PACKAGE_NAME = 'tsmoothie' AUTHOR = 'Marco Cerliani' AUTHOR_EMAIL = 'cerlymarco@gmail.com' diff --git a/tsmoothie/smoother.py b/tsmoothie/smoother.py index 284810e..2f17e6d 100644 --- a/tsmoothie/smoother.py +++ b/tsmoothie/smoother.py @@ -278,7 +278,7 @@ def smooth(self, data): if self.window_type == 'ones': w = np.ones(self.window_len) else: - w = eval('np.'+self.window_type+'(window_len)') + w = eval('np.'+self.window_type+'(self.window_len)') if data.ndim == 2: pad_data = np.pad(data, ((self.window_len,self.window_len),(0,0)), mode='symmetric') diff --git a/tsmoothie/utils_func.py b/tsmoothie/utils_func.py index 80960d1..c3dc975 100644 --- a/tsmoothie/utils_func.py +++ b/tsmoothie/utils_func.py @@ -151,8 +151,8 @@ def create_windows(data, window_shape, step = 1, start_id = None, end_id = None) data = np.asarray(data) - if data.ndim == 0: - raise ValueError("Pass an object with more than one timesteps") + if data.ndim != 2: + raise ValueError("Pass a 2D array-like in the format (timestemps, series)") if window_shape < 1: raise ValueError("window_shape must be >= 1") @@ -196,7 +196,7 @@ def sigma_interval(true, prediction, n_sigma): Upper bands. """ - std = (true - prediction).std(1, keepdims=True) + std = np.nanstd(true - prediction, axis=1, keepdims=True) low = prediction - n_sigma*std up = prediction + n_sigma*std