Skip to content

Trouble learning #265

@4iar

Description

@4iar

This is an extremely cool project!

I am having trouble getting the network to learn tasks though.

To get started with the package (v0.2.4), I tried throwing some OpenAI gyms at it. I used the breakout_stdp.py example script and changed the environment from 'BreakoutDeterministic-v4' to 'CartPole-v0', then modified inpt (n=4, shape=[4,1]) and out (n=2) to correspond to the CartPole task.

I ran 650 iterations of the task but saw no improvement in the accumulated reward. I've tried experimenting with some of the different learning/update rules with no success. I've also tried some of my own custom OpenAI gyms but found no success either. What other things could I try to get the network to learn the task? I am also new to neural networks & reinforcement learning so maybe there are some obvious things I've missed.

Cheers!





Some other info:

I ran into two issues and have mentioned them here just in case they are related:

  1. Running the script throws the following error:
Traceback (most recent call last):
  File "run.py", line 36, in <module>
    environment.reset()
  File "/Users/x/bindsnet/bindsnet/environment/__init__.py", line 237, in reset
    self.preprocess()
  File "/Users/x/bindsnet/bindsnet/environment/__init__.py", line 268, in preprocess
    self.obs = subsample(gray_scale(self.obs), 84, 110)
  File "/Users/x/bindsnet/bindsnet/datasets/preprocess.py", line 13, in gray_scale
    return cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
cv2.error: OpenCV(4.1.0) /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/color.simd_helpers.hpp:92: error: (-2:Unspecified error) in function 'cv::impl::(anonymous namespace)::CvtHelper<cv::impl::(anonymous namespace)::Set<3, 4, -1>, cv::impl::(anonymous namespace)::Set<1, -1, -1>, cv::impl::(anonymous namespace)::Set<0, 2, 5>, cv::impl::(anonymous namespace)::SizePolicy::NONE>::CvtHelper(InputArray, OutputArray, int) [VScn = cv::impl::(anonymous namespace)::Set<3, 4, -1>, VDcn = cv::impl::(anonymous namespace)::Set<1, -1, -1>, VDepth = cv::impl::(anonymous namespace)::Set<0, 2, 5>, sizePolicy = cv::impl::(anonymous namespace)::SizePolicy::NONE]'
> Invalid number of channels in input image:
>     'VScn::contains(scn)'
> where
>     'scn' is 1

It looked related to the different input format.

I temporarily worked around this by commenting out the subsample line in the preprocessing step: https://github.com/Hananel-Hazan/bindsnet/blob/0.2.4/bindsnet/environment/__init__.py#L268

  1. The plots only show a single time step (big horizontal bars), rather than spikes/voltages across the entire trial (e.g. like in this fig: https://i.imgur.com/Sltk55I.png).

image

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions