code: def build_model(hp):
      model_type = hp.Choice(
          "model_type", ["random_forest", "ridge", "knn"]
      )
      if model_type == "random_forest":
          with hp.conditional_scope("model_type", "random_forest"):
              model = ensemble.RandomForestClassifier(
                  n_estimators=hp.Int("n_estimators", 10, 50, step=10),
                  max_depth=hp.Int("max_depth", 3, 10),
              )
      elif model_type == "ridge":
          with hp.conditional_scope("model_type", "ridge"):
              model = linear_model.RidgeClassifier(
                  alpha=hp.Float("alpha", 1e-3, 1, sampling="log")
              )
      elif model_type == "knn":
          with hp.conditional_scope("model_type", "knn"):
              k = hp.Int("n_neighbors", 1, 30, default=5)
              model = neighbors.KNeighborsClassifier(
                  n_neighbors=k,
                  weights=hp.Choice(
                      "weights",
                      ["uniform", "distance"],
                      default="uniform",
                  ),
              )
      else:
          raise ValueError("Unrecognized model_type")
      return model
  
imports: import numpy
  import pandas
  import pytest
  from sklearn import datasets
  from sklearn import decomposition
  from sklearn import ensemble
  from sklearn import linear_model
  from sklearn import metrics
  from sklearn import model_selection
  from sklearn import neighbors
  from sklearn import pipeline
  import keras_tuner
label_desc: Use image node_id 1 for calling a global function with example usage: build_model(hp) and returns: model