mirror of
https://github.com/wassname/pytorch-ts.git
synced 2026-08-17 11:25:14 +08:00
fixed some types
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -68,7 +68,7 @@ class Output(ABC):
|
||||
pass
|
||||
|
||||
|
||||
class DistributionOutput(Output):
|
||||
class DistributionOutput(Output, ABC):
|
||||
distr_cls: type
|
||||
|
||||
def distribution(
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user