How to utilize packages built in forecasting plugin

Options
swapnilk
swapnilk Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Registered Posts: 2 ✭✭✭

After using the forecast plugin, the models get stored in a folder with the name of model.pk.gz, unzipping it to model.pk but this binary file is inaccessible.

Answers

  • Alexandru
    Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,209 Dataiker
    edited July 17
    Options

    Hi, Welcome to the Dataiku Community! The model.pk file is a pickle binary file.You can use it using python. Could please elaborate what exactly you are trying to do?

    import pickle              # import module first
    from gluonts.dataset.common import ListDataset
    
    f = open('gluon_train_dataset.pk', 'rb')   # read
    mylist = pickle.load(f)         # load file 
    f.close() 
    
    # This will be gluonts.dataset https://ts.gluon.ai/api/gluonts/gluonts.dataset.common.html 

    .

  • swapnilk
    swapnilk Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Registered Posts: 2 ✭✭✭
    Options

    Hi Alex,

    Thanks for the reply. I'm trying to access the codes written in model.pk file generated by forecast plugin.

  • Alexandru
    Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,209 Dataiker
    edited July 17
    Options

    Hi,

    The model.pk file in our case would be in my example is gluonts.model.trivial.identity.IdentityPredictor object. The code of the actual plugin is available here.

    import pickle              
    from gluonts.dataset import common
    
    f = open('model.pk', 'rb')   # 'r' for reading; can be omitted
    pickle_data = pickle.load(f)         # load file content as mydict
    
    print(pickle_data.__dict__ ) 
    
    #example output {'__init_args__': OrderedDict([('freq', 'D'), ('num_samples', 100), ('prediction_length', 1)]), 'prediction_length': 1, 'freq': 'D', 'lead_time': 0, 'num_samples': 100}

    Let me know if there is anything further I help with.

Setup Info
    Tags
      Help me…