class_docstr: Proposes new trials using a linear model.
  
  The model suggests an architecture no deeper than those in the trials.
  Sometimes (by a coin flip) adds one layer of depth to the suggestion.
class_docstr_tok: ["Proposes","new","trials","using","a","linear","model",".","The","model","suggests","an","architecture","no","deeper","than","those","in","the","trials",".","Sometimes","(","by","a","coin","flip",")","adds","one","layer","of","depth","to","the","suggestion","."]
docstr: See base class SearchAlgorithm.
docstr_tok: ["See","base","class","SearchAlgorithm","."]
code: def get_suggestion(
      self, trials, hparams, my_trial_id=None, model_dir=None
  ):
      """See base class SearchAlgorithm."""
  
      architectures, losses = self._load_trials(trials)
  
      # No feasible trials yet.
      if (
          len(architectures)
          < self._phoenix_spec.linear_model.trials_before_fit
      ):
          return (
              common.encode_architecture(
                  hparams.initial_architecture,
                  self._phoenix_spec.problem_type,
              ),
              None,
          )
      _, suggestion = self._suggest_by_padding(architectures, losses)
  
      # Decide whether to allow growth.
      # TODO(b/172564129): refactor common behavior with other search algorithms.
      allowed_depth = common.get_allowed_depth(
          len(architectures),
          depth_thresholds=self._phoenix_spec.increase_complexity_minimum_trials,
          max_depth=self._phoenix_spec.maximum_depth,
      )
      explore_mode = common.random(
          self._phoenix_spec.increase_complexity_probability
      )
  
      new_block = block_builder.BlockType[hparams.new_block_type]
  
      if suggestion.size <= allowed_depth and explore_mode:
          # increase_structure_depth expects that the architecture contains a
          # flatten block, which may not be true for the linear model's output.
          suggestion = np.array(
              architecture_utils.fix_architecture_order(
                  suggestion, self._phoenix_spec.problem_type
              )
          )
          suggestion = architecture_utils.increase_structure_depth(
              suggestion, new_block, self._phoenix_spec.problem_type
          )
      elif _contains_row(architectures, suggestion):
          # The linear model suggested an architecture we've already tried
          # in a previous trial, so we mutate it.
          # TODO(b/172564129): more intelligent _contains_row check: should handle
          # when mutate_replace output has been tried, but not just a while loop,
          # since that could run forver if # of untried architectures is small.
          suggestion = common.mutate_replace(suggestion, new_block)
      else:
          # The linear model suggested a novel architecture; use it.
          pass
  
      suggestion = [block_builder.BlockType(b) for b in suggestion]
      return (
          np.array(
              architecture_utils.fix_architecture_order(
                  suggestion, self._phoenix_spec.problem_type
              )
          ),
          None,
      )
  
file_path: model_search/model_search/search/linear_model.py
imports: from model_search import block_builder
  from model_search.architecture import architecture_utils
  from model_search.proto import phoenix_spec_pb2
  from model_search.search import common
  from model_search.search import search_algorithm
  import numpy
  import sklearn
  import sklearn.linear_model
label_desc: Use image node_id 6 for calling the LinearModel obj's underlying member method code with example usage: obj.get_suggestion(trials, hparams, my_trial_id, model_dir) and returns: np,  None, common,  None