htm.core
htm.core copied to clipboard
Try to create iPython online notebook in google Collab
When running under Google Colab using the following command: "!python3 -m htm.examples.hotgym"
The following was the print-out (no error) but no plot at the end:
Parameters: { 'enc': {'resolution': 0.88, 'size': 700, 'sparsity': 0.02}, 'sdrc_alpha': 0.1, 'sp': { 'boostStrength': 3.0, 'columnCount': 1638, 'numActiveColumnsPerInhArea': 72, 'potentialPct': 0.85, 'synPermActiveInc': 0.04, 'synPermConnected': 0.13999999999999999, 'synPermInactiveDec': 0.006}, 'time': {'timeOfDay': (30, 1), 'weekend': 21}, 'tm': { 'activationThreshold': 17, 'cellsPerColumn': 13, 'initialPerm': 0.21, 'maxSegmentsPerCell': 128, 'maxSynapsesPerSegment': 64, 'minThreshold': 10, 'newSynapseCount': 32, 'permanenceDec': 0.1, 'permanenceInc': 0.1}}
Encoded Input SDR( 11765 ) Sparsity Min/Mean/Std/Max 0.00543986 / 0.00552255 / 1.35811e-05 / 0.00552486 Activation Frequency Min/Mean/Std/Max 0 / 0.00552295 / 0.0317386 / 0.502847 Entropy 0.635806 Overlap Min/Mean/Std/Max 0.307692 / 0.891246 / 0.126693 / 1
Spatial Pooler Mini-Columns SDR( 1638 ) Sparsity Min/Mean/Std/Max 0.043956 / 0.0439559 / 2.08729e-07 / 0.043956 Activation Frequency Min/Mean/Std/Max 0.0170804 / 0.0439561 / 0.0182792 / 0.10066 Entropy 0.979711 Overlap Min/Mean/Std/Max 0 / 0.846308 / 0.256087 / 1 Spatial Pooler Connections: Inputs (11765) ~> Outputs (1638) via Segments (1638) Segments on Cell Min/Mean/Max 1 / 1 / 1 Potential Synapses on Segment Min/Mean/Max 10000 / 10000 / 10000 Connected Synapses on Segment Min/Mean/Max 86 / 395.876 / 2454 Synapses Dead (0.913949%) Saturated (0.00240562%)
Temporal Memory Cells SDR( 21294 ) Sparsity Min/Mean/Std/Max 0.00338123 / 0.0123309 / 0.013492 / 0.043956 Activation Frequency Min/Mean/Std/Max 0.00204964 / 0.012331 / 0.00762384 / 0.0594398 Entropy 0.968392 Overlap Min/Mean/Std/Max 0 / 0.609997 / 0.381052 / 1 Temporal Memory Connections: Inputs (17335) ~> Outputs (21294) via Segments (41695) Segments on Cell Min/Mean/Max 0 / 1.95806 / 11 Potential Synapses on Segment Min/Mean/Max 32 / 36.8715 / 64 Connected Synapses on Segment Min/Mean/Max 28 / 34.0534 / 64 Synapses Dead (0%) Saturated (0.283736%)
Predictive Error (RMS) 1 steps ahead: 18.07927468676872 Predictive Error (RMS) 5 steps ahead: 22.10117101589806 Anomaly Mean 0.2099781116136428 Anomaly Std 0.3366711792821944 <Figure size 640x480 with 2 Axes>
I had tried to put an inline comand: "%matplotlib inline" underneath "import matplotlib.pyplot as plt", but got the same result
import matplotlib.pyplot as plt
%matplotlib inline
same result: (no plot) ..... <Figure size 640x480 with 2 Axes>
Please help!
- I think the examples don't install the plot dependencies by default, so check matplotlib is install
- check that matplotlib is working in the google ipython notebook, I suspect it's not
I had tried to import matplotlib at the beginning and also via inline versions: both were NOT effective or obtained the same result --> <Figure size 640x480 with 2 Axes>
I also had added a simple "print" (print ("Checking matplotlib here") ) statement underneath "import matplotlib.pyplot as plt" and got nothing printed!
Can anyone guide me what to do next?! Many thanks.
I'd suggest first try to run the example locally under ipython3
if it works?
this seems the plot works actually, do you need to call something like plt.show()
?
But overall, this does not seem like issue in htm.core itself.
I tried the following in a new cell under Colab and it plotted the test chart!
Testing of matplotlib
import os !pwd !ls -l
import matplotlib.pyplot as plt plt.plot(range(10)) plt.show()
and it plotted a diagonal line.
So why it won't plot in hotgym.py???
I don't why it doesn't work. It works for me on my computer. From your description it sounds like an issue with matplotlib.
Here is a stack-overflow link which might describe your issue? https://stackoverflow.com/questions/13151514/matplotlib-plot-window-wont-appear
Maybe you could try changing the line plt.show
to plt.savefig('filename.svg')
and then viewing the saved image file?
@cyberslam would you describe your steps to install htm.core in google colab? I'd love to have an online iPython notebook on Collab for htm.core! :bulb:
Sorry for "stealing" the issue, but with the information, I'll turn this into an optional "HTM on Collab" issue.
Hi Ben, Sorry to tell you that I was unable to install the htm.core under colab.Cheers,Samuel ~Sent from my Samsung Galaxy smartphone.
Thanks for the message.
I was unable to install the htm.core under colab.
ok, this will be easily possible once we get to pip installable package #19
@indy-3rdman moving the iPython online demo/notebook here
https://github.com/htm-community/htm.core/issues/829#issuecomment-640502932
Exactly! This is pretty sweet! :100: I'd definitely love that notebook in our examples/
and accessible directly from the readme :+1:
now one thing, you have it already running in docker/binder. Does that require you to manually maintain/build the docker image, or is it built on the fly from master? Since we now can easily install releases from pip
, we could use the "normal" collab/ipython notebook and run it there. What do you suggest?
@breznak, that was just a quick POC using the existing image, which also runs the rest_server needed for the C# examples anyway.
I might be wrong, but I think the binder related files need to be either on the root level or in the binder directory for it to work. Would that be a problem?
The docker image build is not yet fully automated, but that's on my agenda anyway. I just don't know, when I'll have the time to dig into it. Hope that's OK.
think the binder related files need to be [...] or in the binder directory for it to work
this is ok :+1:
a quick POC using the existing image, which also runs the rest_server needed for the C# examples anyway.
I see, you're using that for the c# bindings (using REST API) hence you need the c++ build -> docker image, right?
- or are those binaries included (or can we include them) in the
.whl
on PyPI? - for the python "Hellow world HTM example" running live, which I have in mind, I'd like to avoid any extra steps(docker images). And use directly install & import our release from the PyPI.
- Would that work for your use-case too?
@breznak, I've changed it to use the latest whl from test.pypi.org.
As you will notice, it is automatically creating a docker image from the whole repository now, including all the repository files.
This makes me wonder, whether it would make more sense to have the notebooks in a separate repository anyway.... What do you think?
@breznak, an example of how it would look like as separate repository: https://github.com/indy-3rdman/htm.core-jupyter