Coder Social home page Coder Social logo

evaluation-2023's People

Contributors

matthewreyna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

evaluation-2023's Issues

Some possible errors in evaluate_model.py

Should the following block

# Compute the FPRs.
fpr = np.zeros(num_thresholds)
for l in range(num_thresholds):
if tp[l] + fn[l] > 0:
fpr[l] = float(fp[l]) / float(tp[l] + fn[l])
else:
fpr[l] = float('nan')
# Find the threshold such that FPR <= 0.05.
max_fpr = 0.05
if np.any(fpr <= max_fpr):
l = max(l for l, x in enumerate(fpr) if x <= max_fpr)
tps[i] = tp[l]
fps[i] = fp[l]
fns[i] = fn[l]
tns[i] = tn[l]
else:
tps[i] = tp[0]
fps[i] = fp[0]
fns[i] = fn[0]
tns[i] = tn[0]

be out of the large for loop?
# Update the TPs, FPs, FNs, and TNs using the values at the previous threshold.
k = 0
for l in range(1, num_thresholds):
tp[l] = tp[l-1]
fp[l] = fp[l-1]
fn[l] = fn[l-1]
tn[l] = tn[l-1]
while k < num_instances and current_outputs[idx[k]] >= thresholds[l]:
if current_labels[idx[k]] == 1:
tp[l] += 1
fn[l] -= 1
else:
fp[l] += 1
tn[l] -= 1
k += 1
# Compute the FPRs.
fpr = np.zeros(num_thresholds)
for l in range(num_thresholds):
if tp[l] + fn[l] > 0:
fpr[l] = float(fp[l]) / float(tp[l] + fn[l])
else:
fpr[l] = float('nan')
# Find the threshold such that FPR <= 0.05.
max_fpr = 0.05
if np.any(fpr <= max_fpr):
l = max(l for l, x in enumerate(fpr) if x <= max_fpr)
tps[i] = tp[l]
fps[i] = fp[l]
fns[i] = fn[l]
tns[i] = tn[l]
else:
tps[i] = tp[0]
fps[i] = fp[0]
fns[i] = fn[0]
tns[i] = tn[0]

Wrong FPR in evaluate_model.py

In line 82 and 83 the same denominator is used for TPR and FPR:
float(tp[j] + fn[j])

It should be in line 83:
fpr[j] = float(fp[j]) / float(fp[j] + tn[j])

instead of
fpr[j] = float(fp[j]) / float(tp[j] + fn[j])

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.