# Online Prediction Framework

**URL:** <https://discourse.numenta.org/t/online-prediction-framework/4678>\
**Category:** NuPIC\
**Created:** [October 7, 2018, 9:58am UTC](https://discourse.numenta.org/t/online-prediction-framework/4678 "2018-10-07T09:58:54Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtan](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@jtan](https://discourse.numenta.org/u/jtan)\
**Post date:** [October 7, 2018, 9:58am UTC](https://discourse.numenta.org/t/online-prediction-framework/4678/1 "2018-10-07T09:58:54Z")

</div>

hi,  
first step to my code is create a encoder , my data set is like these {%Y-%m-%d %H:%M:%S.%f , float, float}

> 2018-10-06 00:00:00.033,-0.160,-0.075  
> 2018-10-06 00:00:00.036,-0.155,-0.070  
> 2018-10-06 00:00:00.039,-0.160,-0.070  
> 2018-10-06 00:00:00.042,-0.175,-0.065  
> 2018-10-06 00:00:00.044,-0.180,-0.055  
> 2018-10-06 00:00:00.047,-0.185,-0.050  
> 2018-10-06 00:00:00.050,-0.170,-0.050  
> 2018-10-06 00:00:00.053,-0.155,-0.040  
> 2018-10-06 00:00:00.056,-0.175,-0.040  
> 2018-10-06 00:00:00.058,-0.180,-0.055

to encode my data set:

- To the date : DateEncoder
- To float:RandomDistributedScalarEncoder

but the probleme in my data time is with Millisecond and the parameters of DateEncoder is with Day and hour.  
so my question is to solve this probleme:  
\*I must create Model Parameters Or Create an OPF Model ?  
\*change the parameters of DateEncoder ? (how)  
I use this link to learn:[HTM](http://nupic.docs.numenta.org/1.0.5/)  
thanks

---

<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:** [October 7, 2018, 2:14pm UTC](https://discourse.numenta.org/t/online-prediction-framework/4678/3 "2018-10-07T14:14:57Z")

</div>

If your dates are in milliseconds, the date encoder is not going to produce any useful semantic encodings. Milliseconds are not “human scale” time periods.

> [@jtan](#):
>
> \*I must create Model Parameters Or Create an OPF Model ?

Model params are used to create all types of models in our examples.

---

<div class="post-metadata">

**Author:** ![jtan](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@jtan](https://discourse.numenta.org/u/jtan)\
**Post date:** [October 7, 2018, 3:40pm UTC](https://discourse.numenta.org/t/online-prediction-framework/4678/4 "2018-10-07T15:40:57Z")

</div>

So in my case, what type of encoders could I use to my data set

---

<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:** [October 7, 2018, 3:42pm UTC](https://discourse.numenta.org/t/online-prediction-framework/4678/5 "2018-10-07T15:42:18Z")

</div>

Scalar encoders for your scalar data, but what does your data represent? When you plot this data, do you see patterns?

---

<div class="post-metadata">

**Author:** ![jtan](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@jtan](https://discourse.numenta.org/u/jtan)\
**Post date:** [October 7, 2018, 3:58pm UTC](https://discourse.numenta.org/t/online-prediction-framework/4678/6 "2018-10-07T15:58:46Z")

</div>

my data are present signal ECG

---

<div class="post-metadata">

**Author:** ![jtan](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@jtan](https://discourse.numenta.org/u/jtan)\
**Post date:** [October 7, 2018, 4:31pm UTC](https://discourse.numenta.org/t/online-prediction-framework/4678/7 "2018-10-07T16:31:33Z")

</div>

Yes, I will use scalar encoders for my scalar data, but I 'm confused about the type of encoders for my data time because my time is with millisecond

---

<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:** [October 7, 2018, 4:46pm UTC](https://discourse.numenta.org/t/online-prediction-framework/4678/8 "2018-10-07T16:46:15Z")

</div>

You don’t encode time because it is at sub-human scale. Humans don’t semantically understand sub-second timing.

Have a look at this, It is a similar data type.

> [@HTM and automatic seizure detection using EEG data](https://discourse.numenta.org/t/htm-and-automatic-seizure-detection-using-eeg-data/1917):
>
> Hi, Matt taylor First of all, I am really appreciated for your lecture (HTM School). It helped me a lot. I want to use HTM for automatic seizure detection using EEG data. and there are some projects dealing with EEG data. But I want to use not a single channel. To detect seizure, I have to use many channels and I am going to use not a raw data but features include Power spectral density. I don’t know how to use HTM for these. Do I have to use HTM regions for each features? Then I need hun…

Also:

[![](https://img.youtube.com/vi/tw1dmxcI8pU/maxresdefault.jpg "Recording of NuPIC analyzing ECG data") ](https://www.youtube.com/watch?v=tw1dmxcI8pU)

Here is the source: [https://github.com/rhyolight/online-anomaly-detection/tree/master/mat\_src](https://github.com/rhyolight/online-anomaly-detection/tree/master/mat_src)

---

<div class="post-metadata">

**Author:** ![jtan](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@jtan](https://discourse.numenta.org/u/jtan)\
**Post date:** [October 10, 2018, 10:00pm UTC](https://discourse.numenta.org/t/online-prediction-framework/4678/9 "2018-10-10T22:00:46Z")

</div>

hi matt,  
I try your exemple [https://github.com/rhyolight/online-anomaly-detection/tree/master/mat\_src](https://github.com/rhyolight/online-anomaly-detection/tree/master/mat_src) , and I make some changes in the model\_params the update of the parametrs of SP and TM but have this error :  
return \_engine\_internal.Network\_addRegion(self, \*args, \*\*kwargs)  
TypeError: **init** () takes at least 3 arguments (3 given)

---

<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:** [October 10, 2018, 11:02pm UTC](https://discourse.numenta.org/t/online-prediction-framework/4678/10 "2018-10-10T23:02:52Z")

</div>

Unfortunately that code is pre NuPIC 1.0, so it is broken. You should be able to lift the model parameters from it and apply them to your code.

---

<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:** [October 11, 2018, 3:30pm UTC](https://discourse.numenta.org/t/online-prediction-framework/4678/11 "2018-10-11T15:30:57Z")

</div>

I should mention the [OPF Quickstart](http://nupic.docs.numenta.org/stable/quick-start/opf.html) in case you haven’t seen it.
