class_docstr: Suggests an architecture based on the Harmonica algorithm.
docstr: Translates the trial architecture to a {-1, 1} assignment.
docstr_tok: ["Translates","the","trial","architecture","to","a","{","-1",",","1","}","assignment","."]
code: def translate_architecture_to_feature_assignment(self, architecture):
      """Translates the trial architecture to a {-1, 1} assignment."""
      x = np.empty(self._num_params)
      x.fill(-1)
      depth = 0
      for block in architecture:
          # These are connector blocks (non-trainable) that connect CNN and DNN.
          # They should not be a part of out search problem.
          if (
              block == block_builder.BlockType.FLATTEN
              or block == block_builder.BlockType.DOWNSAMPLE_FLATTEN
              or block
              == block_builder.BlockType.PLATE_REDUCTION_FLATTEN
          ):
              continue
          index = self._block_indices.index(block)
          # One-hot encoding but with -1 and 1.
          x[len(self._block_indices) * depth + index] = 1
          depth += 1
      return x
  
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 3 for calling the Harmonica obj's underlying member method code with example usage: obj.translate_architecture_to_feature_assignment(architecture) and returns: x