numenta / nupic-legacy

Numenta Platform for Intelligent Computing is an implementation of Hierarchical Temporal Memory (HTM), a theory of intelligence based strictly on the neuroscience of the neocortex.
http://numenta.org/
GNU Affero General Public License v3.0
6.33k stars 1.56k forks source link

DateEncoder only has 1 holiday #3821

Closed JonnoFTW closed 6 years ago

JonnoFTW commented 6 years ago

The dateencoder has functionality to indicate if a day is a holiday:

https://github.com/numenta/nupic/blob/master/src/nupic/encoders/date.py#L297-L323

The problem is that it only lists December 25 as a holiday. You should probably be able to pass in your own holidays given that different countries have different holidays that may fall in different days of the year.

My proposal is to have an extra parameter you can pass in to a date encoder that is a list of tuples that look like:

holidays = [(12, 25), (2018, 4, 1)]

If year isn't provided, it just uses the current year, otherwise it checks if year, month, day match the current record. This allows December 25, but also covers moving holidays like Easter Sunday (April 1 for 2018, April 16 for 2017)

rhyolight commented 6 years ago

Sorry I missed this earlier. I think there is already a way to input holidays, need to investigate.

rhyolight commented 6 years ago

Ok looks like a good feature to me. I'll ask @lscheinkman if he can review the PR.