@@ -875,7 +875,7 @@ def calculate_model_statistics(
875
875
json_dict [1 ]["data" ][j ].update (roc_dict [j ])
876
876
877
877
lift_df = pd .DataFrame (conn .CASTable ("Lift" , caslib = "Public" ).to_frame ())
878
- lift_dict = cls .apply_dataframe_to_json (json_dict [2 ]["data" ], i , lift_df )
878
+ lift_dict = cls .apply_dataframe_to_json (json_dict [2 ]["data" ], i , lift_df , 1 )
879
879
for j in range (len (lift_dict )):
880
880
json_dict [2 ]["data" ][j ].update (lift_dict [j ])
881
881
@@ -1019,7 +1019,7 @@ def stat_dataset_to_dataframe(
1019
1019
1020
1020
@staticmethod
1021
1021
def apply_dataframe_to_json (
1022
- json_dict : dict , partition : int , stat_df : DataFrame
1022
+ json_dict : dict , partition : int , stat_df : DataFrame , is_lift : bool = False
1023
1023
) -> dict :
1024
1024
"""
1025
1025
Map the values of the ROC or Lift charts from SAS CAS to the dictionary
@@ -1033,6 +1033,9 @@ def apply_dataframe_to_json(
1033
1033
Numerical representation of the data partition. Either 0, 1, or 2.
1034
1034
stat_df : pandas.DataFrame
1035
1035
ROC or Lift DataFrame generated from the SAS CAS percentile action set.
1036
+ is_lift : bool
1037
+ Specify whether to use logic for Lift or ROC row counting. Default value is
1038
+ False.
1036
1039
1037
1040
Returns
1038
1041
-------
@@ -1042,7 +1045,10 @@ def apply_dataframe_to_json(
1042
1045
"""
1043
1046
for row_num in range (len (stat_df )):
1044
1047
row_dict = stat_df .iloc [row_num ].replace (float ("nan" ), None ).to_dict ()
1045
- json_dict [row_num + partition * len (stat_df )]["dataMap" ].update (row_dict )
1048
+ if is_lift :
1049
+ json_dict [(row_num + partition + 1 ) + partition * len (stat_df )]["dataMap" ].update (row_dict )
1050
+ else :
1051
+ json_dict [row_num + (partition * len (stat_df ))]["dataMap" ].update (row_dict )
1046
1052
return json_dict
1047
1053
1048
1054
# noinspection PyCallingNonCallable, PyNestedDecorators
0 commit comments