►
From YouTube: Bit Arrays (Episode 1)
Description
Let's start at the very beginning! HTMs rely heavily on bit arrays, so here are the basics.
Intro music: "Books" by Minden: https://minden.bandcamp.com/track/books-2
A
Hi
I'm
Matt
Taylor
of
Numenta
welcome
to
episode
1
of
HTM
school,
where
we
are
going
to
talk
about
VIP
arrays,
yes,
Ben
arrays,
so
this
is
the
most
basic
of
basics
when
it
comes
to
HTM
Theory.
This
is
a
precursor
to
some
SDR
episodes
that
are
coming
up,
but
I
want
to
go
over
some
of
the
most
basic
functions
of
bit
array,
so
you'll
be
familiar
with
them.
A
If
you're
a
computer
scientist
or
a
computer
engineer,
you
have
some
experience,
you
can
probably
just
skip
this
episode
if
you
are
familiar
with
bit
arrays
and
binary
operations
and
things
like
that,
but
there
are
maybe
some
tasty
nuggets
at
the
end
where
we
talk
specifically
about
some
sparse
representations
that
can
fit
into
bit
arrays.
So
here
we
go
here
is
a
bit
array.
A
So
this
is
an
8
bit
array
you
can
tell,
because
it
has
8
things
in
it.
The
things
are
bits
a
bit
can
be
1
or
0.
That
means
on
or
off
positive
or
negative,
and
that's
basically,
all
of
it
is
2
values
on
or
off,
and
this
bit
array
has
eight
of
them.
So
how
can
we
tell
what
the
capacity
of
this
is?
How
many
different
values
can
this
bit
array
represent?
A
Well,
that's
somewhat
simple,
because
we
know
each
bit
can
represent
two
values
and
there
are
eight
of
them,
so
we
can
multiply
them
all
together.
Two
times
two
times
two
times
two
times
two
times
two
to
do,
which
is
256,
you
might
notice.
We
could
write
this
as
two
to
the
eighth
power
so
two
times
two
eight
times,
because
there
are
eight
elements
in
the
array:
each
one
can
have
two
values:
that's
how
math
works.
A
Also,
if
you
know
the
length
of
your
array,
you
know
the
capacity
of
your
array,
because
you
can
just
take
two
to
the
power
of
the
length
of
the
array.
That
is
the
array
of
capacity.
So
let's
talk
about
binary.
Binary
is
a
way
to
encode
integer
numbers
within
bit
arrays.
You
can
either
start
on
the
right
or
on
the
left
and
we're
going
to
start
on
the
right
hand,
side
and
work
our
way
to
the
left.
A
As
you
can
see
here,
each
position
in
the
bit
array
is
going
to
represent
a
different
power
of
two
and,
if
the
bit
is
on
we're
going
to
add
that
number
to
the
accumulating
number
that
we're
building
so
in
this
case,
with
all
of
the
numbers
that
are
on
all
of
the
place,
positions
that
are
on
we're
going
to
take
those
numbers
that
those
represent
and
add
them
together,
and
this
adds
up
to
109.
So
this
bit
array
of
0,
1,
1,
0,
1,
1
0
1,
is
109.
A
If
we
were
to
take
one
of
those
bits
and
flip
it
make
it
the
opposite.
In
this
case,
we'll
take
this
0
and
we'll
make
it
a
1.
It
completely
changes
the
value
of
this
binary
representation
from
109
to
125
because
it
adds
16
to
it.
So
it's
this
bit
array
does
not
have
any
real
semantic
value
to
these
positions,
except
that
they
are
just
accumulating.
You
know
doubling
as
we
move
from
one
side
to
the
other.
A
Let's
talk
about
ASCII
real,
quick
ASCII
is
a
character
format
that
can
be
represented
in
8
bits,
so
8
bits
me
can
represent
a
character
in
this
case.
This
is
the
character
lowercase
M
0,
1,
1,
0,
1,
1,
0,
1,
lowercase
M.
Just
because
the
people
who
created
the
ASCII
standard
decided
that
would
represent
M.
A
It
doesn't
necessarily
mean
that
any
of
those
bits
mean
anything
if
I
were
to
take
a
bit
inside
of
the
m
value
and
switch
it
to
the
opposite
bit
and
it
becomes
something
completely
different
as
no
relation
to
M
at
all.
It's
not
even
a
letter,
so
that
tells
us
that
this
representation,
this
ASCII
representation,
that's
encoded
into
this
bit
array,
has
no
semantic
value,
meaning
those
positions
in
that
bit
array
really
have
don't
represent
anything.
It's
just
random.
A
Somebody
decided
that
if
this
string
of
bits
was
in
this
position,
that
would
mean
a
more
that
would
mean
X
or
whatever
so
no
semantic
value
in
this.
Let's
talk
about
a
few
basic
binary
operations,
real
quick,
so
we'll
start
with
an
or
so
if
we
have
two
bit
arrays
and
we
want
to
take
the
or
of
them,
we
would
just
take
each
place
position
and
if
I
either
one
of
them
is
positive
or
one,
then
that
results
in
a
positive
value.
A
So
in
this
case
we
get
a
bit
array
with
a
bunch
of
ones
at
the
bottom,
because
most
of
the
bits
of
the
two
values
that
we
roaring
have
at
least
one
in
each
place
value.
So
there's
only
one
that
results
in
a
zero
because
both
of
them
were
zero.
So
when
you
or
two
values
together,
you're
typically
going
to
get
a
new
bit
array
with
more
ones
in
it,
let's
talk
about
and
another
very
basic
binary
operation
very
similar
to
or
except
we're,
not
saying.
A
A
So
in
this
case
we
get
several
less
one
values
than
we
did
when
we
ordered
them
together,
because
any
of
them
that
have
both
positive
values
will
turn
into
a
negative
value.
So
that
is
the
exclusive
or
XOR
a
not
is
extremely
simple.
It's
an
inverse,
essentially
so
you're
just
taking
every
place
value.
We're
not
comparing
it
to
another
bit
array,
we're
just
saying
if
it's
a
zero
make
it
or
if
it's
one
make
it
a
zero
and
you
essentially
get
the
inverse
of
that
bit
already.
A
So
when
we
talk
about
population,
all
that
means
is
how
many
positive
values
are
in
the
bit
array.
In
this
case
five,
there
are
five
ones
in
this
bit
array,
and
that
is
the
population.
You
will
sometimes
see
this
referred
to
as
the
Hamming
weight,
which
is
essentially
the
same
thing
when
we're
talking
about
a
binary
array.
The
Hamming
weight
is
actually
the
number
of
symbols
in
the
representation
that
are
nonzero,
but
when
we're
talking
about
a
bit
array,
it's
the
same
thing
as
the
number
of
things
that
are
1.
A
So
let's
talk
about
a
bigger
array,
36
bits,
so
we
have
a
256
bit
array
here
and
let's
talk
about
the
capacity
of
this,
so
our
8
bit
array
had
contain
256
values
right
so
now
we've
got
an
array
with
256
places
in
it
its
capacity
is
going
to
be
huge.
Remember
it's
2
to
the
power
of
the
length
of
the
array
so
2
to
the
256
power,
which
is
1
with
77
zeros
after
it.
This
is
a
very
large
number.
A
It's
not
quite
the
amount
of
atoms
in
the
observable
universe,
but
we're
getting
up
there.
So
you
can
contain
a
lot
of
different
data
representations
in
a
simple
256
bit
array,
so
sparsity
versus
density.
I
would
consider
this
a
dense
array.
If
you
look
at
it,
it's
about
50%,
on
50%
off,
typically
in
HTM
speak,
we
talked
about
dense
array,
is
a
much
lower
density
than
that
when
we
talk
about
sparsity,
we're
usually
talking
about
2%,
so
50%
is
very
dense.
A
If
you
look
at
a
truly
sparse
array
like
this
one,
only
4
bits
are
on
that's
2
percent
of
256.
It
looks
a
lot
different
and
it's
capacity
is
a
lot
different
to
much
much
much
less.
That
just
means,
if
we're
going
to
keep
the
sparsity
of
this
array
down
to
2%
and
only
have
4
bits
on
there's
a
lot
fewer
different
representations
that
we
can
store
in
it.
In
this
case
it's
about
175
million.
A
So
we
could
store
for
on
bits
in
this
array
about
175
million
ways
and
we'll
talk
about
the
math
of
this
when
we
start
talking
about
sparse,
distributed
representations
in
future
episodes
but
to
squeak
into
the
SDR
realm.
Let's
talk
about
this
sparse
array
as
a
way
of
representing
features,
so
we
could
say
that
these
four
bits
that
are
on
might
represent
features
of
a
population
of
people.
For
example.
This
bit
might
mean
that
the
person
representing
is
a
musician.
This
bit
might
mean
their
gender
is
female.
A
Another
bit
could
mean
that
they're
currently
alive
and
another
could
mean
that
they
are
african-american.
So
if
we
had
a
representation
like
this,
this
could
represent
several
different
people
like
Beyonce
Macy,
Gray
Aretha
Franklin,
but
it
would
not
represent
someone
like
Whitney
Houston,
because
she
is
not
living
Bobby
Brown,
because
he
is
not
female
jay-z
for
various
reasons.
So
let's
talk
a
little
bit
about
compression.
A
So
if
you
have
an
array
like
this
dense
array,
that
is
about
50%
on
and
that's
that's
all
this
is
each
bit
has
about
a
50%
chance
of
being
on
or
off.
We
can't
compress
this
array
any
further.
It
is
as
compressed
as
it
can
get
because
it's
essentially
random.
If
we're
talking
about
a
sparse
array
like
1
with
4%
on,
then
we
always
know,
there's
only
going
to
be
at
most
4
bits
within
this
representation
that
are
going
to
be
on
at
any
time.
So
we
can
compress
this
quite
a
bit.
A
All
we
need
to
store
are
the
indices
of
those
on
bits.
So
if
we
grab
those
four
indices
of
those
bits,
we
can
store
just
those
four
numbers
and
since
we
know
that
we
could
store
an
integer
up
to
256
in
an
8-bit
array.
That
means
we
can
store
this
in
32
bits
so
of
all
those
175
million
possible
values
that
we
could
fit
into
a
sparse
representation
of
200
56
bits.
A
Each
of
them
could
be
stored
in
a
32-bit
array,
so
we
know
that
we
can
compress
sparse
representations
in
bit
arrays
very
efficiently
and
now
I've.
Given
you
example
of
what
a
sparse
array
looks
like
versus
a
dense
array
and
some
basic
binary
operations,
we're
gonna
talk
a
lot
more
about
sparse
arrays.
When
we
talk
about
sparse,
distributed
representations
in
the
upcoming
episodes,
so
I
hope
you
enjoyed
this
short
intro
into
binary
and
fit
arrays
and
binary
operations.
I
hope
you'll
follow
up
and
watch
the
next
episodes
hit
like
and
subscribe.