TransWikia.com

Use TSFRESH-library to forecast values

Data Science Asked by SpanishBoy on December 18, 2020

Have some issue with understanding how to use TSFERSH-library (version 0.4.0) to forecast next N-values of particular series. Below my code:

    # load data train/test datasets        
    train, Y, test, YY = prepare_train_test()
    # add series ID         
    train['TS_ID'] = pd.Categorical(train['QTR_HR_START']).codes
    test['TS_ID'] = pd.Categorical(test['QTR_HR_START']).codes
    # add ordered id for concrete event of series
    for id in sorted(train['TS_ID'].unique()):
        train.ix[train.TS_ID == id, 'TIME_ORDER_ID'] =  pd.Categorical(train[train.TS_ID == id]['DATETIME']).codes
    for id in sorted(test['TS_ID'].unique()):
        test.ix[test.TS_ID == id, 'TIME_ORDER_ID'] = pd.Categorical(test[test.TS_ID == id]['DATETIME']).codes
    # perform feature extraction for my signal
    extraction_settings = FeatureExtractionSettings()
    extraction_settings.IMPUTE = impute  # Fill in Infs and NaNs
    X = extract_features(train, column_id='TS_ID', feature_extraction_settings=extraction_settings).values
    XT = extract_features(test, column_id='TS_ID', feature_extraction_settings=extraction_settings).values

    # there should be as example 
    # model = xgb.DMatrix(X, label=Y, missing=np.nan)
    # model.fit()
    # model.predict(XT)

However, after line X = extract_features(...) I see at debugger following results
enter image description here

It’s mean that initial X-dataset/features (shape=(722,10) were transformed to shape (80, 1899).

Where does ’80’ come from? I guess from train.TS_ID comes. But my XT-dataset still contains 722-rows (9 days * 80 different series per day).

So, how can I predict for 9 days in advance? or is there only forecast for next period?

One Answer

TSFRESH is already supporting Time Series Forecast.

See details and example here and here

Correct answer by SpanishBoy on December 18, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP