@@ -1393,7 +1393,7 @@ def check_for_data(
1393
1393
def stat_dataset_to_dataframe (
1394
1394
data : Union [DataFrame , List [list ], Type ["numpy.array" ]],
1395
1395
target_value : Union [str , int , float ] = None ,
1396
- target_type : str = ' classification'
1396
+ target_type : str = " classification" ,
1397
1397
) -> DataFrame :
1398
1398
"""
1399
1399
Convert the user supplied statistical dataset from either a pandas DataFrame,
@@ -1441,14 +1441,14 @@ def stat_dataset_to_dataframe(
1441
1441
if isinstance (data , pd .DataFrame ):
1442
1442
if len (data .columns ) == 2 :
1443
1443
data .columns = ["actual" , "predict" ]
1444
- if target_type == ' classification' :
1444
+ if target_type == " classification" :
1445
1445
data ["predict_proba" ] = data ["predict" ].gt (target_value ).astype (int )
1446
1446
elif len (data .columns ) == 3 :
1447
1447
data .columns = ["actual" , "predict" , "predict_proba" ]
1448
1448
elif isinstance (data , list ):
1449
1449
if len (data ) == 2 :
1450
1450
data = pd .DataFrame ({"actual" : data [0 ], "predict" : data [1 ]})
1451
- if target_type == ' classification' :
1451
+ if target_type == " classification" :
1452
1452
data ["predict_proba" ] = data ["predict" ].gt (target_value ).astype (int )
1453
1453
elif len (data ) == 3 :
1454
1454
data = pd .DataFrame (
@@ -1461,7 +1461,7 @@ def stat_dataset_to_dataframe(
1461
1461
elif isinstance (data , np .ndarray ):
1462
1462
if len (data ) == 2 :
1463
1463
data = pd .DataFrame ({"actual" : data [0 , :], "predict" : data [1 , :]})
1464
- if target_type == ' classification' :
1464
+ if target_type == " classification" :
1465
1465
data ["predict_proba" ] = data ["predict" ].gt (target_value ).astype (int )
1466
1466
elif len (data ) == 3 :
1467
1467
data = pd .DataFrame (
@@ -2372,7 +2372,7 @@ def generate_model_card(
2372
2372
)
2373
2373
2374
2374
# Generates dmcas_misc.json file
2375
- if target_type == ' classification' :
2375
+ if target_type == " classification" :
2376
2376
cls .generate_misc (model_files )
2377
2377
2378
2378
@staticmethod
@@ -2782,7 +2782,11 @@ def generate_misc(cls, model_files: Union[str, Path, dict]):
2782
2782
roc_data ["_FN_" ],
2783
2783
]
2784
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
2785
+ correct_text ,
2786
+ correctness_values ,
2787
+ outcome_values ,
2788
+ target_texts ,
2789
+ target_values ,
2786
2790
):
2787
2791
misc_data .append (
2788
2792
{
@@ -2794,7 +2798,7 @@ def generate_misc(cls, model_files: Union[str, Path, dict]):
2794
2798
"_cutoffSource_" : "Default" ,
2795
2799
"_cutoff_" : "0.5" ,
2796
2800
"TargetText" : t_txt ,
2797
- "Target" : t_val
2801
+ "Target" : t_val ,
2798
2802
},
2799
2803
"rowNumber" : len (misc_data ) + 1 ,
2800
2804
}
0 commit comments