Functionally composable cortex, an implementation of Hierarchical Temporal Memory



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 for you.

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.

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


For now there is the annotated source code. The main API is in the namespaces core, protocols and encoders, while the algorithms are mainly in cells, synapses and inhibition.

Parameter descriptions can be found on org.nfrac.comportex.cells/parameter-defaults.

This blog post has some explanation of the protocols.


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.

Related projects


YourKit is kindly supporting this open source project with its full-featured Java Profiler. YourKit, LLC is the creator of innovative and intelligent tools for profiling Java and .NET applications. Take a look at YourKit's leading software products: YourKit Java Profiler and YourKit .NET Profiler.


Copyright © 2014-2015 Felix Andrews and Marcus Lewis.

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