Validation Toolkit
check_binary_values(pred_col, label1=0, label2=1)
¶
Check that values are binary (default: 0 or 1).
Example Use Case
Predictions can only be 0 (no disease present) or 1 (disease present).
PARAMETER | DESCRIPTION |
---|---|
pred_col |
Dataframe column containing the values to validate.
TYPE:
|
label1 |
First acceptable binary value.
TYPE:
|
label2 |
Second acceptable binary value.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
An error message, if any (default is an empty string) |
Source code in cnb_tools/validation_toolkit.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
check_duplicate_keys(pred_col, verbose=False)
¶
Check for duplicate keys.
Example Use Case
There is exactly one prediction for a patient / sample / etc.
PARAMETER | DESCRIPTION |
---|---|
pred_col |
Dataframe column containing the keys to validate
TYPE:
|
verbose |
Include list of affected keys in error message
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
An error message, if any (default is an empty string) |
Source code in cnb_tools/validation_toolkit.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
check_missing_keys(gold_col, pred_col, verbose=False)
¶
Check for missing keys.
Example Use Case
There is at least one prediction for every patient / sample / etc.
PARAMETER | DESCRIPTION |
---|---|
gold_col |
Dataframe column containing the true keys
TYPE:
|
pred_col |
Dataframe column containing the keys to validate
TYPE:
|
verbose |
Include list of affected keys in error message
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
An error message, if any (default is an empty string) |
Source code in cnb_tools/validation_toolkit.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
check_nan_values(pred_col)
¶
Check for NAN values.
Example Use Case
Predictions must not be null / None.
PARAMETER | DESCRIPTION |
---|---|
pred_col |
Dataframe column containing the values to validate
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
An error message, if any (default is an empty string) |
Source code in cnb_tools/validation_toolkit.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
check_unknown_keys(gold_col, pred_col, verbose=False)
¶
Check for unknown keys.
Example Use Case
There are no predictions without a corresponding groundtruth value.
PARAMETER | DESCRIPTION |
---|---|
gold_col |
Dataframe column containing the true keys
TYPE:
|
pred_col |
Dataframe column containing the keys to validate
TYPE:
|
verbose |
Include list of affected keys in error message
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
An error message, if any (default is an empty string) |
Source code in cnb_tools/validation_toolkit.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
check_values_range(pred_col, min_val=0, max_val=1)
¶
Check that values are between min and max values, inclusive.
Example Use Case
Predictions must be a probability from 0 (disease not likely) to 1 (disease likely).
PARAMETER | DESCRIPTION |
---|---|
pred_col |
Dataframe column containing the values to validate
TYPE:
|
min_val |
Lower limit of range
TYPE:
|
max_val |
Upper limit of range
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
An error message, if any (default is an empty string) |
Source code in cnb_tools/validation_toolkit.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|