def test_model_groups_1(): data = { 'ranked_table': ranked_table_data_1, 'models': models_data_1, 'evaluations': evaluations_data } with rig_test_client(data) as test_app: route = '/evaluations/search_model_groups/all' response = test_app.post( route, data=dict( metric1='precision', parameter1='top 100', timestamp=CUTOFF ) ) assert response.status_code == 200 response_data = json.loads(response.get_data().decode('utf-8')) expected = load_json_example(route) assert expected == response_data route = '/evaluations/search_model_groups/{}'.format('two feature block') response = test_app.post( route, data=dict( metric1='precision', parameter1='top 100', timestamp=CUTOFF ) ) assert response.status_code == 200 response_data = json.loads(response.get_data().decode('utf-8')) expected = load_json_example(route) assert expected == response_data
def test_response_dist(): with rig_test_client(data) as test_app: url = '/evaluations/1/response_dist/{}'.format(EVALUATION_START_TIME) response = test_app.get(url) assert response.status_code == 200 response_data = json.loads(response.get_data().decode('utf-8')) expected = load_json_example('/evaluations/1/response_dist') assert expected == response_data
def test_get_feature_dist_train(): with rig_test_client(data) as test_app: url = '/evaluations/1/feature_dist_train/arrests_id_p1d_arrestscrimetype_assault_avg' response = test_app.get(url) response_data = json.loads(response.get_data().decode('utf-8')) expected = load_json_example('/evaluations/1/feature_dist_train') assert response.status_code == 200 assert expected == response_data
def test_feature_importance(): with rig_test_client(data) as test_app: url = '/evaluations/1/feature_importance/10' response = test_app.get(url) assert response.status_code == 200 response_data = json.loads(response.get_data().decode('utf-8')) expected = load_json_example('/evaluations/1/feature_importance') assert expected == response_data
def test_precision_recall_threshold(): with rig_test_client(data) as test_app: url = '/evaluations/1/threshold_precision_recall/2015-01-01' response = test_app.get(url) assert response.status_code == 200 response_data = json.loads(response.get_data().decode('utf-8')) print(response_data) expected = load_json_example('/evaluations/1/precision_recall_result') assert expected == response_data
def test_individual_importances(): with rig_test_client(data) as test_app: url = '/evaluations/1/individual_feature_importance/1234/2014-12-01' response = test_app.get(url) assert response.status_code == 200 response_data = json.loads(response.get_data().decode('utf-8')) print(response_data) expected = load_json_example('/evaluations/1/individual_importance') assert expected == response_data
def test_search_models_over_time(): with rig_test_client(data) as test_app: route = '/evaluations/search_models_over_time' response = test_app.post(route, data=dict(metric1='recall', parameter1='top 5.0%', timestamp=CUTOFF)) assert response.status_code == 200 response_data = json.loads(response.get_data().decode('utf-8')) expected = load_json_example(route) assert expected == response_data
def test_model_comments(): with rig_test_client(data) as test_app: route = '/evaluations/model_comments' response = test_app.post(route, data=dict(metric1='precision', parameter1='top 100', timestamp=CUTOFF)) assert response.status_code == 200 response_data = json.loads(response.get_data().decode('utf-8')) expected = load_json_example(route) assert expected == response_data
def test_metric_overtime(): with rig_test_client(data) as test_app: route = '/evaluations/1/metric_overtime' response = test_app.post( route, data=dict( metric1='precision', parameter1='top 100', ) ) assert response.status_code == 200 response_data = json.loads(response.get_data().decode('utf-8')) expected = load_json_example(route) print(expected) print(response_data) assert expected == response_data