{"action":"created","issue":{"url":"https://api.github.com/repos/numenta/nupic.core/issues/889","repository_url":"https://api.github.com/repos/numenta/nupic.core","labels_url":"https://api.github.com/repos/numenta/nupic.core/issues/889/labels{/name}","comments_url":"https://api.github.com/repos/numenta/nupic.core/issues/889/comments","events_url":"https://api.github.com/repos/numenta/nupic.core/issues/889/events","html_url":"https://github.com/numenta/nupic.core/issues/889","id":144587767,"number":889,"title":"Low-level Anomaly example","user":{"login":"breznak","id":2166111,"avatar_url":"https://avatars.githubusercontent.com/u/2166111?v=3","gravatar_id":"","url":"https://api.github.com/users/breznak","html_url":"https://github.com/breznak","followers_url":"https://api.github.com/users/breznak/followers","following_url":"https://api.github.com/users/breznak/following{/other_user}","gists_url":"https://api.github.com/users/breznak/gists{/gist_id}","starred_url":"https://api.github.com/users/breznak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/breznak/subscriptions","organizations_url":"https://api.github.com/users/breznak/orgs","repos_url":"https://api.github.com/users/breznak/repos","events_url":"https://api.github.com/users/breznak/events{/privacy}","received_events_url":"https://api.github.com/users/breznak/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/numenta/nupic.core/labels/status:blocked","name":"status:blocked","color":"fbca04"},{"url":"https://api.github.com/repos/numenta/nupic.core/labels/status:in%20progress","name":"status:in progress","color":"bfe5bf"},{"url":"https://api.github.com/repos/numenta/nupic.core/labels/type:examples","name":"type:examples","color":"006b75"}],"state":"open","locked":false,"assignee":{"login":"breznak","id":2166111,"avatar_url":"https://avatars.githubusercontent.com/u/2166111?v=3","gravatar_id":"","url":"https://api.github.com/users/breznak","html_url":"https://github.com/breznak","followers_url":"https://api.github.com/users/breznak/followers","following_url":"https://api.github.com/users/breznak/following{/other_user}","gists_url":"https://api.github.com/users/breznak/gists{/gist_id}","starred_url":"https://api.github.com/users/breznak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/breznak/subscriptions","organizations_url":"https://api.github.com/users/breznak/orgs","repos_url":"https://api.github.com/users/breznak/repos","events_url":"https://api.github.com/users/breznak/events{/privacy}","received_events_url":"https://api.github.com/users/breznak/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2016-03-30T13:15:47Z","updated_at":"2016-03-30T14:54:50Z","closed_at":null,"body":"I wish to make a simple yet complete example for anomaly detection in C++ chain. \r\n\r\n- [ ] parse a CSV file\r\n- [ ] process with the available classes (Encoder(Scalar) -> SpatialPooler -> TemporalMemory (or older TemporalPooler) -> Anomaly) \r\n- [ ] print (and write to a file) the anomaly score\r\n\r\nBlocked by: #869 \r\n\r\nQuestions and notes: \r\n- [ ] is there a helper class to deal with CSV? \r\nlike \r\n```\r\ncsv = CSVHelper.initialize(\"mydata.csv\", skipNRows,...); \r\nvector<float> res = csv.readLine(); \r\n```\r\nI found `VectorFile{,Sensor}.hpp` but that's heavily tied to OPF Nework API; \r\n- [ ] note: there seem to be some unnecessary conversions between `vector<Real> and vector<UInt>`, that should be optimized in the interface. \r\n- [ ] for Anomaly, I need `active and predicted vectors (columns)`; in TemporalMemory there is: \r\n\r\nactive Cells: https://github.com/numenta/nupic.core/blob/master/src/nupic/algorithms/TemporalMemory.hpp#L457 \r\n\r\npredicted cells: https://github.com/numenta/nupic.core/blob/master/src/nupic/algorithms/TemporalMemory.hpp#L464\r\n\r\nor set of predicted columns: https://github.com/numenta/nupic.core/blob/master/src/nupic/algorithms/TemporalMemory.hpp#L684 \r\nWhich do I use for anomaly computation? I should use active/predicted columns (there is only the Set public, no get() method and no method for active columns). Or is it ok to use just the cells array? (meaning dimension is cols x cells) in Anomaly? \r\n- [ ] as above, which would be the respective calls for (old but default) TP (Cells4)? "},"comment":{"url":"https://api.github.com/repos/numenta/nupic.core/issues/comments/203472733","html_url":"https://github.com/numenta/nupic.core/issues/889#issuecomment-203472733","issue_url":"https://api.github.com/repos/numenta/nupic.core/issues/889","id":203472733,"user":{"login":"subutai","id":1268932,"avatar_url":"https://avatars.githubusercontent.com/u/1268932?v=3","gravatar_id":"","url":"https://api.github.com/users/subutai","html_url":"https://github.com/subutai","followers_url":"https://api.github.com/users/subutai/followers","following_url":"https://api.github.com/users/subutai/following{/other_user}","gists_url":"https://api.github.com/users/subutai/gists{/gist_id}","starred_url":"https://api.github.com/users/subutai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/subutai/subscriptions","organizations_url":"https://api.github.com/users/subutai/orgs","repos_url":"https://api.github.com/users/subutai/repos","events_url":"https://api.github.com/users/subutai/events{/privacy}","received_events_url":"https://api.github.com/users/subutai/received_events","type":"User","site_admin":false},"created_at":"2016-03-30T14:54:50Z","updated_at":"2016-03-30T14:54:50Z","body":"@breznak I will let @scottpurdy reply to specifics, but I think this would be a nice C++ example to have. \r\n\r\nWe should make sure we validate using NAB to make sure there are no subtle bugs. Note that the C++ TemporalMemory API is very similar to the Python API, so you should be able to just look at the Python code and mimic it in C++.  I would also recommend against doing too much early optimization - get the thing working, profile, and then optimize. The vast vast majority of the time will be spent in TM and SP."}}