Instantly share code, notes, and snippets.

Embed
What would you like to do?
#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