title: keras.metrics has no attribute 'Metric'
body: <p>I try to use Keras Tuner for hyperparameter optimisation:</p>
  
  <pre><code>import keras
  from kerastuner import HyperModel
  from kerastuner.tuners import Hyperband
  
  input_shape = (1, 28, 28)
  num_classes = 10
  
  # Define hypermodel class
  class CNNHyperModel(HyperModel):
      def __init__(self, input_shape, num_classes):
          self.input_shape = input_shape
          self.num_classes = num_classes
  
      def build(self, hp):
          model = Sequential()
          model.add(Conv2D(32, kernel_size=(3, 3), activation="relu", input_shape=input_shape))
          model.add(Conv2D(64, (3, 3), activation="relu"))
          model.add(MaxPooling2D(pool_size=(2, 2)))
          model.add(Dropout(0.25))
          model.add(Flatten())
          model.add(Dense(128, activation="relu"))
          model.add(Dropout(0.5))
          model.add(Dense(num_classes, activation="softmax"))
  
          model.compile(
              loss=keras.losses.categorical_crossentropy,
              optimizer=keras.optimizers.Adadelta(),
              metrics=["accuracy"],
          )
  
          return model
  
  # Instantiate
  hypermodel = CNNHyperModel(input_shape=input_shape, num_classes=num_classes)
  
  # Create tuner
  HYPERBAND_MAX_EPOCHS = 40
  MAX_TRIALS = 20
  EXECUTION_PER_TRIAL = 2
  SEED = 1
  
  tuner = RandomSearch(
      hypermodel,
      max_epochs=HYPERBAND_MAX_EPOCHS,
      objective='val_accuracy',
      seed=SEED,
      max_trials=MAX_TRIALS,
      executions_per_trial=EXECUTION_PER_TRIAL,
      directory='hyperband',
      project_name='mnist'
  )
  </code></pre>
  
  <p>I get </p>
  
  <blockquote>
    <p>AttributeError: module 'tensorflow._api.v1.keras.metrics' has no attribute 'Metric'</p>
  </blockquote>
  
  <p>with both Tensorflow 1.13 and 2.0 installed using conda.</p>
  
  <p>Including <code>from tensorflow.python.keras.metrics import Metric</code> as suggested in <a href="https://stackoverflow.com/questions/56688744/unable-to-import-metric-from-tensorflow-keras-metrics">this answer</a> does not change anything.</p>