def __init__(self,
                 train_dataset: DeepARDataset,
                 predictor_filepath: str,
                 mean: bool = True,
                 num_samples: int = 100,
                 quantiles: List[float] = [],
                 nan_padding: bool = True):
        """ constructs DeepAR forecast object
        
            if mean False, will return median point estimates 
        """

        self.train_dataset = train_dataset
        self.train_frame = train_dataset.get_frame()
        self.predictor = GluonPredictor.deserialize(Path(predictor_filepath))
        self.mean = mean
        self.prediction_length = train_dataset.get_pred_length()
        self.context_length = train_dataset.get_context_length()
        self.num_samples = num_samples
        self.quantiles = quantiles
        self.nan_padding = nan_padding

        self.data = []
        self.series_idxs = []
        self.max_intervals = []
        self.pre_pad_lens = []
        self.total_in_samples = []
    def __init__(
        self,
        train_dataset: NBEATSDataset,
        predictor_filepath: str,
        interpretable: bool = True,
        mean: bool = True,
        nan_padding: bool = True,
    ):
        """constructs NBEATS forecast object

        if mean False, will return median point estimates
        """

        self.train_dataset = train_dataset
        self.train_frame = train_dataset.get_frame()
        self.predictor = GluonPredictor.deserialize(Path(predictor_filepath))
        self.interpretable = interpretable
        if interpretable:
            self.mean = True
        else:
            self.mean = mean
        self.prediction_length = train_dataset.get_pred_length()
        self.context_length = train_dataset.get_context_length()
        self.nan_padding = nan_padding

        self.data = []
        self.series_idxs = []
        self.max_intervals = []
        self.pre_pad_lens = []
        self.total_in_samples = []
Beispiel #3
0
def unserialize_all(
    base_path: str,
) -> List[GluonPredictor]:
    """ unserialize all predictors from directory
    
    Arguments:
        base_path {str} -- base dir name from which to load models

    Returns:
        List[GluonPredictor] -- list of unserialized GluonPredictor objects
    """
    
    return [
        GluonPredictor.deserialize(Path(base_dir)) 
        for base_dir in glob(base_path + "-fold*")
    ]