candle.uq_keras_utils.add_model_output

candle.uq_keras_utils.add_model_output#

candle.uq_keras_utils.add_model_output(modelIn, mode=None, num_add=None, activation=None)#

This function modifies the last dense layer in the passed Keras model. The modification includes adding units and optionally changing the activation function.

Parameters:
  • modelIn – Keras model. Keras model to be modified.

  • mode (string) –

    Mode to modify the layer. It could be:

    • ’abstain’ for adding an arbitrary number of units for the abstention optimization strategy.

    • ’qtl’ for quantile regression which needs the outputs to be tripled.

    • ’het’ for heteroscedastic regression which needs the outputs to be doubled.

  • num_add (int) – Number of units to add. This only applies to the ‘abstain’ mode.

  • activation (string) – String with Keras specification of activation function (e.g. ‘relu’, ‘sigomid’, ‘softmax’, etc.)

Returns:

Keras model after last dense layer has been modified as specified. If there is no mode specified it returns the same model. If the mode is not one of ‘abstain’, ‘qtl’ or ‘het’ an exception is raised.

Return type:

Keras model