Code Monkey home page Code Monkey logo

dandy's Introduction

dandy: Desings ANd DiscrepancY

Status CRAN Status Badge CRAN checks CRAN Downloads

Build Status Build status Coverage Status

Introduction

This package offers a simple method for the generation of random uniform, LHS, Sobol and Halton sequences of n points in d dimension. Basically the package delegates to other packages and offers a unified interface. Additionally, an exact method and an approximate method based on threshold accepting optimization for the calculation of the star discrepancy measure is included.

Example

Here, we generate each one uniform, latin hypercube sample, Halton and Sobol design with n=20 points in k=2 dimensions and calculate its exact disrepancy.

library(dandy)
library(ggplot2)

n = 50
methods = c("uniform", "improvedlhs", "halton", "sobol")
designs = lapply(methods, function(method) {
  dandy::design(n = n, k = 5, method = method)
})

# caluclate star discrepancy
discr.exact  = sapply(designs, dandy::stardiscrepancy, method = "exact")
discr.approx = sapply(designs, dandy::stardiscrepancy, method = "ta")

# visualize
designs = do.call(rbind, designs)
groups = sprintf("%s (%.4f)", methods, discr.exact)
designs$method = factor(rep(groups, each = n))

pl = ggplot(designs, aes(x = x1, y = x2))
pl = pl + geom_point()
pl = pl + facet_grid(. ~ method)
print(pl)

Development Team

The package is a one-man project by Jakob Bossek at the moment of writing. However, the package interfaces a neat implementation of approximate star-discrepancy caluclation by Magnus Wahlström.

Gnewuch, Michael, Magnus Wahlström, and Carola Winzen. “A NEW RANDOMIZED ALGORITHM TO APPROXIMATE THE STAR DISCREPANCY BASED ON THRESHOLD ACCEPTING.” SIAM Journal on Numerical Analysis 50, no. 2 (2012): 781-807. www.jstor.org/stable/41582760.

How to contribute?

You can contribute by identifing annoying bugs in the issue tracker. This is also the preferred place to ask questions and raise feature requests. Moreover, users can contribute even more by forking the dandy repository, implementing features or bugfixes and raising a pull request.

Installation Instructions

The package will be available at CRAN when it is done. If you are interested in trying out and playing around with the current github developer version use the devtools package and type the following command in R:

remotes::install_github("jakobbossek/dandy")

Getting help

Please address questions and missing features about the dandy as weell as annoying bug reports in the issue tracker. Pay attention to explain your problem as good as possible. At its best you provide an example, so I can reproduce your problem quickly. Please avoid sending e-mails.

dandy's People

Contributors

jakobbossek avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

hkumar6

dandy's Issues

Some strange behavior on HPC

I get the following strange behavior on a HPC for method = "ta" producing discrepancy values between 1 and 2. However, this does not happen locally.
Note: it seems that this happens in the first phase of the TA algorithm only.

Trial 9/10
1.56809 at 2 : 109 114 96 109 107 116 117 111 106 111
1.60991 at 4 : 114 114 97 109 114 116 111 111 106 111
1.64886 at 5 : 114 114 97 109 114 116 111 111 116 111
1.66496 at 7 : 114 108 105 109 114 116 111 111 116 111
1.69675 at 10 : 114 115 105 109 114 116 111 111 114 111
1.72251 at 75 : 115 103 110 114 116 114 111 110 114 117
1.72667 at 285 : 115 117 112 115 110 113 106 113 114 111
1.73547 at 312 : 101 115 115 116 114 113 116 113 112 115
1.74633 at 582 : 115 117 110 115 113 117 112 99 112 117
1.74775 at 592 : 115 109 115 113 113 107 109 116 114 117
1.76164 at 813 : 112 110 115 113 110 115 112 114 112 115
1.78077 at 999 : 112 117 115 114 116 109 112 114 112 113
1.80121 at 1148 : 114 114 114 116 114 116 111 113 110 117

Fix C warnings

I have no idea how to solve incompatible pointer types passing warnings.

── R CMD check ─────────────────────────────────────────────────────────────────
─ using log directory ‘/private/var/folders/lr/g4jxbpys6z54qrs4ppyln72c0000gn/T/rcheck-sampling-20191218-222222/sampling.Rcheck’ (339ms)
─ using R version 3.5.2 (2018-12-20)
─ using platform: x86_64-apple-darwin15.6.0 (64-bit)
─ using session charset: UTF-8
✔ checking for file ‘sampling/DESCRIPTION’ ...
─ this is package ‘sampling’ version ‘1.0.0.0000’
─ package encoding: UTF-8
✔ checking package namespace information
✔ checking package dependencies (6.1s)
✔ checking if this is a source package
✔ checking if there is a namespace
✔ checking for executable files ...
✔ checking for hidden files and directories
✔ checking for portable file names
✔ checking for sufficient/correct file permissions
W checking whether package ‘sampling’ can be installed (3.7s)
Found the following significant warnings:
bz_discr.c:85:48: warning: incompatible pointer types passing 'int (double **, double *)' to parameter of type 'int ( _Nonnull)(const void *, const void *)' [-Wincompatible-pointer-types]
dem_discr.c:101:59: warning: incompatible pointer types passing 'int (double *, double )' to parameter of type 'int ( _Nonnull)(const void *, const void *)' [-Wincompatible-pointer-types]
dem_discr.c:229:48: warning: incompatible pointer types passing 'int (double **, double *)' to parameter of type 'int ( _Nonnull)(const void *, const void *)' [-Wincompatible-pointer-types]
dem_discr.c:230:44: warning: incompatible pointer types passing 'int (double **, double *)' to parameter of type 'int ( _Nonnull)(const void *, const void *)' [-Wincompatible-pointer-types]
dem_discr.c:292:52: warning: incompatible pointer types passing 'int (double **, double *)' to parameter of type 'int ( _Nonnull)(const void *, const void *)' [-Wincompatible-pointer-types]
See ‘/private/var/folders/lr/g4jxbpys6z54qrs4ppyln72c0000gn/T/rcheck-sampling-20191218-222222/sampling.Rcheck/00install.out’ for details.
✔ checking installed package size ...
✔ checking package directory
✔ checking DESCRIPTION meta-information (369ms)
✔ checking top-level files
✔ checking for left-over files
✔ checking index information
✔ checking package subdirectories ...
✔ checking R files for non-ASCII characters ...
✔ checking R files for syntax errors ...
✔ checking whether the package can be loaded ...
✔ checking whether the package can be loaded with stated dependencies ...
✔ checking whether the package can be unloaded cleanly ...
✔ checking whether the namespace can be loaded with stated dependencies ...
✔ checking whether the namespace can be unloaded cleanly ...
✔ checking loading without being on the library search path ...
✔ checking dependencies in R code (350ms)
✔ checking S3 generic/method consistency (533ms)
✔ checking replacement functions ...
✔ checking foreign function calls ...
✔ checking R code for possible problems (1.3s)
✔ checking Rd files ...
✔ checking Rd metadata ...
✔ checking Rd cross-references ...
✔ checking for missing documentation entries ...
✔ checking for code/documentation mismatches (752ms)
✔ checking Rd \usage sections (788ms)
✔ checking Rd contents ...
✔ checking for unstated dependencies in examples ...
✔ checking line endings in C/C++/Fortran sources/headers
W checking compiled code ...
File ‘sampling/libs/sampling.so’:
Found ‘___stderrp’, possibly from ‘stderr’ (C)
Objects: ‘TA_common.o’, ‘TA_shrink_bardelta.o’,
‘TA_shrink_delta.o’, ‘bz_discr.o’, ‘dem_discr.o’,
‘simple_discr.o’
Found ‘___stdoutp’, possibly from ‘stdout’ (C)
Objects: ‘TA_shrink_bardelta.o’, ‘TA_shrink_delta.o’
Found ‘_abort’, possibly from ‘abort’ (C)
Objects: ‘TA_common.o’, ‘dem_discr.o’
Found ‘_rand’, possibly from ‘rand’ (C)
Object: ‘TA_common.o’
Found ‘_random’, possibly from ‘random’ (C)
Objects: ‘TA_common.o’, ‘simple_discr.o’

Compiled code should not call entry points which might terminate R nor
write to stdout/stderr instead of to the console, nor use Fortran I/O
nor system RNGs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.