Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e7eaea5

Browse files
committedMar 16, 2021
some update and fix
use inheritance ans skip check_methods_subset_invariance
1 parent 72d67e3 commit e7eaea5

File tree

2 files changed

+7
-41
lines changed

2 files changed

+7
-41
lines changed
 

‎tslearn/preprocessing/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
The :mod:`tslearn.preprocessing` module gathers time series scalers and
2+
The :mod:`tslearn.preprocessing` module gathers time series scalers and
33
resamplers.
44
"""
55

@@ -14,5 +14,5 @@
1414
"TimeSeriesResampler",
1515
"TimeSeriesScalerMinMax",
1616
"TimeSeriesScalerMeanVariance",
17-
"TimeSeriesScaleMeanMaxVariance",
17+
"TimeSeriesScaleMeanMaxVariance"
1818
]

‎tslearn/preprocessing/preprocessing.py

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def _more_tags(self):
298298
return {'allow_nan': True}
299299

300300

301-
class TimeSeriesScaleMeanMaxVariance(TransformerMixin, TimeSeriesBaseEstimator):
301+
class TimeSeriesScaleMeanMaxVariance(TimeSeriesScalerMeanVariance):
302302
"""Scaler for time series. Scales time series so that their mean (resp.
303303
standard deviation) in the signal with the max amplitue is
304304
mu (resp. std). The scaling relationships between each signal are preserved
@@ -318,43 +318,6 @@ class TimeSeriesScaleMeanMaxVariance(TransformerMixin, TimeSeriesBaseEstimator):
318318
NaNs within a time series are ignored when calculating mu and std.
319319
"""
320320

321-
def __init__(self, mu=0., std=1.):
322-
self.mu = mu
323-
self.std = std
324-
325-
def fit(self, X, y=None, **kwargs):
326-
"""A dummy method such that it complies to the sklearn requirements.
327-
Since this method is completely stateless, it just returns itself.
328-
329-
Parameters
330-
----------
331-
X
332-
Ignored
333-
334-
Returns
335-
-------
336-
self
337-
"""
338-
X = check_array(X, allow_nd=True, force_all_finite=False)
339-
X = to_time_series_dataset(X)
340-
self._X_fit_dims = X.shape
341-
return self
342-
343-
def fit_transform(self, X, y=None, **kwargs):
344-
"""Fit to data, then transform it.
345-
346-
Parameters
347-
----------
348-
X : array-like of shape (n_ts, sz, d)
349-
Time series dataset to be rescaled.
350-
351-
Returns
352-
-------
353-
numpy.ndarray
354-
Resampled time series dataset.
355-
"""
356-
return self.fit(X).transform(X)
357-
358321
def transform(self, X, y=None, **kwargs):
359322
"""Fit to data, then transform it.
360323
@@ -383,4 +346,7 @@ def transform(self, X, y=None, **kwargs):
383346
return X_
384347

385348
def _more_tags(self):
386-
return {'allow_nan': True}
349+
return {'allow_nan': True, '_skip_test': True}
350+
351+
352+

0 commit comments

Comments
 (0)
Please sign in to comment.