DylMath module¶
-
DylMath.
MSE
(sep: float, dist: str, ROC: list, rocEmpiric: list = None) → Tuple[float, float, float][source]¶ Returns the MSE of the given ROC.
If sep and dist are not None: the true ROC from sep and dist If rocEmpiric is not None: the MSE between the Empiric and ROC If sep and dist are None, the first value returned is always 0 The last value returned is always the AUC of the ROC
-
DylMath.
auc
(results: tuple, D0: list = None, D1: list = None) → float[source]¶ Takes an ROC curve from genROC and returns the AUC.
If results is a prediction not an ROC curve, generates the ROC curve. If results is already an ROC curve, D0 and D1 are not required.
-
DylMath.
avROC
(rocs: list) → tuple[source]¶ Averages ROC curves. Rocs parameter are ROC curves from genROC.
-
DylMath.
calcNLayers
(arr: list) → int[source]¶ Returns the number of layers that would be needed to sort.
If arr is the a tuple or list, uses the length. If arr is already the length, uses that.
-
DylMath.
genD0D1
(d0d1: list, arr: list) → tuple[source]¶ Generates filtered D0 and D1 vectors.
d0d1 is (D0, D1) together as a tuple/list.
-
DylMath.
genROC
(predicted: tuple, D1: list = None, D0: list = None) → list[source]¶ Returns a list of collections of x,y coordinates in order of the threshold.
-
DylMath.
genSep
(dist: str, auc: float) → float[source]¶ Returns the sep parameter needed for the target AUC for the given distribution.
-
DylMath.
genX0X1
(predicted: tuple, D1: tuple = None, D0: tuple = None) → Tuple[list, list][source]¶ Generates x0 and x1 vectors out of the given parameters.
D1 and D0 should never be smaller than the predicted array, but are often bigger.
-
DylMath.
graphROC
(predicted: tuple, D0: list = None, D1: list = None)[source]¶ Generates and graphs a single ROC curve and displays the results.
-
DylMath.
graphROCs
(arrays: list, withPatches: bool = False, withLine: bool = True, D0: list = None, D1: list = None)[source]¶ Graphs a collection of array predictions. Takes the arrays as they would come out of DylSort sorts.
If withPatches, puts a color coded success matrix behind the line. If withLine, graphs the line. Returns the plt handle, does not display the results.
-
DylMath.
hanleyMcNeil
(auc: float, n0: int, n1: int) → float[source]¶ The very good power-law variance estimate from Hanley/McNeil.
-
DylMath.
paramToParams
(predicted: list, D0: list = None, D1: list = None) → Tuple[list, list, list][source]¶ Takes one parameter and splits it into three if predicted is a 2d list.