Using region/network in nupic.core?

cpp

#61

@scott now i want to get the result like scalar, for example prediction data, from a region back to my main() after each run().
What is the best way for doing it? Thanks


#62

I found out “the best way for doing it” … it is solved!!!


#63

Great! Let me know if you have other questions!


#64

You could also share what you found to be “the best way for doing it”. :smiley:


#65

Matt: My solution as follows: I create a encoder/decoder region outside of L2L4Column and make a link directly from ETM region back to encoder/decoder region for decoding.
Advantages of this structure:

  1. the user can build L2L4Column in any topology and
  2. the encoder/decoder region is connected only to a L2L4Column at the lowest level of this hierarchy
  3. the same encoder/decoder region for generating SDR from sensor data (here from the main program) and for decoding SDR data into the predictive data.

#66

I have another problem by the output of a region into the input of another region like
output data: 0, 0, 1, 1, 0, 1
input data: 0, 0, 1065353216, 1065353216, 0, 1065353216

Make sure both input and output have the same data type of Real32.
I really do not understand why the linking multiply my bit by 1065353216.
Where does the value 1065353216 come from? the max. value of Real32?

@scott: is it a bug or unknown feature?


#67

There must be a bad conversion happening somewhere. Perhaps you are passing in a numpy array with the wrong dtype?


#68

I do not think that here is a numpy conversion problem because i use c++ network api and link the output “activeCells” of the etm region back to the decoder region. I displayed directly the buffer content of out and input and there is no conversion here. I believe more on a bug.


#69

Good point! I don’t know where the bug could be but it seems like it must be a type conversion somewhere. You’ll have to follow the code to see where the corruption happens. You can use a debugger or just put print statements in.


#70

Sure, but i have very little experience with gdb under Ubuntu. However i will find out it tomorow…


#71

Print statements will probably be easier!

Unfortunately we don’t have great C++ examples so there are likely some places where it is easy to go wrong.

If you find that the data corruption is happening in a Python region then let me know but I’m guessing it is an issue between your client code and the network API.


#72

Now i am able to do some experiments with networks in c++ and hope will get some good results soon


#73

@thanh-binh.to Can you show your code when you do your experiments with networks in c++? It is a very interesting topic for me. Because now we do our tasks in Network Python API. It seems to me you be good at this topic.But we have problems with network.run.


If I need to run one sequence twice, the network.run() will interleave the resulting sequence. How to keep the order?
I hope the picture will help to explain my issue.

Thanx a lot!
Sergey


#74

I never run a network multiple times for one input value like network.run(2). Without looking at your source code it is very hard to say why it does not run correctly. It depends on how you create your network, how your region implementation and its parameter looks like? The data types using in a region are “very sensitive” so that a slightly mismatch of data types will fail etc…Hope that helps!


#75

@thanh-binh.to Maybe you have some methods how to do sequence in the bottom of pic ?


#76

Unfortunately i do not have it, because i am not following the sequence prediction now. I am learning how the feedback from high level can improve the prediction performance.