Periodic scalar encoder

Hi, I am new to HTM. I love your project and I download your Java library to see if it could be of any use for some field in finance (predicting stock return??) I was trying to use the scalar encoder to code a periodicity element (time minutes for intraday data). I realised that I got an exception when data = maxValue. Is it supposed to work like that? I though the scalar should throw an exception if input max (but extremes should be included). Is it a small bug or am I getting it wrong? (line 330 of ScalarEncode.java)
Thanks Enrico

1 Like

Hi @Enrico_Michelotti !

I’m very happy that you are enjoying HTM.Java and also welcome! More than it being any select group’s or single individual’s library, I’d like to mention that it is a community sourced and driven project for which we all can have a sense of ownership. In fact, you bringing up questions over some of the functionality is by all means a contribution in its own right, and we are all better off for it!

Now to your specific question. maxValue is a “bound” marking the upper bound and by convention most often is not inclusive, and that is the case here. For example, a bound of 0-15 usually (by convention) means anything in the range of 0 (inclusive), and 14 (15 being the not-included [excluded] bound).

You are however correct that it is not very clear, and I think it should be documented that minVal and maxVal are inclusive, noninclusive (in that order).

That is both here in the Python version and here in the Java version.

If you’d like to open an issue to have that documentation improved, that would be great (also if you’d like to submit a PR to fix it - that would be great also… :stuck_out_tongue: )

Anyway, welcome…

Also, something of a more helpful comment would be that if you know the range of your data, make sure maxVal is set to one unit higher than the maximum value of your data. Otherwise, a good option would be to use the RandomDistributedScalarEncoder which can operate on data who’s range is not known previously and is very useful for adjusting to software requiring encoding that must adjust to different ranges possibly. Hope that helps…

Also, predicting the Stock Market requires prediction of a vast number of variables and may not be an application within the current scope of today’s HTMs?

Hi, thank you very much for your prompt response. It is clear now (even though I dont get why maxValue should not be include :slight_smile:

you said:
Also, predicting the Stock Market requires prediction of a vast number of variables and may not be an application within the current scope of today’s HTMs?

Why is that? For difficulty or time consuming of the model to manage/deal with many variable at the same time? Or for other issues embedded in the model? Your answer/opinion would be very interesting to me. I found a paper online on HTM vs classical neural networks saying HTM could ‘at least’ do a good job in predicting financial data as other neural networks do. So there is space to explore that? What am I missing?

Thanks for your time
Enrico

1 Like