code: def create(
      dataset,
      target,
      feature=None,
      model="resnet-50",
      l2_penalty=0.01,
      l1_penalty=0.0,
      solver="auto",
      feature_rescaling=True,
      convergence_threshold=_DEFAULT_SOLVER_OPTIONS[
          "convergence_threshold"
      ],
      step_size=_DEFAULT_SOLVER_OPTIONS["step_size"],
      lbfgs_memory_level=_DEFAULT_SOLVER_OPTIONS["lbfgs_memory_level"],
      max_iterations=_DEFAULT_SOLVER_OPTIONS["max_iterations"],
      class_weights=None,
      validation_set="auto",
      verbose=True,
      seed=None,
      batch_size=64,
  ):
      """
      Create a :class:`ImageClassifier` model.
  
      Parameters
      ----------
      dataset : SFrame
          Input data. The column named by the 'feature' parameter will be
          extracted for modeling.
  
      target : string, or int
          Name of the column containing the target variable. The values in this
          column must be of string or integer type. String target variables are
          automatically mapped to integers in the order in which they are provided.
          For example, a target variable with 'cat' and 'dog' as possible
          values is mapped to 0 and 1 respectively with 0 being the base class
          and 1 being the reference class. Use `model.classes` to retrieve
          the order in which the classes are mapped.
  
      feature : string, optional
          indicates that the SFrame has either column of Image type or array type
          (extracted features) and that will be the name of the column containing the input
          images or features. 'None' (the default) indicates that only feature column or the
          only image column in `dataset` should be used as the feature.
  
      l2_penalty : float, optional
          Weight on l2 regularization of the model. The larger this weight, the
          more the model coefficients shrink toward 0. This introduces bias into
          the model but decreases variance, potentially leading to better
          predictions. The default value is 0.01; setting this parameter to 0
          corresponds to unregularized logistic regression. See the ridge
          regression reference for more detail.
  
      l1_penalty : float, optional
          Weight on l1 regularization of the model. Like the l2 penalty, the
          higher the l1 penalty, the more the estimated coefficients shrink toward
          0. The l1 penalty, however, completely zeros out sufficiently small
          coefficients, automatically indicating features that are not useful
          for the model. The default weight of 0 prevents any features from
          being discarded. See the LASSO regression reference for more detail.
  
      solver : string, optional
          Name of the solver to be used to solve the regression. See the
          references for more detail on each solver. Available solvers are:
  
          - *auto (default)*: automatically chooses the best solver for the data
            and model parameters.
          - *newton*: Newton-Raphson
          - *lbfgs*: limited memory BFGS
          - *fista*: accelerated gradient descent
  
          For this model, the Newton-Raphson method is equivalent to the
          iteratively re-weighted least squares algorithm. If the l1_penalty is
          greater than 0, use the 'fista' solver.
  
          The model is trained using a carefully engineered collection of methods
          that are automatically picked based on the input data. The ``newton``
          method  works best for datasets with plenty of examples and few features
          (long datasets). Limited memory BFGS (``lbfgs``) is a robust solver for
          wide datasets (i.e datasets with many coefficients).  ``fista`` is the
          default solver for l1-regularized linear regression. The solvers are all
          automatically tuned and the default options should function well. See
          the solver options guide for setting additional parameters for each of
          the solvers.
  
          See the user guide for additional details on how the solver is chosen.
          (see `here
          <https://apple.github.io/turicreate/docs/userguide/supervised-learning/linear-regression.html>`_)
  
      feature_rescaling : boolean, optional
          Feature rescaling is an important pre-processing step that ensures that
          all features are on the same scale. An l2-norm rescaling is performed
          to make sure that all features are of the same norm. Categorical
          features are also rescaled by rescaling the dummy variables that are
          used to represent them. The coefficients are returned in original scale
          of the problem. This process is particularly useful when features
          vary widely in their ranges.
  
      convergence_threshold : float, optional
          Convergence is tested using variation in the training objective. The
          variation in the training objective is calculated using the difference
          between the objective values between two steps. Consider reducing this
          below the default value (0.01) for a more accurately trained model.
          Beware of overfitting (i.e a model that works well only on the training
          data) if this parameter is set to a very low value.
  
      lbfgs_memory_level : float, optional
          The L-BFGS algorithm keeps track of gradient information from the
          previous ``lbfgs_memory_level`` iterations. The storage requirement for
          each of these gradients is the ``num_coefficients`` in the problem.
          Increasing the ``lbfgs_memory_level ``can help improve the quality of
          the model trained. Setting this to more than ``max_iterations`` has the
          same effect as setting it to ``max_iterations``.
  
      model : string optional
          Uses a pretrained model to bootstrap an image classifier:
  
             - "resnet-50" : Uses a pretrained resnet model.
                             Exported Core ML model will be ~90M.
  
             - "squeezenet_v1.1" : Uses a pretrained squeezenet model.
                                   Exported Core ML model will be ~4.7M.
  
             - "VisionFeaturePrint_Scene": Uses an OS internal feature extractor.
                                            Only on available on iOS 12.0+,
                                            macOS 10.14+ and tvOS 12.0+.
                                            Exported Core ML model will be ~41K.
  
          Models are downloaded from the internet if not available locally. Once
          downloaded, the models are cached for future use.
  
      step_size : float, optional
          The starting step size to use for the ``fista`` solver. The default is
          set to 1.0, this is an aggressive setting. If the first iteration takes
          a considerable amount of time, reducing this parameter may speed up
          model training.
  
      class_weights : {dict, `auto`}, optional
          Weights the examples in the training data according to the given class
          weights. If set to `None`, all classes are supposed to have weight one. The
          `auto` mode set the class weight to be inversely proportional to number of
          examples in the training data with the given class.
  
      validation_set : SFrame, optional
          A dataset for monitoring the model's generalization performance.
          The format of this SFrame must be the same as the training set.
          By default this argument is set to 'auto' and a validation set is
          automatically sampled and used for progress printing. If
          validation_set is set to None, then no additional metrics
          are computed. The default value is 'auto'.
  
      max_iterations : int, optional
          The maximum number of allowed passes through the data. More passes over
          the data can result in a more accurately trained model. Consider
          increasing this (the default value is 10) if the training accuracy is
          low and the *Grad-Norm* in the display is large.
  
      verbose : bool, optional
          If True, prints progress updates and model details.
  
      seed : int, optional
          Seed for random number generation. Set this value to ensure that the
          same model is created every time.
  
      batch_size : int, optional
          If you are getting memory errors, try decreasing this value. If you
          have a powerful computer, increasing this value may improve performance.
  
      Returns
      -------
      out : ImageClassifier
          A trained :class:`ImageClassifier` model.
  
      Examples
      --------
      .. sourcecode:: python
  
          >>> model = turicreate.image_classifier.create(data, target='is_expensive')
  
          # Make predictions (in various forms)
          >>> predictions = model.predict(data)      # predictions
          >>> predictions = model.classify(data)     # predictions with confidence
          >>> predictions = model.predict_topk(data) # Top-5 predictions (multiclass)
  
          # Evaluate the model with ground truth data
          >>> results = model.evaluate(data)
  
      See Also
      --------
      ImageClassifier
      """
      start_time = _time.time()
  
      # Check model parameter
      allowed_models = list(_pre_trained_models.IMAGE_MODELS.keys())
      if _mac_ver() >= (10, 14):
          allowed_models.append("VisionFeaturePrint_Scene")
      _tkutl._check_categorical_option_type(
          "model", model, allowed_models
      )
  
      # Check dataset parameter
      if not isinstance(dataset, _tc.SFrame):
          raise TypeError(
              "Unrecognized type for 'dataset'. An SFrame is expected."
          )
      if len(dataset) == 0:
          raise _ToolkitError("Unable to train on empty dataset")
      if (feature is not None) and (
          feature not in dataset.column_names()
      ):
          raise _ToolkitError(
              "Image feature column '%s' does not exist" % feature
          )
      if target not in dataset.column_names():
          raise _ToolkitError(
              "Target column '%s' does not exist" % target
          )
  
      if batch_size < 1:
          raise ValueError(
              "'batch_size' must be greater than or equal to 1"
          )
  
      if not (
          isinstance(validation_set, _tc.SFrame)
          or validation_set == "auto"
          or validation_set is None
      ):
          raise TypeError("Unrecognized value for 'validation_set'.")
  
      if feature is None:
          try:
              feature = image_analysis._find_only_image_extracted_features_column(
                  dataset, model
              )
              feature_type = "extracted_features_array"
          except:
              feature = None
  
          if feature is None:
              feature = _tkutl._find_only_image_column(dataset)
              feature_type = "image"
      else:
          if image_analysis._is_image_deep_feature_sarray(
              dataset[feature], model
          ):
              feature_type = "extracted_features_array"
          elif dataset[feature].dtype is _tc.Image:
              feature_type = "image"
          else:
              raise _ToolkitError(
                  'The "{feature}" column of the SFrame neither has the dataype image or extracted features array.'.format(
                      feature=feature
                  )
                  + ' "Datasets" consists of columns with types: '
                  + ", ".join(
                      [x.__name__ for x in dataset.column_types()]
                  )
                  + "."
              )
  
      _tkutl._handle_missing_values(
          dataset, feature, "training_dataset"
      )
      feature_extractor = (
          _image_feature_extractor._create_feature_extractor(model)
      )
      if feature_type == "image":
          # Extract features
          extracted_features = _tc.SFrame(
              {
                  target: dataset[target],
                  "__image_features__": feature_extractor.extract_features(
                      dataset,
                      feature,
                      verbose=verbose,
                      batch_size=batch_size,
                  ),
              }
          )
      else:
          extracted_features = _tc.SFrame(
              {
                  target: dataset[target],
                  "__image_features__": dataset[feature],
              }
          )
  
      # Validation set
      if isinstance(validation_set, _tc.SFrame):
          if feature_type == "image":
              _tkutl._handle_missing_values(
                  validation_set, feature, "validation_set"
              )
              extracted_features_validation = _tc.SFrame(
                  {
                      target: validation_set[target],
                      "__image_features__": feature_extractor.extract_features(
                          validation_set,
                          feature,
                          verbose=verbose,
                          batch_size=batch_size,
                      ),
                  }
              )
          else:
              extracted_features_validation = _tc.SFrame(
                  {
                      target: validation_set[target],
                      "__image_features__": validation_set[feature],
                  }
              )
      else:
          extracted_features_validation = validation_set
  
      # Train a classifier using the extracted features
      extracted_features[target] = dataset[target]
      lr_model = _tc.logistic_classifier.create(
          extracted_features,
          features=["__image_features__"],
          target=target,
          max_iterations=max_iterations,
          validation_set=extracted_features_validation,
          seed=seed,
          verbose=verbose,
          l2_penalty=l2_penalty,
          l1_penalty=l1_penalty,
          solver=solver,
          feature_rescaling=feature_rescaling,
          convergence_threshold=convergence_threshold,
          step_size=step_size,
          lbfgs_memory_level=lbfgs_memory_level,
          class_weights=class_weights,
      )
  
      # set input image shape
      if model in _pre_trained_models.IMAGE_MODELS:
          input_image_shape = _pre_trained_models.IMAGE_MODELS[
              model
          ].input_image_shape
      else:  # model == VisionFeaturePrint_Scene
          input_image_shape = (3, 299, 299)
  
      # Save the model
      state = {
          "classifier": lr_model,
          "model": model,
          "max_iterations": max_iterations,
          "feature_extractor": feature_extractor,
          "input_image_shape": input_image_shape,
          "target": target,
          "feature": feature,
          "num_features": 1,
          "num_classes": lr_model.num_classes,
          "classes": lr_model.classes,
          "num_examples": lr_model.num_examples,
          "training_time": _time.time() - start_time,
          "training_loss": lr_model.training_loss,
      }
      return ImageClassifier(state)
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import turicreate
  import time
  from turicreate.toolkits._model import CustomModel
  import turicreate.toolkits._internal_utils
  from turicreate.toolkits import _coreml_utils
  from turicreate.toolkits._main import ToolkitError
  from turicreate.toolkits._model import PythonProxy
  from turicreate._deps.minimal_package import _minimal_package_import_check
  from .._internal_utils import _mac_ver
  from ..None import _pre_trained_models
  from ..None import _image_feature_extractor
  from ..image_analysis import image_analysis
  from ._evaluation import Evaluation
label_desc: Use image node_id 1 for calling a global function with example usage: create(dataset, target, feature, model, l2_penalty, l1_penalty, solver, feature_rescaling, convergence_threshold, step_size, lbfgs_memory_level, max_iterations, class_weights, validation_set, verbose, seed, batch_size) and returns: ImageClassifier