Hi Mateja,

This is a good question. The example that you mention is using the
CLAModel, which is an OPF wrapper around a Network instance. A Network has
a set of Regions that are linked together and each Region is a single
algorithm component (like encoders, a spatial pooler, or a temporal memory
instance). To get the data you are interested in, the first step is to
extract the algorithm instances from the network, specifically the temporal
memory (called TP in the code) and the spatial pooler. Here is a sample:

# Extract the spatial pooler
spRegion = model._getSPRegion()

# Extract the temporal memory
tmRegion = model._getTPRegion()
tm = tmRegion.getSelf()._tfdr

# Get the active cells
tm.infActiveState["t"]


*Spatial Pooler* - for connections between columns and inputs

>From here, you can look at the implementations of the algorithms to see how
to get each of the pieces of information that you need. The spatial pooler
is a Python wrapper around a C++ class. The implementation is here:
https://github.com/numenta/nupic.core/blob/master/src/nupic/algorithms/SpatialPooler.hpp

and the wrapper code is here:
https://github.com/numenta/nupic/blob/284f53d55aeb948857267246661a617caf8848fe/nupic/bindings/algorithms.i#L1829

Alternatively, you can change the model parameters in this file to set
spatialImp to "py":
https://github.com/numenta/nupic/blob/284f53d55aeb948857267246661a617caf8848fe/examples/opf/clients/hotgym/simple/model_params.py#L99

which will use this pure-Python implementation:
https://github.com/numenta/nupic/blob/master/nupic/research/spatial_pooler.py

*Temporal Memory* - for connections between cells, active cells, predicted
cells, anomaly score

The example you mention is using a hybrid Python/C++ temporal memory
implementation. The Python class is called TP10X2 and some of the state is
stored in a C++ class called Cells4:
https://github.com/numenta/nupic/blob/master/nupic/research/TP10X2.py
https://github.com/numenta/nupic.core/blob/master/src/nupic/algorithms/Cells4.hpp

I hope this helps. If you have trouble getting some values then let me know!

On Fri, Mar 13, 2015 at 11:31 AM, Mateja Putic <[email protected]> wrote:

> I am working on a project related to computer architecture and HTM and I
> am interested in extracting architectural parameters from the CLA after
> learning. What's the best way to do this?
>
> For example, in the examples/opf/clients/hotgym/simple example, after
> running the CLA with the inputs, I'd like to extract these parameters from
> the model:
>
> - Connections between bits of the input vector and columns
> - Connections between cell outputs and segments
> - Number of segments on a cell
> - Segment thresholds
>
> What data structures contain this information, and in what file(s) are
> their getters?
>
> Thanks,
>
> --
> Mr. Mateja Putic
> Ph.D Candidate
> Department of Electrical and Computer Engineering
> University of Virginia
> (703) 303-2099
>

Reply via email to