Skip to content

Commit

Permalink
Update README.md (#104)
Browse files Browse the repository at this point in the history
* Update README.md

Fixed a bug with sigdig and updated one value in the table

* Update evaluate.py

* Added tests to confirm that sigdigs is working as intended.py
  • Loading branch information
Expertium authored Jul 26, 2024
1 parent fe6fb67 commit 84c21ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ The following tables present the means and the 99% confidence intervals. The bes
| FSRS-5 | 19 | 0.346±0.0031 | 0.0709±0.00086 | **0.700±0.0017** |
| FSRS-rs | 19 | 0.347±0.0031 | 0.0722±0.00087 | 0.696±0.0017 |
| FSRS-4.5 | 17 | 0.352±0.0032 | 0.0743±0.00089 | 0.688±0.0017 |
| FSRS v4 | 17 | 0.362±0.0034 | 0.0841±0.00100 | 0.685±0.0017 |
| FSRS v4 | 17 | 0.362±0.0034 | 0.084±0.0010 | 0.685±0.0017 |
| DASH | 9 | 0.358±0.0031 | 0.0846±0.00096 | 0.632±0.0018 |
| DASH[ACT-R] | 5 | 0.362±0.0033 | 0.086±0.0011 | 0.627±0.0019 |
| FSRS-5 (only pretrain) | 4 | 0.360±0.0033 | 0.0861±0.00091 | 0.693±0.0017 |
Expand Down
15 changes: 14 additions & 1 deletion evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,20 @@ def num_lead_zeros(x):
decimals = n_lead_zeros_CI + CI_sigdigs
rounded_CI = round(CI, decimals)
rounded_value = round(value, decimals - 1)
return str(f"{rounded_value:.{decimals - 1}f}"), str(f"{rounded_CI:.{decimals}f}")
if n_lead_zeros_CI > num_lead_zeros(rounded_CI):
return str(f"{round(value, decimals - 2):.{decimals - 2}f}"), str(f"{round(CI, decimals - 1):.{decimals - 1}f}")
else:
return str(f"{rounded_value:.{decimals - 1}f}"), str(f"{rounded_CI:.{decimals}f}")


# tests to ensure that sigdigs is working as intended
value = 0.084111111
CI = 0.0010011111
assert sigdig(value, CI) == ('0.084', '0.0010')

value = 0.084111111
CI = 0.000999999999
assert sigdig(value, CI) == ('0.084', '0.0010')


def confidence_interval(values, sizes):
Expand Down

0 comments on commit 84c21ba

Please sign in to comment.