Spatial Pooler, when to learn?

I am experimenting with anomaly detection on new york taxi data.
But I am not getting correct anomalies.
I am using Anomaly from

from nupic.algorithms.anomaly import Anomaly
from nupic.algorithms.anomaly_likelihood import AnomalyLikelihood
from nupic.algorithms.sdr_classifier import SDRClassifier

Should I let the Spatial pooler learn first or use directly without learning first?
Can we infer an input is an anomaly or not from SDR classifier ( It is mapping to the buckets from encoder)? If yes, then how?

The configuration used for NAB has SP learning on all the time. Remember that HTM is different from Deep Learning, in that there is no “training” or “test” phases. There is no “learning” phase. The brain, and the algorithms inspired by it (SP + TM) are continuous learning systems. They can always learn, at each time step.

So typically, these systems will always be learning. That is what makes them able to adjust to the changing data landscape. Patterns in streaming temporal data tend to change over time. You cannot assume that reality will stay constant. Our brains are so successful because they always learn, and can adjust quickly when the world changes.

The classifier has nothing to do with anomaly scores or likelihoods. Anomaly scores are created by comparing predicted minicolumns to active minicolumns. Read more about how anomalies are calculated in our docs.