def METHOD_NAME(features, labels, mode, params):
    net = tf.compat.v1.feature_column.input_layer(
        features, params["feature_columns"]
    )
    for units in params["hidden_units"]:
        net = tf.compat.v1.layers.dense(
            net, units=units, activation=tf.nn.relu
        )
    logits = tf.compat.v1.layers.dense(
        net, params["n_classes"], activation=None
    )
    predicted_classes = tf.argmax(logits, 1)
    if mode == tf.estimator.ModeKeys.PREDICT:
        predictions = {
            "classes": predicted_classes[:, tf.newaxis],
            "probs": tf.nn.softmax(logits),
            "logits": logits,
        }
        export_outputs = {
            "prediction": tf.estimator.export.PredictOutput(predictions)
        }
        return tf.estimator.EstimatorSpec(
            mode, predictions=predictions, export_outputs=export_outputs
        )
    loss = tf.compat.v1.losses.sparse_softmax_cross_entropy(
        labels=labels, logits=logits
    )
    if mode == tf.estimator.ModeKeys.TRAIN:
        optimizer = tf.compat.v1.train.AdagradOptimizer(learning_rate=0.1)
        train_op = optimizer.minimize(
            loss, global_step=tf.compat.v1.train.get_global_step()
        )
        logging_hook = tf.compat.v1.train.LoggingTensorHook(
            {"loss": loss}, every_n_iter=10
        )
        return tf.estimator.EstimatorSpec(
            mode, loss=loss, train_op=train_op, training_hooks=[logging_hook]
        )
    accuracy = tf.compat.v1.metrics.accuracy(
        labels=labels, predictions=predicted_classes, name="acc"
    )
    metrics = {"accuracy": accuracy}
    if mode == tf.estimator.ModeKeys.EVAL:
        return tf.estimator.EstimatorSpec(
            mode, loss=loss, eval_metric_ops=metrics
        )