Created
February 21, 2021 19:06
-
-
Save eugeneyan/e949afcae1251ebdd95635ce9ebe35f8 to your computer and use it in GitHub Desktop.
Test output range
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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