{"action":"closed","issue":{"url":"https://api.github.com/repos/nupic-community/htm-over-http/issues/16","labels_url":"https://api.github.com/repos/nupic-community/htm-over-http/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/nupic-community/htm-over-http/issues/16/comments","events_url":"https://api.github.com/repos/nupic-community/htm-over-http/issues/16/events","html_url":"https://github.com/nupic-community/htm-over-http/issues/16","id":121369014,"number":16,"title":"Creating a custom model does not respect input model param field names","user":{"login":"rhyolight","id":15566,"avatar_url":"https://avatars.githubusercontent.com/u/15566?v=3","gravatar_id":"","url":"https://api.github.com/users/rhyolight","html_url":"https://github.com/rhyolight","followers_url":"https://api.github.com/users/rhyolight/followers","following_url":"https://api.github.com/users/rhyolight/following{/other_user}","gists_url":"https://api.github.com/users/rhyolight/gists{/gist_id}","starred_url":"https://api.github.com/users/rhyolight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhyolight/subscriptions","organizations_url":"https://api.github.com/users/rhyolight/orgs","repos_url":"https://api.github.com/users/rhyolight/repos","events_url":"https://api.github.com/users/rhyolight/events{/privacy}","received_events_url":"https://api.github.com/users/rhyolight/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nupic-community/htm-over-http/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/nupic-community/htm-over-http/labels/HTM%20backend","name":"HTM backend","color":"5319e7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-09T23:52:23Z","updated_at":"2015-12-10T00:30:12Z","closed_at":"2015-12-10T00:30:12Z","body":"The script below creates a new custom model [with these model params](https://gist.github.com/rhyolight/20c937c15e5ae3333f89), which declare the following fieldnames:\r\n- [`timestamp`](https://gist.github.com/rhyolight/20c937c15e5ae3333f89#file-model_params-json-L33)\r\n- [`consumption`](https://gist.github.com/rhyolight/20c937c15e5ae3333f89#file-model_params-json-L45)\r\n\r\n```python\r\n#!/usr/bin/env python\r\nimport requests\r\nimport json\r\n\r\nDATE_FORMAT = \"%m/%d/%y %H:%M\"\r\ndesc = \"\"\"\r\nA test the shows created models do not return the right field names.\r\n\"\"\"\r\n\r\nURL = 'http://localhost:5000/'\r\n\r\n\r\ndef post(url, params=None):\r\n    return requests.post(URL+url, data=params)\r\n\r\ndef get(url, params=None):\r\n    return requests.get(URL+url, params=params)\r\n\r\ndef create_model(model_spec):\r\n    r = post('models', model_spec).json()\r\n    return r['guid']\r\n\r\ndef get_model(model):\r\n    return get('models/'+model)\r\n\r\nif __name__ == \"__main__\":\r\n    from pprint import pprint\r\n    print(desc)\r\n    print (\"Making prediction model from model_params.json\")\r\n    with open('model_params.json') as data_file:\r\n        model_spec = data_file.read()\r\n    custom_model = create_model(model_spec)\r\n    pprint (get_model(custom_model).json())\r\n```\r\n\r\nHowever, 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:\r\n\r\n```python\r\n{u'guid': u'cfa3bb3e-4769-41b0-9299-0fb903d4e820',\r\n u'last': None,\r\n u'params': {u'aggregationInfo': {u'days': 0,\r\n                                  u'fields': [],\r\n                                  u'hours': 0,\r\n                                  u'microseconds': 0,\r\n                                  u'milliseconds': 0,\r\n                                  u'minutes': 0,\r\n                                  u'months': 0,\r\n                                  u'seconds': 0,\r\n                                  u'weeks': 0,\r\n                                  u'years': 0},\r\n             u'model': u'CLA',\r\n             u'modelParams': {u'anomalyParams': {u'anomalyCacheRecords': None,\r\n                                                 u'autoDetectThreshold': None,\r\n                                                 u'autoDetectWaitRecords': 5030},\r\n                              u'clEnable': False,\r\n                              u'clParams': {u'alpha': 0.035828933612158,\r\n                                            u'clVerbosity': 0,\r\n                                            u'regionName': u'CLAClassifierRegion',\r\n                                            u'steps': u'1'},\r\n                              u'inferenceType': u'TemporalAnomaly',\r\n                              u'sensorParams': {u'encoders': {u'c0_dayOfWeek': None,\r\n                                                              u'c0_timeOfDay': {u'fieldname': u'c0',\r\n                                                                                u'name': u'c0',\r\n                                                                                u'timeOfDay': [21,\r\n                                                                                               9.49122334747737],\r\n                                                                                u'type': u'DateEncoder'},\r\n                                                              u'c0_weekend': None,\r\n                                                              u'c1': {u'fieldname': u'c1',\r\n                                                                      u'name': u'c1',\r\n                                                                      u'resolution': 21,\r\n                                                                      u'seed': 42,\r\n                                                                      u'type': u'RandomDistributedScalarEncoder'}},\r\n                                                u'sensorAutoReset': None,\r\n                                                u'verbosity': 0},\r\n                              u'spEnable': True,\r\n                              u'spParams': {u'columnCount': 2048,\r\n                                            u'globalInhibition': 1,\r\n                                            u'inputWidth': 0,\r\n                                            u'maxBoost': 1.0,\r\n                                            u'numActiveColumnsPerInhArea': 40,\r\n                                            u'potentialPct': 0.8,\r\n                                            u'seed': 1956,\r\n                                            u'spVerbosity': 0,\r\n                                            u'spatialImp': u'cpp',\r\n                                            u'synPermActiveInc': 0.0015,\r\n                                            u'synPermConnected': 0.1,\r\n                                            u'synPermInactiveDec': 0.0005},\r\n                              u'tpEnable': True,\r\n                              u'tpParams': {u'activationThreshold': 13,\r\n                                            u'cellsPerColumn': 32,\r\n                                            u'columnCount': 2048,\r\n                                            u'globalDecay': 0.0,\r\n                                            u'initialPerm': 0.21,\r\n                                            u'inputWidth': 2048,\r\n                                            u'maxAge': 0,\r\n                                            u'maxSegmentsPerCell': 128,\r\n                                            u'maxSynapsesPerSegment': 32,\r\n                                            u'minThreshold': 10,\r\n                                            u'newSynapseCount': 20,\r\n                                            u'outputType': u'normal',\r\n                                            u'pamLength': 3,\r\n                                            u'permanenceDec': 0.1,\r\n                                            u'permanenceInc': 0.1,\r\n                                            u'seed': 1960,\r\n                                            u'temporalImp': u'cpp',\r\n                                            u'verbosity': 0},\r\n                              u'trainSPNetOnlyIfRequested': False},\r\n             u'predictAheadTime': None,\r\n             u'version': 1},\r\n u'predicted_field': u'c1',\r\n u'seen': 0}\r\n```"}}