Beispiel #1
0
def test_timeseries_item_serialization() -> None:
    ts_item = TimeSeriesItem(
        item="1",
        start="2014-09-07 00:00:00",
        target=[1, 2],
        feat_static_cat=[1],
    )
    metadata = MetaData(
        freq="1H",
        feat_static_cat=[{"name": "feat_static_cat_000", "cardinality": 1}],
    )
    process = ProcessDataEntry(freq=metadata.freq)

    data_entry = process(ts_item.gluontsify(metadata))
    serialized_data = serialize_data_entry(data_entry)

    deserialized_ts_item = TimeSeriesItem(**serialized_data)
    assert deserialized_ts_item == ts_item
Beispiel #2
0
 def to_time_series_item(self) -> TimeSeriesItem:
     return TimeSeriesItem(
         start=self.start,
         target=self.target.values,
         item=self.item,
         feat_static_cat=self.feat_static_cat,
         feat_static_real=self.feat_static_real,
         feat_dynamic_cat=[cat.values for cat in self.feat_dynamic_cat],
         feat_dynamic_real=[real.values for real in self.feat_dynamic_real],
     )
Beispiel #3
0
def load_parsed_dataset(path: Path, freq: str) -> Iterator[Any]:
    for item in FileDataset(path, freq):
        yield TimeSeriesItem(
            start=item["start"], target=item["target"], item="ABC"
        )
Beispiel #4
0
def load_parsed_dataset(path: Path, freq: str) -> Iterator[Any]:
    for item in FileDataset(path, freq):
        yield TimeSeriesItem(start=item['start'],
                             target=item['target'],
                             item='ABC')
Beispiel #5
0
def test_file(path):
    for raw_dataset in JsonLinesFile(path):
        TimeSeriesItem.parse_obj(raw_dataset.content)
    print('ok')