docstr: Use the hyperpartition selection method specified by our datarun to choose a
  hyperpartition of hyperparameters from the ModelHub. Only consider
  partitions for which gridding is not complete.
docstr_tok: ["Use","the","hyperpartition","selection","method","specified","by","our","datarun","to","choose","a","hyperpartition","of","hyperparameters","from","the","ModelHub",".","Only","consider","partitions","for","which","gridding","is","not","complete","."]
code: def select_hyperpartition(self):
      """
      Use the hyperpartition selection method specified by our datarun to choose a
      hyperpartition of hyperparameters from the ModelHub. Only consider
      partitions for which gridding is not complete.
      """
      hyperpartitions = self.db.get_hyperpartitions(
          datarun_id=self.datarun.id
      )
  
      # load classifiers and build scores lists
      # make sure all hyperpartitions are present in the dict, even ones that
      # don't have any classifiers. That way the selector can choose hyperpartitions
      # that haven't been scored yet.
      hyperpartition_scores = {fs.id: [] for fs in hyperpartitions}
      classifiers = self.db.get_classifiers(datarun_id=self.datarun.id)
  
      for c in classifiers:
          # ignore hyperpartitions for which gridding is done
          if c.hyperpartition_id not in hyperpartition_scores:
              continue
  
          # the cast to float is necessary because the score is a Decimal;
          # doing Decimal-float arithmetic throws errors later on.
          score = float(getattr(c, self.datarun.score_target) or 0)
          hyperpartition_scores[c.hyperpartition_id].append(score)
  
      hyperpartition_id = self.selector.select(hyperpartition_scores)
      return self.db.get_hyperpartition(hyperpartition_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 4 for calling the Worker obj's underlying member method code with example usage: obj.select_hyperpartition() and returns: self