Created
February 21, 2021 19:14
-
-
Save eugeneyan/f8ad1776abc2d212ee8f4f8c0b53ef88 to your computer and use it in GitHub Desktop.
Test train time and latency
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_training_time(dummy_titanic): | |
X_train, y_train, X_test, y_test = dummy_titanic | |
# Standardize to use depth = 10 | |
dt = DecisionTree(depth_limit=10) | |
latency_array = np.array([train_with_time(dt, X_train, y_train)[1] for i in range(100)]) | |
time_p95 = np.quantile(latency_array, 0.95) | |
assert time_p95 < 1.0, 'Training time at 95th percentile should be < 1.0 sec' | |
def test_dt_serving_latency(dummy_titanic): | |
X_train, y_train, X_test, y_test = dummy_titanic | |
# Standardize to use depth = 10 | |
dt = DecisionTree(depth_limit=10) | |
dt.fit(X_train, y_train) | |
latency_array = np.array([predict_with_time(dt, X_test)[1] for i in range(500)]) | |
latency_p99 = np.quantile(latency_array, 0.99) | |
assert latency_p99 < 0.004, 'Serving latency at 99th percentile should be < 0.004 sec' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment