ct_segnet/train_utils.py
def ROC(thresh, y_true = None, y_pred = None):
    """Receiver Operating Characteristics (ROC) curve
    """
    y_p = np.zeros_like(y_pred)
    y_p[y_pred > thresh] = 1
    y_true = np.copy(y_true)

    TN = np.sum((1-y_true)*(1-y_p)).astype(np.float32)
    
    FP = np.sum((1-y_true)*y_p).astype(np.float32)
    
    TNR = TN / (TN + FP)
    FPR = 1 - TNR
    
    TP = np.sum(y_true*y_p).astype(np.float32)
    
    FN = np.sum(y_true*(1-y_p)).astype(np.float32)
    
    TPR = TP / (TP +  FN)
    
    return (FPR, TPR)
Receiver Operating Characteristics (ROC) curve
    
Receiver Operating Characteristics (ROC) curve
Receiver Operating Characteristics ( ROC ) curve
def ROC(thresh, y_true = None, y_pred = None):
    y_p = np.zeros_like(y_pred)
    y_p[y_pred > thresh] = 1
    y_true = np.copy(y_true)
    TN = np.sum((1-y_true)*(1-y_p)).astype(np.float32)
    FP = np.sum((1-y_true)*y_p).astype(np.float32)
    TNR = TN / (TN + FP)
    FPR = 1 - TNR
    TP = np.sum(y_true*y_p).astype(np.float32)
    FN = np.sum(y_true*(1-y_p)).astype(np.float32)
    TPR = TP / (TP +  FN)
    return (FPR, TPR)
def ROC ( thresh , y_true = None , y_pred = None ) : y_p = np . zeros_like ( y_pred ) y_p [ y_pred > thresh ] = 1 y_true = np . copy ( y_true ) TN = np . sum ( ( 1 - y_true ) * ( 1 - y_p ) ) . astype ( np . float32 ) FP = np . sum ( ( 1 - y_true ) * y_p ) . astype ( np . float32 ) TNR = TN / ( TN + FP ) FPR = 1 - TNR TP = np . sum ( y_true * y_p ) . astype ( np . float32 ) FN = np . sum ( y_true * ( 1 - y_p ) ) . astype ( np . float32 ) TPR = TP / ( TP + FN ) return ( FPR , TPR )
Receiver Operating Characteristics (ROC) curve
Receiver Operating Characteristics ( ROC ) curve
"""Receiver Operating Characteristics (ROC) curve
    """
thresh
y_true
y_pred