Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporal Memory Examples (Python) #497

Merged
merged 10 commits into from Jun 9, 2019
Merged

Temporal Memory Examples (Python) #497

merged 10 commits into from Jun 9, 2019

Conversation

ctrl-z-9000-times
Copy link
Collaborator

@ctrl-z-9000-times ctrl-z-9000-times commented Jun 9, 2019

I am considering dropping the following files since they are unit tests, not examples. I can add them in a latter PR.

  • py/src/nupic/examples/tm/tm_constant_test.py
  • py/src/nupic/examples/tm/tm_overlapping_sequences.py
  • py/src/nupic/examples/tm/tm_segment_learning.py
  • py/src/nupic/examples/tm/tm_test.py

@ctrl-z-9000-times ctrl-z-9000-times added this to the Release version 1.0 milestone Jun 9, 2019
dkeeney
dkeeney previously approved these changes Jun 9, 2019
Copy link

@dkeeney dkeeney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks good.
Should we remove BacktrackingTM and BacktrackingTMCPP?

__doc__ = """
A tutorial that shows some features of the Temporal Memory.

This program has demonstrates some basic properties of the
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An extra has.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very nice demonstration of TM. 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot!

py/src/nupic/examples/tm/tm_overlapping_sequences.py Outdated Show resolved Hide resolved

def testFastLearning(self):
"""
Test with fast learning, make sure PAM allows us to train with fewer
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is PAM? I assume P is probably Prediction but I don't know what 'A' and 'M' are.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PAM stands for "Pay Attention Mode". It was part of the backtracking TM.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. I guess I should have remembered that.

if g_options.verbosity > 1:
print("Creating BacktrackingTMCPP instance")

cppTM = BacktrackingTMCPP(numberOfCols = numCols, cellsPerColumn = 4,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again...there is no C++ backtracking DM

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...I mean 'TM'

@ctrl-z-9000-times
Copy link
Collaborator Author

For issue #216.

@ctrl-z-9000-times
Copy link
Collaborator Author

On further review, I'm definitely going to drop the following files from this PR:

  • py/src/nupic/examples/tm/tm_constant_test.py
  • py/src/nupic/examples/tm/tm_overlapping_sequences.py
  • py/src/nupic/examples/tm/tm_segment_learning.py
  • py/src/nupic/examples/tm/tm_test.py

Because:

  • They are unit tests, outside of the scope of this PR.
  • They don't have any print statements to guide the user through whats going on. They don't even have very many inline comments.
  • They all use the BacktrackingTM, not the normal TM.
  • They are big, messy, and complicated so turning these files into presentable examples looks to be time consuming.

@ctrl-z-9000-times ctrl-z-9000-times marked this pull request as ready for review June 9, 2019 16:33
@ctrl-z-9000-times ctrl-z-9000-times changed the title Temporal Memory Examples (Python) - WIP Temporal Memory Examples (Python) Jun 9, 2019
@ctrl-z-9000-times ctrl-z-9000-times self-assigned this Jun 9, 2019
@ctrl-z-9000-times ctrl-z-9000-times added example python not py binding, but merge py code in repo TM labels Jun 9, 2019
Copy link

@dkeeney dkeeney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool.

@ctrl-z-9000-times ctrl-z-9000-times merged commit a7d7b5f into master Jun 9, 2019
@ctrl-z-9000-times ctrl-z-9000-times deleted the tm-examples branch June 9, 2019 23:57
@ctrl-z-9000-times
Copy link
Collaborator Author

Thanks for reviewing this!

Copy link
Member

@breznak breznak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good examples, thanks for bringing them in!
One thing, can these be either turned to unit-tests, or ran as a part of testing?

print("")
print("Creating the Temporal Memory")
tm = TM(columnDimensions = (50,),
cellsPerColumn=1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TM with 1 cell/col does not really make sense (no higher order learning), unless it's necessary for the example, this should use "normal" number of cells, ie 4,8,...

print("Creating the Temporal Memory")
tm = TM(
columnDimensions = (2048,),
cellsPerColumn=8,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

..oh, ok

@ctrl-z-9000-times
Copy link
Collaborator Author

turned to unit-tests, or ran as a part of testing?

Not easily. The primary output of these examples are the text they write and the figures they create. IIRC We already have unit tests which do very similar things as these examples.

@breznak
Copy link
Member

breznak commented Jun 10, 2019

We already have unit tests which do very similar things as these examples.

ok, that was my concern, then cease closed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
example python not py binding, but merge py code in repo ready TM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants