Skip to content

Commit

Permalink
Better fix for numenta#3172, using the initialize() function and chec…
Browse files Browse the repository at this point in the history
…king if _sdrClassifier is set
  • Loading branch information
natoromano committed Jun 22, 2016
1 parent 1c12bd2 commit fcfac4f
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/nupic/regions/SDRClassifierRegion.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,7 @@ def __init__(self,
self.verbosity = verbosity

# Initialize internal structures
self._sdrClassifier = SDRClassifierFactory.create(
steps=self.stepsList,
alpha=self.alpha,
verbosity=self.verbosity,
implementation=self.implementation,
)

self._sdrClassifier = None
self.learningMode = True
self.inferenceMode = False
self.maxCategoryCount = maxCategoryCount
Expand All @@ -251,7 +245,19 @@ def __init__(self,


def initialize(self, inputs, outputs):
pass
"""
Is called once by NuPIC before the first call to compute(). Initializes self._sdrClassifier
is it is not already initialized.
@param inputs -- inputs of the classifier region
@param outputs -- outputs of the classifier region
"""
if self._sdrClassifier is None:
self._sdrClassifier = SDRClassifierFactory.create(
steps=self.stepsList,
alpha=self.alpha,
verbosity=self.verbosity,
implementation=self.implementation,
)


def getAlgorithmInstance(self):
Expand Down

0 comments on commit fcfac4f

Please sign in to comment.