Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

fixed display of number of active segments #3845

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions examples/tm/hello_tm.py
@@ -1,6 +1,6 @@
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# Copyright (C) 2018, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
Expand Down Expand Up @@ -97,7 +97,7 @@ def formatRow(x):
print("active cells " + str(tm.getActiveCells()))
print("predictive cells " + str(tm.getPredictiveCells()))
print("winner cells " + str(tm.getWinnerCells()))
print("# of active segments " + str(tm.connections.numSegments()))
print("# of active segments " + str(numpy.shape(tm.getActiveSegments())[0]))

# The reset command tells the TM that a sequence just ended and essentially
# zeros out all the states. It is not strictly necessary but it's a bit
Expand Down Expand Up @@ -127,18 +127,18 @@ def formatRow(x):
print("active cells " + str(tm.getActiveCells()))
print("predictive cells " + str(tm.getPredictiveCells()))
print("winner cells " + str(tm.getWinnerCells()))
print("# of active segments " + str(tm.connections.numSegments()))
print("# of active segments " + str(numpy.shape(tm.getActiveSegments())[0]))

activeColumnsIndeces = [tm.columnForCell(i) for i in tm.getActiveCells()]
predictedColumnIndeces = [tm.columnForCell(i) for i in tm.getPredictiveCells()]
activeColumnsIndices = [tm.columnForCell(i) for i in tm.getActiveCells()]
predictedColumnIndices = [tm.columnForCell(i) for i in tm.getPredictiveCells()]


# Reconstructing the active and inactive columns with 1 as active and 0 as
# inactive representation.

actColState = ['1' if i in activeColumnsIndeces else '0' for i in range(tm.numberOfColumns())]
actColState = ['1' if i in activeColumnsIndices else '0' for i in range(tm.numberOfColumns())]
actColStr = ("".join(actColState))
predColState = ['1' if i in predictedColumnIndeces else '0' for i in range(tm.numberOfColumns())]
predColState = ['1' if i in predictedColumnIndices else '0' for i in range(tm.numberOfColumns())]
predColStr = ("".join(predColState))

# For convenience the cells are grouped
Expand Down