Actually the line 5 is this:

5 - predicted_columns = tp_region.getOutputData('topDownOut').nonzero()[0]

* tp_region *

And I forgot to mention this is basically the example at
/examples/network/network_api_demo.py, using HotGym dataset.

2015-01-20 12:16 GMT-03:00 Ricardo Franco <[email protected]>:

> ok. First I tested with KNNClassifier. I didnt get good results.
>
> Then I tested Subutai's reply (actually I think Matt was talking about
> this classifier too) and it seems it worked good :)
>
> I just want someone to confirm I'm doing it right. This is the piece of
> code:
>
> # Code Start
>
> 1 - classifier_region = network.addRegion('classifier',
> 'py.CLAClassifierRegion', json.dumps({'steps': '1', 'implementation':
> 'cpp'}))
>
> 2 - classifier_region.setParameter('learningMode', True)
> 3 - classifier_region.setParameter('inferenceMode', True)
>
> 4 - params = {'bucketIdx': encoder.getBucketIndices({'consumption':
> consumption, 'timestamp': timestamp}), 'actValue': consumption})
> 5 - predicted_columns = sp_region.getOutputData('topDownOut').nonzero()[0]
>
> 6 - result = classifier_region.getSelf().customCompute(i,
> predicted_columns, params)
> 7 - inference = result['actualValues'][numpy.argmax(result[1])]
>
> # Code End
>
> I'm not sure if the line 5 is correct. I mean if I should use topDownOut
> as the input for the Classifier.
> And maybe the line 4 is wrong too.
>
>
> 2015-01-19 20:54 GMT-03:00 Subutai Ahmad <[email protected]>:
>
> Hi Ricardo,
>>
>> The CLAClassifier is responsible for doing this. It is in:
>>
>> nupic/algorithms/CLAClassifier.py
>>
>> There is also a faster C++ version. If you are using the Network API,
>> there is a CLAClassifierRegion. The OPF uses this to map SDR's back to the
>> input values.
>>
>> --Subutai
>>
>>
>> On Mon, Jan 19, 2015 at 9:24 AM, Ricardo Franco <[email protected]>
>> wrote:
>>
>>> Lets consider a SpatialEncoder that encode the value 99 to [0 0 0 0 1 1]
>>>
>>> The SpatialPooler will receive this [0 0 0 0 1 1] and output a totally
>>> different thing to 'bottomUpOut' output (this new array/matrix is the SDR,
>>> right?)
>>>
>>> Lets the SDR is [0 0 1 0 0 0 1 0 1 0 0 1 1 0].
>>>
>>> Now how to get the SDR back to 99? Is this possible?
>>>
>>> --
>>>
>>> Ricardo Franco Andrade
>>>
>>> *Web Developer*
>>>
>>> email: [email protected]
>>> skype: ricardo.krieg
>>> phone: +55 (86) 9569 8521
>>> linkedin: http://br.linkedin.com/in/ricardokrieg/
>>> github: https://github.com/ricardokrieg
>>>
>>>
>>>
>>
>
>
> --
>
> Ricardo Franco Andrade
>
> *Web Developer*
>
> email: [email protected]
> skype: ricardo.krieg
> phone: +55 (86) 9569 8521
> linkedin: http://br.linkedin.com/in/ricardokrieg/
> github: https://github.com/ricardokrieg
>
>
>


-- 

Ricardo Franco Andrade

*Web Developer*

email: [email protected]
skype: ricardo.krieg
phone: +55 (86) 9569 8521
linkedin: http://br.linkedin.com/in/ricardokrieg/
github: https://github.com/ricardokrieg

Reply via email to