class_docstr: ```
  predicts image classes
  ```
class_docstr_tok: ["``","`","predicts","image","classes","``","`"]
docstr: ```
  Makes predictions on validation set and returns the confusion matrix.
  Accepts as input a genrator (e.g., DirectoryIterator, DataframeIterator)
  representing the validation set.
  
  
  Optionally prints a classification report.
  Currently, this method is only supported for binary and multiclass
  problems, not multilabel classification problems.
  ```
docstr_tok: ["``","`","Makes","predictions","on","validation","set","and","returns","the","confusion","matrix",".","Accepts","as","input","a","genrator","(","e.g.",",","DirectoryIterator",",","DataframeIterator",")","representing","the","validation","set",".","Optionally","prints","a","classification","report",".","Currently",",","this","method","is","only","supported","for","binary","and","multiclass","problems",",","not","multilabel","classification","problems",".","``","`"]
code: def analyze_valid(
      self, generator, print_report=True, multilabel=None
  ):
      """
      ```
      Makes predictions on validation set and returns the confusion matrix.
      Accepts as input a genrator (e.g., DirectoryIterator, DataframeIterator)
      representing the validation set.
  
  
      Optionally prints a classification report.
      Currently, this method is only supported for binary and multiclass
      problems, not multilabel classification problems.
      ```
      """
      if multilabel is None:
          multilabel = U.is_multilabel(generator)
      if multilabel:
          warnings.warn(
              "multilabel_confusion_matrix not yet supported - skipping"
          )
          return
  
      y_true = generator.classes
      # *_generator methods are deprecated from TF 2.1.0
      # y_pred = self.model.predict_generator(generator)
      y_pred = self.model.predict(generator)
      y_pred = np.argmax(y_pred, axis=1)
      if print_report:
          print(
              classification_report(y_true, y_pred, target_names=self.c)
          )
      if not multilabel:
          cm_func = confusion_matrix
          cm = cm_func(y_true, y_pred)
      else:
          cm = None
      return cm
  
file_path: ktrain/ktrain/vision/predictor.py
imports: from ..None import utils
  from ..imports import *
  from ..predictor import Predictor
  from .preprocessor import ImagePreprocessor
label_desc: Use image node_id 12 for calling the ImagePredictor obj's underlying member method code with example usage: obj.analyze_valid(generator, print_report, multilabel) and returns: cm