class_docstr: Suggests an architecture based on the Harmonica algorithm.
docstr: Suggests a new architecture for Phoenix using the harmonica model.
  
  For details please see:
  https://arxiv.org/pdf/1706.00764.pdf
  
  Args:
    trials: a list of metadata.trial.Trial
    hparams: The suggested hparams.
    my_trial_id: integer - the trial id which is making the call.
    model_dir: string - the model directory.
  
  Returns:
    an architecture and None - a np.array of integers and None.
docstr_tok: ["Suggests","a","new","architecture","for","Phoenix","using","the","harmonica","model",".","For","details","please","see",":","https",":","\/\/arxiv.org\/pdf\/1706.00764.pdf","Args",":","trials",":","a","list","of","metadata.trial.Trial","hparams",":","The","suggested","hparams",".","my_trial_id",":","integer","-","the","trial","id","which","is","making","the","call",".","model_dir",":","string","-","the","model","directory",".","Returns",":","an","architecture","and","None","-","a","np.array","of","integers","and","None","."]
code: def get_suggestion(
      self, trials, hparams, my_trial_id=None, model_dir=None
  ):
      """Suggests a new architecture for Phoenix using the harmonica model.
  
      For details please see:
      https://arxiv.org/pdf/1706.00764.pdf
  
      Args:
        trials: a list of metadata.trial.Trial
        hparams: The suggested hparams.
        my_trial_id: integer - the trial id which is making the call.
        model_dir: string - the model directory.
  
      Returns:
        an architecture and None - a np.array of integers and None.
      """
      lasso_solver = linear_model.Lasso(
          fit_intercept=True, alpha=self._alpha
      )
  
      # Getting the features/labels for the linear regression.
      x, y = self.batch_sample(trials)
  
      # Not enough data points for regression. Falling on hparams architecture.
      if len(y) < self._min_for_regression:
          initial_architecture = [
              block_builder.BlockType[block_type]
              for block_type in hparams.initial_architecture
          ]
          return (
              np.array(
                  architecture_utils.fix_architecture_order(
                      initial_architecture,
                      self._phoenix_spec.problem_type,
                  )
              ),
              None,
          )
  
      # Expanding to polynomial features
      x = self.get_polynomial_expansion(x, self._degree)
  
      logging.info("Running linear regression..")
      lasso_solver.fit(x, y)
      coef = lasso_solver.coef_
      # Sort the coefficients
      index = np.argsort(-np.abs(coef))
      # Zero out all coefficients but the largets self._n_mono
      value = coef[index[self._n_mono - 1]]
      zeroed_coeff = np.asarray(coef)
      low_values_flags = zeroed_coeff < value  # Where values are low
      zeroed_coeff[low_values_flags] = 0  # All low values set to 0
  
      return (
          self.get_good_architecture(
              self._num_random_samples, zeroed_coeff
          ),
          None,
      )
  
file_path: model_search/model_search/search/harmonica.py
imports: from absl import logging
  from model_search import block_builder
  from model_search.architecture import architecture_utils
  from model_search.search import common
  from model_search.search import search_algorithm
  import numpy
  from sklearn import linear_model
  from sklearn import preprocessing
label_desc: Use image node_id 6 for calling the Harmonica obj's underlying member method code with example usage: obj.get_suggestion(trials, hparams, my_trial_id, model_dir) and returns: self,  None, np,  None