Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Round outputs #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Round outputs #7

wants to merge 2 commits into from

Conversation

benbc
Copy link

@benbc benbc commented Aug 5, 2022

Hello. I'm not sure if you're maintaining this tool. I found it v useful, but I had to make a couple of small changes to make it do what I needed so I thought I'd see if you were interested in pull requests. (This is the first of two.)

It's unfortunate that the new arg name is so close to the existing one. Do let me know if you can think of better alternatives.

Adds a command line argument to specify whether to round the outputs
(and to how many decimal places).

```
  -R ROUND_TO, --round-to ROUND_TO
                        number of digits to round outputs to
```

This addresses two rough edges with models that produce decimal
outputs. Firstly they may produce outputs with spurious or
uninteresting accuracy, secondly floating point arithmetic may produce
unhelpful decimal representations. Both are apparent in the example
below.

Without rounding:

```
$ cat pipeline.sys | systems-run | cut -f1,14- | expand --tabs=20
                    Options             Initiatives         Deliverables        Observables         Done
0                   0                   0                   0                   0                   0
1                   5                   0                   0                   0                   0
2                   6                   2                   0                   0                   0
3                   6                   2                   2                   0                   0
4                   5.94                2.0                 2.16                1.8                 0
5                   6.832000000000001   2.0                 2.2880000000000003  1.8                 1.8
6                   6.6856              2.0                 2.3904              1.8                 3.6
7                   6.5084800000000005  2.0                 2.47232             1.8                 5.4
8                   6.306784            2.0                 2.5378559999999997  1.8                 7.2
9                   6.0854272           2.0                 2.5902847999999996  1.8                 9.0
10                  5.848341759999999   2.0                 2.6322278399999997  1.8                 10.8
```

With rounding:

```
$ cat pipeline.sys | systems-run --round-to 2 | cut -f1,14- | expand --tabs=14
              Options       Initiatives   Deliverables  Observables   Done
0             0             0             0             0             0
1             5             0             0             0             0
2             6             2             0             0             0
3             6             2             2             0             0
4             5.94          2.0           2.16          1.8           0
5             6.83          2.0           2.29          1.8           1.8
6             6.69          2.0           2.39          1.8           3.6
7             6.51          2.0           2.47          1.8           5.4
8             6.31          2.0           2.54          1.8           7.2
9             6.09          2.0           2.59          1.8           9.0
10            5.85          2.0           2.63          1.8           10.8
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant