class_docstr: This wrapper handles sklearn models for image classification.
class_docstr_tok: ["This","wrapper","handles","sklearn","models","for","image","classification","."]
docstr: Runs data through the model and returns output.
docstr_tok: ["Runs","data","through","the","model","and","returns","output","."]
code: def predict(self, image) -> dict:
      """Runs data through the model and returns output."""
      # TODO: This deals with single image right now, maybe extend for batch.
  
      # Convert data format if required.
      # TODO: Maybe refactor this with the code in torch_models.predict.
      image_format = preprocessing.recognize_image_format(image)
      if image_format == "files":
          # TODO: If the network was trained with numpy images,
          #   we need to convert to the same size and potentially convert to
          #   grayscale.
          image = preprocessing.load_image(
              image, to_numpy=True, resize=28, crop=28
          )
      elif image_format == "numpy":
          pass  # no conversion
      else:
          raise RuntimeError()
  
      # Wrap image in batch.
      image_batch = image[None]
  
      # Flatten dimensions.
      image_batch = image_batch.reshape(len(image_batch), -1)
  
      # Scale mean and std.
      image_batch = self.scaler.transform(image_batch)
  
      # Run through model and calculate most likely class.
      probabilities = self.model.predict_proba(image_batch)[0]
      predicted_class = int(np.argmax(probabilities))
      return {
          "predicted_class": predicted_class,
          "probabilities": probabilities,
      }
  
imports: import sklearn.preprocessing
  from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
  from sklearn.gaussian_process import GaussianProcessClassifier
  from sklearn.linear_model import LogisticRegression, SGDClassifier, Perceptron, PassiveAggressiveClassifier
  from sklearn.naive_bayes import GaussianNB
  from sklearn.neighbors import KNeighborsClassifier
  from sklearn.neural_network import MLPClassifier
  from sklearn.svm import SVC, LinearSVC
  from sklearn.tree import DecisionTreeClassifier, ExtraTreeClassifier
  from sklearn.utils import shuffle
  import joblib
  import numpy
  from loguru import logger
  from ..model_wrapper import ModelWrapper
  from .None import preprocessing, visualization
label_desc: Use image node_id 6 for calling the SklearnImageClassificationWrapper obj's underlying member method code with example usage: obj.predict(image) and returns: dict