docstr: Define model for iris classification.
  
  This is a simple model with one hidden layer to predict iris species (setosa, versicolor, or
  virginica) based on four input features (length and width of sepals and petals).
docstr_tok: ["Define","model","for","iris","classification",".","This","is","a","simple","model","with","one","hidden","layer","to","predict","iris","species","(","setosa",",","versicolor",",","or","virginica",")","based","on","four","input","features","(","length","and","width","of","sepals","and","petals",")","."]
code: def build_model(self) -> Model:
      """
      Define model for iris classification.
  
      This is a simple model with one hidden layer to predict iris species (setosa, versicolor, or
      virginica) based on four input features (length and width of sepals and petals).
      """
      inputs = Input(shape=(4,))
      dense1 = Dense(self.context.get_hparam("layer1_dense_size"))(
          inputs
      )
      dense2 = Dense(NUM_CLASSES, activation="softmax")(dense1)
  
      # Wrap the model.
      model = self.context.wrap_model(
          Model(inputs=inputs, outputs=dense2)
      )
  
      # Create and wrap the optimizer.
      optimizer = RMSprop(
          lr=self.context.get_hparam("learning_rate"),
          decay=self.context.get_hparam("learning_rate_decay"),
      )
      optimizer = self.context.wrap_optimizer(optimizer)
  
      model.compile(
          optimizer,
          categorical_crossentropy,
          [categorical_accuracy],
      )
  
      return model
  
file_path: determined/examples/computer_vision/iris_tf_keras/model_def.py
imports: from typing import List
  import pandas
  import tensorflow
  from tensorflow.keras.layers import Dense, Input
  from tensorflow.keras.losses import categorical_crossentropy
  from tensorflow.keras.metrics import categorical_accuracy
  from tensorflow.keras.models import Model
  from tensorflow.keras.optimizers.legacy import RMSprop
  from tensorflow.keras.utils import to_categorical
  from determined import keras
label_desc: Use image node_id 2 for calling the IrisTrial obj's underlying member method code with example usage: obj.build_model() and returns: model