Summary Args: raw_arr (TYPE): Description Returns: TYPE: Description
(raw_arr)
| 208 | return tf.maximum(0.0, _x) + _alpha * tf.minimum(0.0, _x) |
| 209 | |
| 210 | def calc_auc(raw_arr): |
| 211 | """Summary |
| 212 | |
| 213 | Args: |
| 214 | raw_arr (TYPE): Description |
| 215 | |
| 216 | Returns: |
| 217 | TYPE: Description |
| 218 | """ |
| 219 | |
| 220 | arr = sorted(raw_arr, key=lambda d:d[0], reverse=True) |
| 221 | pos, neg = 0., 0. |
| 222 | for record in arr: |
| 223 | if record[1] == 1.: |
| 224 | pos += 1 |
| 225 | else: |
| 226 | neg += 1 |
| 227 | |
| 228 | fp, tp = 0., 0. |
| 229 | xy_arr = [] |
| 230 | for record in arr: |
| 231 | if record[1] == 1.: |
| 232 | tp += 1 |
| 233 | else: |
| 234 | fp += 1 |
| 235 | xy_arr.append([fp/neg, tp/pos]) |
| 236 | |
| 237 | auc = 0. |
| 238 | prev_x = 0. |
| 239 | prev_y = 0. |
| 240 | for x, y in xy_arr: |
| 241 | if x != prev_x: |
| 242 | auc += ((x - prev_x) * (y + prev_y) / 2.) |
| 243 | prev_x = x |
| 244 | prev_y = y |
| 245 | |
| 246 | return auc |
| 247 | |
| 248 | def calc_gauc(raw_arr, nick_index): |
| 249 | """Summary |