第 1 页,共 30 页

Hierarchical Temporal Memory

Surya Prakash Pathak

Data Scientist, Red Hat

1

Anomaly Detection

Machine Learning at SLAC

第 2 页,共 30 页

Agenda

HTM-Anomaly Detection

2

  • Deep Neural Networks and HTM

  • HTM-Introduction

  • HTM-working mechanism

  • HTM-Anomaly Detection

  • Demo

CONFIDENTIAL Designator

第 3 页,共 30 页

A Thought Experiment

HTM-Anomaly Detection

3

CONFIDENTIAL Designator

第 4 页,共 30 页

A Thought Experiment

HTM-Anomaly Detection

4

Spatial

Temporal

CONFIDENTIAL Designator

第 5 页,共 30 页

Deep Neural Networks

HTM-Anomaly Detection

5

  • Deep Neural Networks (DNN) are frameworks of Assistive Intelligence.

  • Deep Neural Networks have clocked up incredible successes in many areas, (and continue to do so), however

    • DNN needs thousands if not million samples to train on.

    • DNN find it hard to adapt to continually changing data and surprises.

    • DNN are susceptible to noise and can easily be fooled. [Source]

  • DNN do not work as our brain does and cannot lead to true AI.

CONFIDENTIAL Designator

第 6 页,共 30 页

HTM

HTM-Anomaly Detection

6

  • Hierarchical Temporal Memory (HTM) is a theoretical framework for both biological and generalised machine intelligence.

  • Based on the latest understanding of the Neocortex.

  • Only requires a few hundreds samples to learn.

  • Learns unsupervised as it goes and easily handles changing data and surprises.

  • Immune to up to 40% noise.

  • Hierarchical (Levels of Stacked cells), Temporal (Operates over time series data), Memory (Columns of cells decides based on input, previous status of connected neighbours)

  • Opens the way for truly intelligent systems.

CONFIDENTIAL Designator

第 7 页,共 30 页

History

HTM-Anomaly Detection

7

  • 2004 “On Intelligence” by Jeff Hawkins and Sandra Blakeslee.
    • The core concept in Hierarchical Temporal Memory (HTM) theory was first described in this book.

  • 2005 Numenta was established in Redwood city, CA to
    • Reverse engineer the neo-cortex.
    • Apply neocortical theory to AI.

  • 2014 NuPIC (Numenta Platform for Intelligent Computing) was open sourced under the AGPLv3 license.
    • API in Python 2.7, and C++

  • 2015 htm.core, Community fork of nupic.core
    • API in Python 3.7+ and C++

  • 2021 A Thousand Brains Theory by Jeff Hawkins
    • Further explorations of HTM and mechanism of neocortex.

  • HTM is constantly evolving with Numenta’s open research.

CONFIDENTIAL Designator

第 8 页,共 30 页

Neocortex

HTM-Anomaly Detection

8

  • Size of a large table napkin (50x50 sq cm)

  • 75% of brains volume, 2.5 mm thick.

  • 20 billion neurons, Tens of thousands of synapse per neuron.

  • Sparsely Active
    • Only ~2% of spiking at any one time.

  • Constantly predicting its inputs.

  • Learns a model of the world.

CONFIDENTIAL Designator

第 9 页,共 30 页

Neocortex Structure

HTM-Anomaly Detection

9

  • All areas in the neocortex look the same, so they must perform same basic function (same basic algorithm)..

  • What makes one region visual and an another touch depends on what nerve they are connected to.

  • The basic unit of replication is cortical column (1mm^2)
    • About 2M of them
    • So logically the cortical column is the basic unit of computation.

CONFIDENTIAL Designator

第 10 页,共 30 页

Cortical Column

HTM-Anomaly Detection

10

  • Dozens of neuron types

  • Organised into layers

  • Vertical local projections cross all layers

  • Horizontal inter-column long distance projections in some layers

CONFIDENTIAL Designator

第 11 页,共 30 页

Deep Neural Net Neuron

HTM-Anomaly Detection

11

  • Based on the 1957 concept of the Perceptron

  • Learning by adjusting the synaptic weights.

  • Real neuron are not like this.

CONFIDENTIAL Designator

第 12 页,共 30 页

Real Neuron

HTM-Anomaly Detection

12

  • 5K to 30K excitatory synapses on the dendrites.

  • 10% proximal can cause neural spike.

  • 90% distal cannot cause neural spike.

  • Distal dendrites are pattern detectors
    • 8-15 co-active, co-located synapses will generate a dendritic spike.
      • This puts the cell into a depolarised, or “predictive” state.

  • Depolarised neurons fire sooner, inhibiting nearby neurons.

Dendrite

Axon

Dendrites

CONFIDENTIAL Designator

第 13 页,共 30 页

HTM Neuron

HTM-Anomaly Detection

13

  • HTM neurons don’t attempt to model all aspects of biological neurons.

  • Only those that are essential for the informational aspects of the neocortex.

  • HTM neuron state depends on the position and number of activated synapse - not on a sum of weights.

CONFIDENTIAL Designator

第 14 页,共 30 页

Neural Learning

HTM-Anomaly Detection

14

-> BIology

-> HTM - Synapse “permanence” (Synapse state)

  • In HTM neurons, learning is modelled by the growth of new synapse or removal of unused synapse as in biological neurons.
  • This learning occurs by incrementing or decrementing the synapse “permanence”.
  • A synapse is disconnected for a permanence under the threshold.
  • A synapse is connected for a permanence over the threshold.
  • Learning is making or breaking synapses, not adjusting synaptic weights as in DNNs.

CONFIDENTIAL Designator

第 15 页,共 30 页

HTM Cortical Column

HTM-Anomaly Detection

15

CONFIDENTIAL Designator

第 16 页,共 30 页

Sparse Distributed Representations

HTM-Anomaly Detection

16

  • SDRs are how brains solve the problem of representing knowledge. It is used in a cortex for every aspect of cognitive function.
  • Each bit has semantic meaning.
  • Extremely high capacity. For 2048 bit vector and 2% are set, we have >> 10^84 unique patterns.

Capacity :

Fixed sparseness

  • Two representations with shared bits have some shared semantic information.
  • Comparing two representations is as simple as taking the intersection of the two indices sets.
  • SDRs are inherently fault-tolerant and noise tolerant.

CONFIDENTIAL Designator

第 17 页,共 30 页

Sequence (formally Temporal) Memory

HTM-Anomaly Detection

17

  • Learns sequences of SDRs and make predictions of what the next input SDR will be.
  • Extremely robust (40% noise and fault tolerant).
  • Learning is unsupervised and continuous.
  • Learns higher order sequences: “ABCD” vs “XBCY”.

CONFIDENTIAL Designator

第 18 页,共 30 页

High Order Sequence Prediction

HTM-Anomaly Detection

18

CONFIDENTIAL Designator

第 19 页,共 30 页

Sequence Prediction Step by Step

HTM-Anomaly Detection

19

Trained Two Sequences A-B-C-D and X-B-C-Y

  • So starting with B and inputting C predicts both D and Y.
  • Hence Sequence Memory handles surprise and multiple simultaneous predictions.

CONFIDENTIAL Designator

第 20 页,共 30 页

Anomaly

HTM-Anomaly Detection

20

  • Anomalies are data points within the datasets that appears to deviate markedly from expected outputs.
  • Spatial and Temporal Anomalies.
  • Anomaly detection refers to the problem of finding patterns in data that don’t confirm to expected behavior.

CONFIDENTIAL Designator

第 21 页,共 30 页

HTM- Anomaly Detection

HTM-Anomaly Detection

21

CONFIDENTIAL Designator

第 22 页,共 30 页

HTM- Anomaly Detection

HTM-Anomaly Detection

22

Raw Anomaly Scores

Raw anomaly scores is the fraction of active columns that were not predicted.

Set of cells predicted from previous timestamp

Current set of active cells

Number of active columns

0 : Perfectly predicted

1 : Completely unpredicted

CONFIDENTIAL Designator

第 23 页,共 30 页

HTM- Anomaly Detection

HTM-Anomaly Detection

23

Raw Anomaly Scores

CONFIDENTIAL Designator

第 24 页,共 30 页

HTM- Anomaly Detection

HTM-Anomaly Detection

24

Anomaly Likelihood: Likelihood that a given anomaly score represents a true Anomaly

Compute normal distribution over history

Anomaly Likelihood is computed as the complement of the tail probability

Mean of all anomaly scores so far

Mean of all anomaly scores in recent time window (10 samples)

CONFIDENTIAL Designator

第 25 页,共 30 页

HTM- Anomaly Detection

HTM-Anomaly Detection

25

Anomaly Likelihood

CONFIDENTIAL Designator

第 26 页,共 30 页

Anomaly Detection Operate first CPU-usage data

HTM-Anomaly Detection

26

How data is extracted?

CONFIDENTIAL Designator

第 27 页,共 30 页

Anomaly Detection using HTM

HTM-Anomaly Detection

27

Demo - Run through the notebook showing the time series data for input signal, prediction and detection of anomalies.

CONFIDENTIAL Designator

第 28 页,共 30 页

Commercials applications HTM

HTM-Anomaly Detection

28

https://grokstream.com/

https://www.cortical.io/

https://intelletic.com/

CONFIDENTIAL Designator

第 29 页,共 30 页

Acknowledgements

HTM-Anomaly Detection

29

https://github.com/htm-community/htm.core

https://numenta.com/

CONFIDENTIAL Designator

第 30 页,共 30 页

30

Who am I?

CONFIDENTIAL Designator