question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Computation of the accuracy scores when there are compilation and runtime errors

See original GitHub issue

Hi thank you for this great dataset! I have some questions about how you compute the accuracy scores in this https://github.com/hendrycks/apps/blob/c55cce35806c14423b41decf7241615261cf9de0/eval/test_one_solution.py#L22-L42 I was curious why you use -2 and -1 for compilation and runtime errors and include them in the average computation of the accuracy which could lead to a negative score. It seems more natural to give a False label to a code with syntax/runtime error similarily to a code that just doesn’t pass the unit tests.

Also the expression all_correct.append(np.all(results[index])) will consider -2 and -1 as True since np.all evaluates non zero numbers to True, which could give a false accuracy.

Below is an example:

print_results({0: [[-2]], 1: [[-2]], 2: [[-2]], 3: [[-2]]}, args)
number of compile errors = 1 avg = 0.25
number of runtime errors = 1 avg = 0.25
number of test cases run = 4
Test Case Average (average accuracy over problems) = -2.0
Strict Accuracy (all test cases passed / total problems) = 1.0

Another thing regarding the expressions:

 compile_errors = len(tmp_results[tmp_results==-2])
 runtiome_errors = len(tmp_results[tmp_results==-1])

if I’m not mistaken this doesn’t work (at least on Python 3.9), another implementation could be

 compile_errors = len([e for e in tmp_results if -2 in e])
 runtiome_errors = len([e for e in tmp_results if -1 in e])

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
xkstevencommented, Jun 30, 2022

Okay I think now with the examples and documentation it is working correctly and as intended. So I think this issue is good to close now. Feel free to reopen if there’s something that was missed.

1reaction
loubnabnlcommented, Jun 28, 2022

Great I’ll open a PR! I saw that you already changed it thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Difference between Compile Time Errors and Runtime Errors
Run-Time Errors : Errors which occur during program execution(run-time) after successful compilation are called run-time errors.
Read more >
Difference Between Compile Time Errors and Runtime ... - Byju's
The runtime errors occur during the run-time program execution after a successful compilation. Visit to learn more about Compile Time Errors Vs. Runtime...
Read more >
What is the difference between a runtime error, simulation ...
Compilation errors happen during the compilation stage when the source code is parsed and checked for syntax errors. · Run time errors are...
Read more >
What is the difference between run-time error and compiler ...
A runtime error happens during the running of the program. A compiler error happens when you try to compile the code. If you...
Read more >
Accuracy, Precision, and Error - YouTube
Discussion on the difference between accuracy and precision. Examples of error and percent error calculations.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found