docstr: Update a classifier with metrics and model information and mark it as
  "complete"
  
  classifier_id: ID of the classifier to save
  
  model: Model object containing a serializable representation of the
      final model generated by this classifier.
  
  metrics: Dictionary containing cross-validation and test metrics data
      for the model.
docstr_tok: ["Update","a","classifier","with","metrics","and","model","information","and","mark","it","as","''","complete","''","classifier_id",":","ID","of","the","classifier","to","save","model",":","Model","object","containing","a","serializable","representation","of","the","final","model","generated","by","this","classifier",".","metrics",":","Dictionary","containing","cross-validation","and","test","metrics","data","for","the","model","."]
code: def save_classifier(self, classifier_id, model, metrics):
      """
      Update a classifier with metrics and model information and mark it as
      "complete"
  
      classifier_id: ID of the classifier to save
  
      model: Model object containing a serializable representation of the
          final model generated by this classifier.
  
      metrics: Dictionary containing cross-validation and test metrics data
          for the model.
      """
      # whether to save model and metrics data to the filesystem
      if self.save_files:
          # keep a database session open so that the utility functions can
          # access the linked hyperpartitions and dataruns
          with DBSession(self.db):
              classifier = self.db.get_classifier(classifier_id)
              model_path = save_model(
                  classifier, self.models_dir, model
              )
              metric_path = save_metrics(
                  classifier, self.metrics_dir, metrics
              )
  
          # if necessary, save model and metrics to Amazon S3 bucket
          if self.cloud_mode:
              try:
                  model_path, metric_path = self.save_classifier_cloud(
                      model_path, metric_path
                  )
  
              except Exception:
                  msg = traceback.format_exc()
                  LOGGER.error("Error in save_classifier_cloud()")
                  self.db.mark_classifier_errored(
                      classifier_id, error_message=msg
                  )
      else:
          model_path = None
          metric_path = None
  
      # update the classifier in the database
      self.db.complete_classifier(
          classifier_id=classifier_id,
          model_location=model_path,
          metrics_location=metric_path,
          cv_score=model.cv_judgment_metric,
          cv_stdev=model.cv_judgment_metric_stdev,
          test_score=model.test_judgment_metric,
      )
  
      # update this session's hyperpartition entry
      LOGGER.info("Saved classifier %d." % classifier_id)
  
imports: from __future__ import absolute_import, unicode_literals
  import datetime
  import imp
  import logging
  import os
  import re
  import socket
  import traceback
  import warnings
  from builtins import object, str
  from collections import defaultdict
  import boto3
  import numpy
  from atm.classifier import Model
  from atm.constants import CUSTOM_CLASS_REGEX, SELECTORS, TUNERS
  from atm.database import ClassifierStatus, DBSession
  from atm.utilities import ensure_directory, get_instance, save_metrics, save_model, update_params
label_desc: Use image node_id 7 for calling the Worker obj's underlying member method code with example usage: obj.save_classifier(classifier_id, model, metrics) without return types