Skip to content
Hierarchical Temporal Memory in Clojure
Clojure HTML
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dev use feature expressions .cljc with latest clojure, replacing cljx Apr 13, 2015
public core namespace the main API, largely generic, replaces 'hierarchy' an… Sep 19, 2016
src/org/nfrac/comportex
test/org/nfrac/comportex Fix little things that came up in tests Sep 21, 2016
.gitignore update readme and changelog re JS api. Aug 17, 2016
CHANGELOG.md Disable boosting by default Sep 23, 2016
README.md split out parameters into a new layer.params ns Sep 19, 2016
comportex-logo.png fix logo rainbow colours May 15, 2016
project.clj split out parameters into a new layer.params ns Sep 19, 2016

README.md

Comportex

Comportex logo

Comportex is an implementation of Hierarchical Temporal Memory as a Clojure library. It is not a port of NuPIC, it is a separate implementation based initially on the Numenta CLA white paper but significantly evolved.

In the spirit of Clojure, Comportex is more a library than a framework. The user controls simulations, and decides what to do with them. If you want to take the set of active cells and use them to generate predictions or anomaly scores, that is up to you. It's not going to do it automatically.

Comportex is not yet stable. Our aims are to:

  1. understand the theory deeply by implementing it and experimenting with it;
  2. help others to understand the theory via visual explanations; and
  3. further develop the theory by attempting to apply it to new problem types.

Documentation

For an applied exploration of HTM using Comportex, try the essay Predicting power consumptions with HTM by Marcus Lewis.

The core API is in the namespace core, and it is typically used with the layer implementation in layer and the encoder implementations in encoders.

Parameter descriptions can be found in org.nfrac.comportex.layer.params.

Minimum Viable Snippet

(require '[org.nfrac.comportex.core :as cx])
(require '[org.nfrac.comportex.layer :as layer])
(require '[org.nfrac.comportex.encoders :as enc])

(def sensor [:val (enc/unique-encoder [127] 21)])
(def params {})
(def htm
  (cx/network {:layer-a (layer/layer-of-cells params)}
              {:input sensor}))
(def htm2 (cx/htm-step htm {:val "hi"}))
(-> htm2 :layers :layer-a (cx/layer-state) :active-columns)
; #{186 641 898 830 490 805 776 819 758 627 630 485 515 618 872 143 220 392 133 38}

Usage

Get Leiningen first.

Use git to clone this repository. Then, e.g. to start an interactive session:

cd comportex
lein repl

See A sample workflow with the REPL.

Or, for a better experience, check out the Notebook (browser-based REPL with super powers) in Sanity.

Demos

A list of demos can be found in src/org/nfrac/comportex/demos/ and, again, remember that they can also be run with Sanity.

Javascript API

A minimal Javascript API is included, and a small demo which shows how to use it. First, compile to javascript:

lein cljsbuild once

Then load public/comportexjs.html in your browser.

Related projects

Hello

License

Copyright © 2014-2016 Felix Andrews and Marcus Lewis.

Distributed under the GNU Affero General Public Licence, Version 3, the same as NuPIC.

DOI

You can’t perform that action at this time.