fixed some types

This commit is contained in:
Dr. Kashif Rasul
2019-12-19 21:25:12 +01:00
parent df81b1ee97
commit 1f7f0556a3
4 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ class Evaluator:
@staticmethod
def extract_pred_target(
time_series: Union[pd.Series, pd.DataFrame],
forecast: Forecast) -> Union[pd.Series, pd.DataFrame]:
forecast: Forecast) -> np.ndarray:
"""
Parameters
+1 -1
View File
@@ -68,7 +68,7 @@ class Output(ABC):
pass
class DistributionOutput(Output):
class DistributionOutput(Output, ABC):
distr_cls: type
def distribution(
+3 -2
View File
@@ -18,7 +18,7 @@ import numpy as np
from pts.dataset.stat import ScaleHistogram
class InstanceSampler:
class InstanceSampler(ABC):
"""
An InstanceSampler is called with the time series and the valid
index bounds a, b and should return a set of indices a <= i <= b
@@ -41,8 +41,9 @@ class InstanceSampler:
Selected points to sample
"""
@abstractmethod
def __call__(self, ts: np.ndarray, a: int, b: int) -> np.ndarray:
raise NotImplementedError()
pass
class UniformSplitSampler(InstanceSampler):
+2 -2
View File
@@ -12,7 +12,7 @@
# permissions and limitations under the License.
from functools import lru_cache
from typing import Iterator, List, Optional
from typing import Iterator, List, Optional, Union
import numpy as np
import pandas as pd
@@ -152,7 +152,7 @@ class InstanceSplitter(FlatMapTransformation):
# the prediction length during training, so we just skip these.
# If we want to include them we would need to pad and to mask
# the loss.
sampling_indices: List[int] = []
sampling_indices: Union[np.ndarray, List[int]] = []
else:
if self.pick_incomplete:
sampling_indices = self.train_sampler(