From 2c5132735295bc26144089a1dcb6f303cccd90f1 Mon Sep 17 00:00:00 2001 From: o9o9 Date: Fri, 13 Oct 2017 22:41:57 +0900 Subject: [PATCH] Update PredictTipSingleModeRxPy.sql Fixed to API specification change of RevoScalePy due to version upgrade from SQL Server 2017 CTP to SQL Server 2017 RC This file is used by In-database Python Analytics tutorial(https://docs.microsoft.com/en-us/sql/advanced-analytics/tutorials/sqldev-in-database-python-for-sql-developers). --- Misc/PythonSQL/PredictTipSingleModeRxPy.sql | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Misc/PythonSQL/PredictTipSingleModeRxPy.sql b/Misc/PythonSQL/PredictTipSingleModeRxPy.sql index 2bf5bac5..1b749da4 100644 --- a/Misc/PythonSQL/PredictTipSingleModeRxPy.sql +++ b/Misc/PythonSQL/PredictTipSingleModeRxPy.sql @@ -33,8 +33,7 @@ BEGIN @script = N' import pickle import numpy -import pandas -from revoscalepy.functions.RxPredict import rx_predict_ex +from revoscalepy.functions.RxPredict import rx_predict # Load model and unserialize mod = pickle.loads(model) @@ -44,9 +43,9 @@ x = InputDataSet[["passenger_count", "trip_distance", "trip_time_in_secs", "dire # Score data to get tip prediction probability as a list (of float) -prob_array = rx_predict_ex(mod, x) +prob_array = rx_predict(mod, x) -prob_list = [prob_array._results["tipped_Pred"]] +prob_list = prob_array["tipped_Pred"].values # Create output data frame OutputDataSet = pandas.DataFrame(data=prob_list, columns=["predictions"])