#!/usr/bin/env python
import requests
import json
DATE_FORMAT = "%m/%d/%y %H:%M"
desc = """
A test the shows created models do not return the right field names.
"""
URL = 'http://localhost:5000/'
def post(url, params=None):
return requests.post(URL+url, data=params)
def get(url, params=None):
return requests.get(URL+url, params=params)
def create_model(model_spec):
r = post('models', model_spec).json()
return r['guid']
def get_model(model):
return get('models/'+model)
if __name__ == "__main__":
from pprint import pprint
print(desc)
print ("Making prediction model from model_params.json")
with open('model_params.json') as data_file:
model_spec = data_file.read()
custom_model = create_model(model_spec)
pprint (get_model(custom_model).json())
However, the resulting model params used to create the model don't respect the input param field names, instead the fields c0 and c1 are created, as shown in this python dict representing the created model params:
The script below creates a new custom model with these model params, which declare the following fieldnames:
timestamp
consumption
However, the resulting model params used to create the model don't respect the input param field names, instead the fields
c0
andc1
are created, as shown in this python dict representing the created model params: