Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (18.9%) to scientific vocabulary
Last synced: 11 months ago
·
JSON representation
Repository
Basic Info
- Host: GitHub
- Owner: CollinErickson
- Language: R
- Default Branch: master
- Size: 674 KB
Statistics
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 1
- Releases: 7
Created about 9 years ago
· Last pushed over 1 year ago
Metadata Files
Readme
Changelog
README.Rmd
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "tools/README-"
)
```
```{r init, echo=FALSE}
set.seed(0)
```
# comparer
[](https://cran.r-project.org/package=comparer)
[](https://app.codecov.io/github/CollinErickson/comparer?branch=master)
[](https://coveralls.io/github/CollinErickson/comparer?branch=master)
[](https://github.com/CollinErickson/comparer/actions)
The goal of comparer is to make it easy to compare the results of different code
chunks that are trying to do the same thing.
The R package `microbenchmark` is great for comparing the speed of code,
but there's no way to compare their output to see which is more accurate.
## Installation
You can install comparer from GitHub with:
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
# devtools::install_github("CollinErickson/comparer")
```
## `mbc`
One of the two main functions of this package is `mbc`, for "model benchmark compare."
It is designed to be similar to the package `microbenchmark`,
allow for fast comparisons except including the output/accuracy of the
code evaluated instead of just timing.
Suppose you want to see how the mean and median of a sample of 100 randomly
generated data points from an exponential distribution compare.
Then, as demonstrated below, you can use the function `mbc`,
with the functions mean and median, and then `input=rexp(100)`.
The value of `input` will be stored as `x`, so `mean(x)` will
find the mean of that data.
It outputs the run times of each, and then the results from the
five trials, where five is the default setting for `times`.
The run times aren't useful because they are all fast.
For more precise timing (<0.01 seconds), you should use `microbenchmark`.
The trials all have the same output since there is no randomness,
the same data is used for each trial.
The "Output summary" shows that the mean is near 1, while the median
is near 0.6.
```{r mbc_example}
## basic example code
library(comparer)
mbc(mean(x), median(x), input=rexp(100))
```
To get the data to be generated for each trial,
use the `inputi` argument to set a variable that the
functions call.
The arguments `mean(x)` and `median(x)` are captured as expressions.
`rexp(100)` will be stored as `x` by default.
You can see that the values are now different for each trial.
```{r mbc_example2}
## Regenerate the data each time
mbc(mean(x), median(x), inputi=rexp(100))
```
The variable name, or multiple variables, can be set in `inputi` by
using braces `{}`
In the example below, values are set for `a` and `b`, which can then
be called by the expressions to be compared.
```{r mbc_example3}
mbc(mean(a+b), mean(a-b), inputi={a=rexp(100);b=runif(100)})
```
## `ffexp`
The other main function of the package is `ffexp`, an abbreviation for
full-factorial experiment.
It will run a function using all possible combinations of input parameters
given.
It is useful for running experiments that take a long time to complete.
The first arguments given to `ffexp$new` should give the possible values for
each input parameter.
In the example below, `a` can be 1, 2, or 3,
and `b` can "a", "b", or "c".
Then `eval_func` should be given that can operate on these parameters.
For example, using `eval_func = paste` will paste together the value
of `a` with the value of `b`.
```{r}
f1 <- ffexp$new(
a=1:3,
b=c("a","b","c"),
eval_func=paste
)
```
After creating the `ffexp` object, we can call
`f1$run_all` to run `eval_func` on every combination of `a` and `b`.
```{R}
f1$run_all()
```
Now to see the results in a clean format, look at `f1$outcleandf`.
```{r}
f1$outcleandf
```
## `hype`: Hyperparameter Optimization
`hype` uses Bayesian optimization to find the best parameters/inputs
for a function that is slow to evaluate.
(If the function can be evaluated quickly, then you can use standard
optimization methods.)
A common use case is for hyperparameter tuning:
when fitting a model that has multiple hyperparameters,
you want to find the best values to set the hyperparameters to
but can only evaluate a small number of settings since
each is slow.
Owner
- Name: Collin Erickson
- Login: CollinErickson
- Kind: user
- Repositories: 20
- Profile: https://github.com/CollinErickson
GitHub Events
Total
- Watch event: 1
Last Year
- Watch event: 1
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Collin Erickson | c****n@g****m | 448 |
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 334 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 7
- Total maintainers: 1
cran.r-project.org: comparer
Compare Output and Run Time
- Homepage: https://github.com/CollinErickson/comparer
- Documentation: http://cran.r-project.org/web/packages/comparer/comparer.pdf
- License: GPL-3
-
Latest release: 0.2.4
published almost 2 years ago
Rankings
Forks count: 21.9%
Stargazers count: 26.2%
Average: 28.9%
Dependent packages count: 29.8%
Downloads: 31.4%
Dependent repos count: 35.5%
Maintainers (1)
Last synced:
11 months ago
Dependencies
DESCRIPTION
cran
- R6 * imports
- ContourFunctions * suggests
- DiceKriging * suggests
- DiceOptim * suggests
- GGally * suggests
- GauPro >= 0.2.4.9001 suggests
- covr * suggests
- ggplot2 * suggests
- ggpubr * suggests
- knitr * suggests
- lhs * suggests
- microbenchmark * suggests
- parallel * suggests
- plyr * suggests
- progress * suggests
- reshape * suggests
- reshape2 * suggests
- rmarkdown * suggests
- snow * suggests
- testthat >= 2.1.0 suggests
- tibble * suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite