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

Def data enhancements #134

Merged
merged 9 commits into from
Jan 18, 2022
Merged

Def data enhancements #134

merged 9 commits into from
Jan 18, 2022

Conversation

kgoldfeld
Copy link
Owner

@kgoldfeld kgoldfeld commented Jan 13, 2022

@assignUser This Includes two new functions defRepeat and defRepeatAdd. Tests have been included.

@github-actions
Copy link

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 608c3d7 is merged into main:

  •   :ballot_box_with_check:define_data: 25.1ms -> 24.4ms [-7.76%, +2.37%]
  •   :ballot_box_with_check:dist_beta: 3.82s -> 3.68s [-9.98%, +2.35%]
  •   :ballot_box_with_check:dist_binary: 407ms -> 404ms [-9.69%, +8.44%]
  •   :ballot_box_with_check:dist_binomial: 599ms -> 425ms [-92.46%, +34.23%]
  •   :ballot_box_with_check:dist_categorical: 883ms -> 904ms [-3.37%, +8.16%]
  •   :ballot_box_with_check:dist_exponential: 210ms -> 207ms [-9.26%, +6.31%]
  •   :ballot_box_with_check:dist_gamma: 409ms -> 419ms [-5.85%, +10.87%]
  •   :ballot_box_with_check:dist_mixture: 4s -> 4.01s [-6.71%, +6.93%]
  •   :ballot_box_with_check:dist_normal: 404ms -> 582ms [-49.08%, +137.35%]
  •   :ballot_box_with_check:gen_all_dists: 646ms -> 884ms [-52.34%, +126.27%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@github-actions
Copy link

This is how benchmark results would change (along with a 95% confidence interval in relative change) if 87b6811 is merged into main:

  •   :ballot_box_with_check:define_data: 31.1ms -> 30.8ms [-4.34%, +2.58%]
  •   :ballot_box_with_check:dist_beta: 4.39s -> 4.4s [-1.39%, +1.87%]
  •   :ballot_box_with_check:dist_binary: 509ms -> 521ms [-1.94%, +6.4%]
  •   :ballot_box_with_check:dist_binomial: 508ms -> 511ms [-2.15%, +3.46%]
  •   :ballot_box_with_check:dist_categorical: 1.14s -> 1.12s [-4.17%, +0.65%]
  • ❗🐌dist_exponential: 261ms -> 269ms [+0.61%, +5.24%]
  •   :ballot_box_with_check:dist_gamma: 517ms -> 528ms [-1.14%, +5.54%]
  •   :ballot_box_with_check:dist_mixture: 4.7s -> 4.74s [-0.66%, +2.31%]
  •   :ballot_box_with_check:dist_normal: 519ms -> 524ms [-1.78%, +3.7%]
  •   :ballot_box_with_check:gen_all_dists: 804ms -> 801ms [-3.08%, +2.28%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@kgoldfeld
Copy link
Owner Author

@assignUser This was a tad premature - I haven't added anything to the vignettes - I need to do that.

@kgoldfeld
Copy link
Owner Author

@assignUser Vignette is updated, so I think it is ready to go.

@github-actions
Copy link

This is how benchmark results would change (along with a 95% confidence interval in relative change) if a38e474 is merged into main:

  •   :ballot_box_with_check:define_data: 38.1ms -> 37.1ms [-16.26%, +11.1%]
  •   :ballot_box_with_check:dist_beta: 4.81s -> 4.8s [-2.67%, +2.45%]
  •   :ballot_box_with_check:dist_binary: 547ms -> 542ms [-5.46%, +3.92%]
  •   :ballot_box_with_check:dist_binomial: 547ms -> 543ms [-4.08%, +2.64%]
  •   :ballot_box_with_check:dist_categorical: 1.2s -> 1.19s [-2.95%, +1.85%]
  •   :ballot_box_with_check:dist_exponential: 282ms -> 278ms [-9.21%, +6.95%]
  •   :ballot_box_with_check:dist_gamma: 542ms -> 541ms [-2.13%, +1.8%]
  •   :ballot_box_with_check:dist_mixture: 5.14s -> 5.06s [-3.9%, +0.9%]
  •   :ballot_box_with_check:dist_normal: 538ms -> 545ms [-2.01%, +4.66%]
  • ❗🐌gen_all_dists: 827ms -> 843ms [+0.26%, +3.71%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@assignUser
Copy link
Collaborator

I'll check it out this weekend :)

R/define_data.R Outdated
#' def <- defDataAdd(def, varname = "a", formula = "1;1", dist = "trtAssign")
#' def <- defRepeatAdd(def, 8, "b", formula = "5 + a", variance = 3, dist = "normal")
#' def <- defDataAdd(def, "y", formula = "0.10", dist = "binary")
#'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need defRepeatAdd in addition to defRepeat as they do the same thing? Code duplication like this is usally a big no-no :D

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well - they do the same thing, except for the variable checking, just like defData and defDataAdd. defRepeatAdd calls defDataAdd, whereas defRepeat calls defData.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I see. Ah that remindes me of #18
But that can still be done without complete duplication of code... I`ll try it later

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, defRepeat wouldn't be needed at all if defData had another argument nVars that would just indicate how many instances of the current variable. But, I don't mind the extra function, since it makes it explicit what the user is trying to do. Again, complete transparency at the expense of efficiency.

@github-actions
Copy link

This is how benchmark results would change (along with a 95% confidence interval in relative change) if a53e7da is merged into main:

  •   :ballot_box_with_check:define_data: 27.5ms -> 27.5ms [-2.36%, +2.11%]
  •   :ballot_box_with_check:dist_beta: 4.21s -> 4.25s [-2.59%, +4.54%]
  •   :ballot_box_with_check:dist_binary: 456ms -> 459ms [-1.32%, +2.49%]
  •   :ballot_box_with_check:dist_binomial: 456ms -> 465ms [-0.95%, +4.85%]
  •   :ballot_box_with_check:dist_categorical: 1.04s -> 1.05s [-2.19%, +3.53%]
  •   :ballot_box_with_check:dist_exponential: 233ms -> 230ms [-3.7%, +1.09%]
  •   :ballot_box_with_check:dist_gamma: 462ms -> 468ms [-0.39%, +3.05%]
  •   :ballot_box_with_check:dist_mixture: 4.5s -> 4.53s [-1.58%, +3.15%]
  •   :ballot_box_with_check:dist_normal: 461ms -> 465ms [-1.64%, +3.28%]
  •   :ballot_box_with_check:gen_all_dists: 718ms -> 710ms [-5.27%, +2.98%]
    Further explanation regarding interpretation and methodology can be found in the documentation.

@kgoldfeld
Copy link
Owner Author

@assignUser Just wanted to confirm that we are on board with this, and I can go ahead and merge ...

@assignUser
Copy link
Collaborator

Sure, go ahead we will deal with the code duplication when handeling #18 as it is basically the same thing :D

@kgoldfeld kgoldfeld merged commit 4151cb2 into main Jan 18, 2022
@kgoldfeld kgoldfeld deleted the def-data-enhancements branch January 18, 2022 15:30
@assignUser assignUser restored the def-data-enhancements branch January 25, 2022 14:19
@assignUser assignUser deleted the def-data-enhancements branch January 25, 2022 14:19
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.

2 participants