@@ -965,6 +965,7 @@ def format_max_differences(
965
965
maxdiff_df = maxdiff_df .rename (
966
966
columns = {"Value" : "maxdiff" , "Base" : "BASE" , "Compare" : "COMPARE" }
967
967
)
968
+ maxdiff_df ["maxdiff" ] = maxdiff_df ["maxdiff" ].apply (str )
968
969
969
970
maxdiff_df ["VLABEL" ] = ""
970
971
maxdiff_df ["_DATAROLE_" ] = datarole
@@ -2257,6 +2258,7 @@ def generate_model_card(
2257
2258
interval_vars : Optional [list ] = [],
2258
2259
class_vars : Optional [list ] = [],
2259
2260
selection_statistic : str = None ,
2261
+ training_table_name : str = None ,
2260
2262
server : str = "cas-shared-default" ,
2261
2263
caslib : str = "Public" ,
2262
2264
):
@@ -2336,7 +2338,7 @@ def generate_model_card(
2336
2338
2337
2339
# Upload training table to CAS. The location of the training table is returned.
2338
2340
training_table = cls .upload_training_data (
2339
- conn , model_prefix , train_data , server , caslib
2341
+ conn , model_prefix , train_data , training_table_name , server , caslib
2340
2342
)
2341
2343
2342
2344
# Generates the event percentage for Classification targets, and the event average
@@ -2378,6 +2380,7 @@ def upload_training_data(
2378
2380
conn ,
2379
2381
model_prefix : str ,
2380
2382
train_data : pd .DataFrame ,
2383
+ train_data_name : str ,
2381
2384
server : str = "cas-shared-default" ,
2382
2385
caslib : str = "Public" ,
2383
2386
):
@@ -2404,15 +2407,18 @@ def upload_training_data(
2404
2407
Returns a string that represents the location of the training table within CAS.
2405
2408
"""
2406
2409
# Upload raw training data to caslib so that data can be analyzed
2407
- train_data_name = model_prefix + "_train_data"
2410
+ if not train_data_name :
2411
+ train_data_name = model_prefix + "_train_data"
2408
2412
upload_train_data = conn .upload (
2409
2413
train_data , casout = {"name" : train_data_name , "caslib" : caslib }, promote = True
2410
2414
)
2411
2415
2412
2416
if upload_train_data .status is not None :
2413
- raise RuntimeError (
2414
- f"A table with the name { train_data_name } already exists in the specified caslib. Please "
2415
- "either delete/rename the old table or give a new name to the current table."
2417
+ # raise RuntimeError(
2418
+ warnings .warn (
2419
+ f"A table with the name { train_data_name } already exists in the specified caslib. If this "
2420
+ f"is not intentional, please either rename the training data file or remove the duplicate from "
2421
+ f"the caslib."
2416
2422
)
2417
2423
2418
2424
return server + "/" + caslib + "/" + train_data_name .upper ()
@@ -2762,6 +2768,9 @@ def generate_misc(cls, model_files: Union[str, Path, dict]):
2762
2768
roc_table = json .load (roc_file )
2763
2769
correct_text = ["CORRECT" , "INCORRECT" , "CORRECT" , "INCORRECT" ]
2764
2770
outcome_values = ["1" , "0" , "0" , "1" ]
2771
+ target_texts = ["Event" , "Event" , "NEvent" , "NEvent" ]
2772
+ target_values = ["1" , "1" , "0" , "0" ]
2773
+
2765
2774
misc_data = list ()
2766
2775
# Iterates through ROC table to get TRAIN, TEST, and VALIDATE data with a cutoff of .5
2767
2776
for i in range (50 , 300 , 100 ):
@@ -2772,8 +2781,8 @@ def generate_misc(cls, model_files: Union[str, Path, dict]):
2772
2781
roc_data ["_TN_" ],
2773
2782
roc_data ["_FN_" ],
2774
2783
]
2775
- for c_text , c_val , o_val in zip (
2776
- correct_text , correctness_values , outcome_values
2784
+ for c_text , c_val , o_val , t_txt , t_val in zip (
2785
+ correct_text , correctness_values , outcome_values , target_texts , target_values
2777
2786
):
2778
2787
misc_data .append (
2779
2788
{
@@ -2784,6 +2793,8 @@ def generate_misc(cls, model_files: Union[str, Path, dict]):
2784
2793
"_DataRole_" : roc_data ["_DataRole_" ],
2785
2794
"_cutoffSource_" : "Default" ,
2786
2795
"_cutoff_" : "0.5" ,
2796
+ "TargetText" : t_txt ,
2797
+ "Target" : t_val
2787
2798
},
2788
2799
"rowNumber" : len (misc_data ) + 1 ,
2789
2800
}
0 commit comments