The bast place to start for modern examples is tensorflow.org/tutorials 3 and tensorflow.org/guide 1, we work to keep those examples tested and up to date with best-practices.
That example runs fine in Colab, what error are you getting?


compat.v1
tf.estimator


If you’re learning, or writing new code: don’t use these.
If you need tree models see: TensorFlow Decision Forests 2, which implements them in Keras.