Skip to content

Instantly share code, notes, and snippets.

@eugeneyan
Created February 21, 2021 19:06
Show Gist options
  • Save eugeneyan/e949afcae1251ebdd95635ce9ebe35f8 to your computer and use it in GitHub Desktop.
Save eugeneyan/e949afcae1251ebdd95635ce9ebe35f8 to your computer and use it in GitHub Desktop.
Test output range
def test_dt_output_range(dummy_titanic):
X_train, y_train, X_test, y_test = dummy_titanic
dt = DecisionTree()
dt.fit(X_train, y_train)
pred_train = dt.predict(X_train)
pred_test = dt.predict(X_test)
assert (pred_train <= 1).all() & (pred_train >= 0).all(), 'Decision tree output should range from 0 to 1 inclusive'
assert (pred_test <= 1).all() & (pred_test >= 0).all(), 'Decision tree output should range from 0 to 1 inclusive'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment