def test_new_build_predict(make_model, build_model, fixed_results): """test predict comparing results""" make_status, message = make_model assert (make_status is True) or (message == 'This endpoint already exists') build_status, _ = build_model assert build_status is True predictor = predict.Predict(MODEL_NAME, 0) _, results_str = predictor.run(SDF_FILE_NAME) prediction_results_dict = json.load(io.StringIO(results_str)) result_values = np.array(prediction_results_dict['values']) assert all(np.isclose(fixed_results, result_values, rtol=1e-4))
def test_regression_conformal(make_model, build_model, fixed_results): """test predict comparing results""" make_status, message = make_model assert (make_status is True) or (message == f"Endpoint {MODEL_NAME} already exists") build_status, _ = build_model assert build_status is True predictor = predict.Predict(MODEL_NAME, 0, label='temp') predictor.param.setVal("output_format", "JSON") _, results_str = predictor.run(SDF_FILE_NAME) prediction_results_dict = json.load(io.StringIO(results_str)) result_values = np.array(prediction_results_dict["values"]) assert all(np.isclose(fixed_results, result_values, rtol=1e-4))
def test_regression_conformal(make_model, build_model, fixed_results): """test predict comparing results""" make_status, message = make_model assert (make_status is True) or (message == f"Endpoint {MODEL_NAME} already exists") build_status, _ = build_model assert build_status is True predictor = predict.Predict(MODEL_NAME, 0, label='temp') predictor.param.setVal("output_format", "ghost") _, results = predictor.run(SDF_FILE_NAME) result_values = results.getVal("values") assert all(np.isclose(fixed_results, result_values, rtol=1e-4))