File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -542,12 +542,14 @@ def calculateFitStat(
542542 GINI = (2 * auc ) - 1
543543 fitStats ["_GINI_" ] = GINI
544544
545- from scipy .stats import (
546- gamma ,
547- ) # Holdover until fitstat generation via SWAT is sussed out
548-
549- _ , _ , scale = gamma .fit (dataSets [j ][1 ])
550- fitStats ["_GAMMA_" ] = 1 / scale
545+ try :
546+ from scipy .stats import gamma
547+ _ , _ , scale = gamma .fit (dataSets [j ][1 ])
548+ fitStats ["_GAMMA_" ] = 1 / scale
549+ except ImportError :
550+ warnings .warn ("scipy was not installed, so the gamma calculation could"
551+ "not be computed." )
552+ fitStats ["_GAMMA_" ] = None
551553
552554 intPredict = [round (x ) for x in dataSets [j ][1 ]]
553555 MCE = 1 - metrics .accuracy_score (dataSets [j ][0 ], intPredict )
@@ -559,7 +561,7 @@ def calculateFitStat(
559561 MCLL = metrics .log_loss (dataSets [j ][0 ], dataSets [j ][1 ])
560562 fitStats ["_MCLL_" ] = MCLL
561563
562- KS = max (math . fabs (fpr - tpr ))
564+ KS = max (abs (fpr - tpr ))
563565 fitStats ["_KS_" ] = KS
564566
565567 KSPostCutoff = None
You can’t perform that action at this time.
0 commit comments