title: How to generate confusion matrix with a custom generator
body: <p>I have implemented  my own custom data generator and I am using <code>model.predict_generator(generator = testing_generator, steps=steps,verbose=0)</code> to generate my predictions. In order to generate confusion maps I am using:</p>
  
  <pre><code>conf_mat = confusion_matrix(testing_generator.classes, y_predict,labels=classes)
  </code></pre>
  
  <p>I am getting an error </p>
  
  <blockquote>
    <p>'generator' object has no attribute 'classes'</p>
  </blockquote>
  
  <p>This is obviously because I did not implement any method to return all the GT back from the generator. I am not sure how to implement such a thing?</p>
  
  <p>my generator has the general form:</p>
  
  <pre><code>    def generator_interference(self,number_of_steps_per_batch):   
  
          for i in range(number_of_steps_per_batch):
              """
              Some code to generates batches of samples
              :return: 
              """
              yield features, labels
  </code></pre>
  
  <p>How can I retrieve the GT to create a confusion matrix? can I simply add a variable named <code>self.classes</code> and accumulate the labels? If so, how do I clear it between predictions? </p>