Skip to content

Instantly share code, notes, and snippets.

@marty1885
Created February 1, 2019 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marty1885/42b6b96c75335b86bd067a1a53bda224 to your computer and use it in GitHub Desktop.
Save marty1885/42b6b96c75335b86bd067a1a53bda224 to your computer and use it in GitHub Desktop.
#include "HTMHelper.hpp"
using namespace HTM;
int main()
{
TemporalMemory tm({16}, 8);
CategoryEncoder encoder(2, 8);
std::vector<size_t> seq = {0,0,1,1};
for(size_t i=0;i<6400;i++) {
auto res = tm.compute(encoder.encode(seq[i%seq.size()]), true);
auto cat = encoder.decode(res);
if(cat.size() != 0)
std::cout << cat[0] << '\n';
else
std::cout << "None" << '\n';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment