Skip to content

Instantly share code, notes, and snippets.

@crawles
Created February 28, 2019 08:38
Show Gist options
  • Save crawles/afefe30486328553a7a464e20fb9b9ce to your computer and use it in GitHub Desktop.
Save crawles/afefe30486328553a7a464e20fb9b9ce to your computer and use it in GitHub Desktop.
TensorFlow Boosted Trees
## TL;DR:
# Train model.
est = tf.estimator.BoostedTreesClassifier(feature_columns, n_batches_per_layer)
est.train(train_input_fn)
# Per instance model interpretability:
pred_dict = est.experimental_predict_with_explanations(pred_input_fn)
# Global gain-based feature importances:
importances = est.experimental_feature_importances()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment