gcamfer / gym-classification

Open AI gym environment for classification task
4 stars 1 forks source link

IndexError: index 2373 is out of bounds for axis 0 with size 2373 #1

Closed mitrasafari closed 3 years ago

mitrasafari commented 3 years ago

Hello, first thanks for sharing your code. I run your code with MNIST dataset without any problem but when I use it for my dataset after 13 epochs ,I get an error on # Update states for next step self.true_labels = np.take(self.y,self.current_indices,axis=0).ravel() and the erroe is: IndexError: index 2373 is out of bounds for axis 0 with size 2373 do you know why this happend?

mitrasafari commented 3 years ago

I understand why this error happened, I write my solution in case someone has the same problem. this error occurred because my length of x_train is 2373 and the code generate an index that includes 2373 solution: in env_4_rl_classification.py file -> def step if(max(self.current_indices) + self.batch_size ) > len(self.X): change to if(max(self.current_indices) + self.batch_size + 1) > len(self.X):

gcamfer commented 3 years ago

Thanks for the bug fix, you could have opened a pull request I'll change it rigth now.