# Issue recognising multiple inputs for prediction

**URL:** <https://discourse.numenta.org/t/issue-recognising-multiple-inputs-for-prediction/6323>\
**Category:** NuPIC\
**Created:** [July 17, 2019, 8:43am UTC](https://discourse.numenta.org/t/issue-recognising-multiple-inputs-for-prediction/6323 "2019-07-17T08:43:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mh01223](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@mh01223](https://discourse.numenta.org/u/mh01223)\
**Post date:** [July 17, 2019, 8:43am UTC](https://discourse.numenta.org/t/issue-recognising-multiple-inputs-for-prediction/6323/1 "2019-07-17T08:43:00Z")

</div>

Hi,

I am currently just trying to observe how the predictability of my data changes when I manually add different fields with different levels of correlation to my target field. I’m currently using the simple Hot Gym example script as a template ([https://github.com/numenta/nupic/blob/master/examples/opf/clients/hotgym/simple/hotgym.py](https://github.com/numenta/nupic/blob/master/examples/opf/clients/hotgym/simple/hotgym.py)) and am monitoring the hourly altMAPE (data resolution is 5 seconds). I tried adding the dayOfWeek and Solar\_Panel\_Voltage\_X to the model params file as so (My predicted field is Total\_Photo\_Current):

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/numenta/original/2X/6/6b9f6953376c57f1d345b46f059b4ec643bc547b.png)  
and simply added another modelInput to the run file:  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/numenta/original/2X/3/348745e515a2589da3b7fb0e68b3bcdbc683a6c5.png)

However, I get exactly the same altMAPE as before (screenshot below), when I only had Total\_Photo\_Current and timeOfDay. Am I missing something? Any help would be much appreciated :))

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/numenta/original/2X/d/da3e61ed05aed1b88829fba5701c156fdba7ccdb.png)

---

<div class="post-metadata">

**Author:** ![rhyolight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/rhyolight/32/3922_2.png) [@rhyolight](https://discourse.numenta.org/u/rhyolight)\
**Post date:** [July 17, 2019, 2:55pm UTC](https://discourse.numenta.org/t/issue-recognising-multiple-inputs-for-prediction/6323/2 "2019-07-17T14:55:41Z")

</div>

If you grep the NuPIC examples directory, you’ll find examples of using `dayOfWeek`. Here is one:

> <https://github.com/numenta/nupic/blob/master/examples/opf/experiments/opfrunexperiment_test/simpleOPF/hotgym_1hr_agg/description.py#L135-L138>

Try adding `'dayOfWeek': (21, 1)`, which informs the OPF how on how to dimension the encoding.

Also, it could be that neither of these new fields make a difference to the algorithm’s ability to predict. We have found many times that fields we thought would contribute to better predictions do not help.

---

<div class="post-metadata">

**Author:** ![sheiser1](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/sheiser1/32/766_2.png) [@sheiser1](https://discourse.numenta.org/u/sheiser1)\
**Post date:** [July 17, 2019, 5:16pm UTC](https://discourse.numenta.org/t/issue-recognising-multiple-inputs-for-prediction/6323/3 "2019-07-17T17:16:03Z")

</div>

I wonder if the RDSE resolutions should be sensitive to the different fields’ distributions?

---

<div class="post-metadata">

**Author:** ![mh01223](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@mh01223](https://discourse.numenta.org/u/mh01223)\
**Post date:** [July 17, 2019, 8:44pm UTC](https://discourse.numenta.org/t/issue-recognising-multiple-inputs-for-prediction/6323/4 "2019-07-17T20:44:59Z")

</div>

Yeah, in this case i know the Solar Panel Voltage is 70% correlated, so although I didn’t expect a huge change, the fact that I was getting exactly the same % error was suspicious. In the case of dayOfWeek being important, the model’s % error increases every Sunday on a weekly basis, probably due to a mode change that I don’t have telemetry for. So I do expect dayOfWeek to be important here. Ill try what you suggested, thanks :))

---

<div class="post-metadata">

**Author:** ![mh01223](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@mh01223](https://discourse.numenta.org/u/mh01223)\
**Post date:** [July 18, 2019, 12:54pm UTC](https://discourse.numenta.org/t/issue-recognising-multiple-inputs-for-prediction/6323/5 "2019-07-18T12:54:59Z")

</div>

I think it must be the script or my useage of the ‘simple’ hotgym example script. It seems it only needs the predicted field itself to work. Even when I remove all the date/time encoders it works exactly the same. I think ill try the ‘prediction’ example script which is more similar to the ‘anomaly’ example script which I have had success using and adding/removing features.

---

<div class="post-metadata">

**Author:** ![mh01223](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@mh01223](https://discourse.numenta.org/u/mh01223)\
**Post date:** [July 18, 2019, 12:57pm UTC](https://discourse.numenta.org/t/issue-recognising-multiple-inputs-for-prediction/6323/6 "2019-07-18T12:57:11Z")

</div>

Yeah, in this case the Solar Panel Voltage ranges from 0 to ~4000 and the Current from 0 to ~400 so I guess a higher resolution value for the Voltage would be more suitable.

---

<div class="post-metadata">

**Author:** ![rhyolight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/rhyolight/32/3922_2.png) [@rhyolight](https://discourse.numenta.org/u/rhyolight)\
**Post date:** [July 18, 2019, 2:47pm UTC](https://discourse.numenta.org/t/issue-recognising-multiple-inputs-for-prediction/6323/7 "2019-07-18T14:47:12Z")

</div>

Are you trying to make predictions are get anomalies? NuPIC is much better getting anomalies than making predictions.

---

<div class="post-metadata">

**Author:** ![sheiser1](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/sheiser1/32/766_2.png) [@sheiser1](https://discourse.numenta.org/u/sheiser1)\
**Post date:** [July 18, 2019, 7:24pm UTC](https://discourse.numenta.org/t/issue-recognising-multiple-inputs-for-prediction/6323/8 "2019-07-18T19:24:48Z")

</div>

Here’s how they find the resolution value for each metric in NAB (to my knowledge):

```
class NumentaTMDetector(NumentaDetector):
  """
  This detector uses the implementation of temporal memory in
  https://github.com/numenta/nupic.core/blob/master/src/nupic/algorithms/TemporalMemory.hpp.
  It differs from its parent detector in temporal memory and its parameters.
  """

  def __init__ (self, *args, **kwargs):

    super(NumentaTMDetector, self). __init__ (*args, **kwargs)

  def initialize(self):
    # Get config params, setting the RDSE resolution
    rangePadding = abs(self.inputMax - self.inputMin) * 0.2

    modelParams = getScalarMetricWithTimeOfDayAnomalyParams(
      metricData=[0],
      minVal=self.inputMin-rangePadding,
      maxVal=self.inputMax+rangePadding,
      minResolution=0.001,
      tmImplementation="tm_cpp"
    )["modelConfig"]

```

The ‘minVal’, ‘maxVal’ & ‘minResolution’ inputs are used to calculate the resolution value within getScalarMetricWithTimeOfDayAnomalyParams():

```
def _fixupRandomEncoderParams(params, minVal, maxVal, minResolution):
  """
  Given model params, figure out the correct parameters for the
  RandomDistributed encoder. Modifies params in place.
  """
  encodersDict = (
    params["modelConfig"]["modelParams"]["sensorParams"]["encoders"]
  )

  for encoder in encodersDict.itervalues():
    if encoder is not None:
      if encoder["type"] == "RandomDistributedScalarEncoder":
        **resolution** = max(minResolution,
                         (maxVal - minVal) / encoder.pop("numBuckets")
                        )
        encodersDict["c1"]["resolution"] = resolution

```

This leads me to wonder, **how much of each metric’s data is being used in NAB to get the min & max values?** Maybe this is the irreducible batch-like element of NuPIC at this point, that you need some chunk to get the min & max from. I use a parameter for what proportion of a metric’s data will be used to find its min & max.

---

<div class="post-metadata">

**Author:** ![mh01223](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@mh01223](https://discourse.numenta.org/u/mh01223)\
**Post date:** [July 18, 2019, 8:16pm UTC](https://discourse.numenta.org/t/issue-recognising-multiple-inputs-for-prediction/6323/9 "2019-07-18T20:16:51Z")

</div>

Yes my focus was anomaly detection, but I’m waiting on an external source to validate the anomalies which would allow me to quantify the performance of the model. I thought until that happens I could experiment on predictability, since its pretty easy to quantify a models’ effectiveness in that sense. I also understand that anomalies don’t require as precise predictability, but I still think it helps to understand why certain anomalies are given.
