How to use Delta encoder

I have a metric where I want to model difference between records instead of the record values. I understood Delta encoder will be applicable in this case. Can someone guide how to use it or any example associated with this encoder.

Sorry, but I donā€™t think we use this encoder in any of our old applications. You can at least see how it is supposed to work in the unit tests.

I think it would be equivalent if you simply did differencing in preprocessing, that way the raw input values fed to the encoder would be the differences themselves, and you could just pass to Scalar Encoder or RDSE as any other data.

1 Like

Iā€™m working on the same thing. I preprocess to get the difference and then feed that to a scalar encoder. In my case I use the āˆš of the change ^2 so Iā€™m just measuring from zero. Iā€™ll encode the direction (+/-) separately if I need it and create a combined encoder similar to encoding weekends

2 Likes

Ok interesting. Of course you could just leave out the sum of square and have a range of negative and positive numbers with just 1 encoded field, though your way makes sense if you want to separate magnitude and direction into their own features.

Hi Sam.

My research is on finding outliers in physiological parameters. These tend to have very low narrow ranges so you want a change of say 6 beats per minute in heartrate to be encoded similarly whether up or down - otherwise a change from 60 to 66 will encode very differently to a change from 66 to 60. Likewise you want a change of say 100 to be towards the outer edge of the input space regardless of direction.
A sudden increase in heartrate can be as significant as a sudden decrease.

As well as this with coercing the values to positive, I know the minimum change will always be zero - i.e. it forms a nice gamma distribution so itā€™s easier to work with from an encoding perspective.

Seperating magnitude from direction also letā€™s me show if the patient is heading towards or away from ā€œnormalā€ regardless of their current position.

1 Like

Thanks @REager for the peek into your application! Your encoding choices make sense to me given the nature of these physiologic features. Iā€™d certainly be curious to hear about your results if youā€™d like to share when ready :smiley:

1 Like

Thanks Sam :blush:

If I can manage to make it to the end of the year with my sanity intact (not that it ever was!) my intention is to share my code (hopefully as a package in R) as well as my research paper once itā€™s been marked, with the HTM community.

2 Likes

Alright cool! Also just so you know I have a script that implements nupic anomaly detection on n-dimensional time series by making individual models for each feature, and raising system anomalies when enough of the fields are anomalous at once. It outputs a csv with these system anomaly times and the sets of fields that were anomalous at those times. If youā€™d like Iā€™d be glad to run your data through it and send the results.

2 Likes

Cool. It might be good to compare results when Iā€™m done. Thanks for the idea

2 Likes

I was trying to do separate modelsā€¦one model for difference and another model for 3 directions (+,- and nochange).

Example:- for the previous value is 60,
if current value= 61,diff= 1,direction= +
if current value= 58,diff= 2,direction= -
if current value=60, diff=0,direction=no change

Are you using nupic for direction model? what will be the max and value for swarm_description.py?

@Millan you can use only different model for this task so that the different value is in the range like [-10,+10] , where 10 is the max change value. Some years ago I successfully used it for encoding data somehows in neuromorphic way

Hi Milan.

It depends on your use case of course but I think that a combination encoding is the way to go. If the delta has a large encoding area and the change is simply three in 9 for example then 2+, 2- and 2 no change will have a very similar encoding but be different enough to be able to classify the direction