Git Product home page Git Product logo

elections.dtree's People

Contributors

dvukcevic avatar fleverest avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

elections.dtree's Issues

Setting `n_threads=1` potentially runs on two threads.

In src/R_tree.cpp, the samplePosterior method dispatches nThreads threads, and runs the remainder on the main thread. It seems that this way will always result in n_threads+1 threads being used. Really we should only dispatch n_threads-1 new threads.

Define a social.choice() generic function

I think you intended that users can call social.choice(ballots) in R, with ballots being of class PIRVballots.

That requires that social.choice() be defined as a generic function, see here.

Can install on my Mac

Hi Floyd,

You mentioning looking at {rater} after my talk on Tuesday prompted me to have a look at {dirtree.elections} last night.

I was able to install the package onto my (old) MacBook Air and ran some of the README example code.

I mentioned this to Damjan at our meeting today and he said that you thought that the package didn't work on Mac and that I should let you know that it installed on my machine. So, now you know! :)

Jeffrey

p.s.
I couldn't run some of the examples in the README: happy to tell you more about that in a separate issue if you want :)

Function for sampling ballots

It might be handy to have a function for sampling ballots.

Something like sample.ballots(x, 100) to get a subsample of 100 ballots, where x is of class PIRVBallots.

count.ballots() is slow

count.ballots() is very slow when there are a large number of ballots.

We should try re-writing it to avoid the for loop and the incremental construction of ballot.counts.

Swap order of arguments for write.ballots()

I suggest swapping the order of the first two arguments for write.ballots() to make it consistent with other standard functions such as write.csv().

Also, the same as for write.csv(), I suggest making the default value of filename be "", with the default being to write to the console.

So the function definition would looks like:

write.ballots <- function(ballots, filename = "", candidates=NULL) { ... }

Portability issue: Windows doesn't pass `R CMD CHECK`.

This check fails with the following error log:

  Error: Error: <callr_remote_error: Failed to build source package 'dirtree.elections'>
   in process 5304 
  -->
  Failed to build source package 'dirtree.elections', stdout + stderr:
  
  OE> * installing *source* package 'dirtree.elections' ...
  OE> staged installation is only possible with locking
  OE> ** using non-staged installation
  OE> ** libs
  OE> g++  -std=gnu++17 -I"C:/R/include" -DNDEBUG  -I'D:/a/_temp/Library/Rcpp/include' -I'D:/a/_temp/Library/RcppThread/include' -I'D:/a/_temp/Library/testthat/include'   -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -Wall -pedantic -c RcppExports.cpp -o RcppExports.o
  OE> g++  -std=gnu++17 -I"C:/R/include" -DNDEBUG  -I'D:/a/_temp/Library/Rcpp/include' -I'D:/a/_temp/Library/RcppThread/include' -I'D:/a/_temp/Library/testthat/include'   -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -Wall -pedantic -c RcppIRV.cpp -o RcppIRV.o
  OE> g++  -std=gnu++17 -I"C:/R/include" -DNDEBUG  -I'D:/a/_temp/Library/Rcpp/include' -I'D:/a/_temp/Library/RcppThread/include' -I'D:/a/_temp/Library/testthat/include'   -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -Wall -pedantic -c distributions.cpp -o distributions.o
  OE> g++  -std=gnu++17 -I"C:/R/include" -DNDEBUG  -I'D:/a/_temp/Library/Rcpp/include' -I'D:/a/_temp/Library/RcppThread/include' -I'D:/a/_temp/Library/testthat/include'   -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -Wall -pedantic -c irv_ballot.cpp -o irv_ballot.o
  OE> g++  -std=gnu++17 -I"C:/R/include" -DNDEBUG  -I'D:/a/_temp/Library/Rcpp/include' -I'D:/a/_temp/Library/RcppThread/include' -I'D:/a/_temp/Library/testthat/include'   -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -Wall -pedantic -c irv_node.cpp -o irv_node.o
  OE> irv_node.cpp: In member function 'void IRVParameters::calculateDepthFactors()':
  OE> irv_node.cpp:21:15: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  OE>      if (depth >= minDepth)
  OE>          ~~~~~~^~~~~~~~~~~
  OE> g++  -std=gnu++17 -I"C:/R/include" -DNDEBUG  -I'D:/a/_temp/Library/Rcpp/include' -I'D:/a/_temp/Library/RcppThread/include' -I'D:/a/_temp/Library/testthat/include'   -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -Wall -pedantic -c test-distributions.cpp -o test-distributions.o
  OE> g++  -std=gnu++17 -I"C:/R/include" -DNDEBUG  -I'D:/a/_temp/Library/Rcpp/include' -I'D:/a/_temp/Library/RcppThread/include' -I'D:/a/_temp/Library/testthat/include'   -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -Wall -pedantic -c test-pirvdirichlettree.cpp -o test-pirvdirichlettree.o
  OE> g++  -std=gnu++17 -I"C:/R/include" -DNDEBUG  -I'D:/a/_temp/Library/Rcpp/include' -I'D:/a/_temp/Library/RcppThread/include' -I'D:/a/_temp/Library/testthat/include'   -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -Wall -pedantic -Wall -pedantic -c test-runner.cpp -o test-runner.o
  OE> In file included from D:/a/_temp/Library/testthat/include/testthat.h:1,
  OE>                  from test-runner.cpp:7:
  OE> D:/a/_temp/Library/testthat/include/testthat/testthat.h: In function 'std::ostream& Catch::cout()':
  OE> D:/a/_temp/Library/testthat/include/testthat/testthat.h:145:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  OE>  }
  OE>  ^
  OE> D:/a/_temp/Library/testthat/include/testthat/testthat.h: In function 'std::ostream& Catch::cerr()':
  OE> D:/a/_temp/Library/testthat/include/testthat/testthat.h:152:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  OE>  }
  OE>  ^
  OE> g++ -shared -s -static-libgcc -o dirtree.elections.dll tmp.def RcppExports.o RcppIRV.o distributions.o irv_ballot.o irv_node.o test-distributions.o test-pirvdirichlettree.o test-runner.o -Lc:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64 -Lc:/rtools42/x86_64-w64-mingw32.static.posix/lib -LC:/R/bin/x64 -lR
  OE> installing to C:/Users/RUNNER~1/AppData/Local/Temp/RtmpSWJs5d/pkg-lib14b8388495/dirtree.elections/libs/x64
  OE> ** R
  OE> ** byte-compile and prepare package for lazy loading
  OE> ** help
  OE> *** installing help indices
  OE> ** building package indices
  OE> ** testing if installed package can be loaded
  OE> ERROR: loading failed
  OE> * removing 'C:/Users/RUNNER~1/AppData/Local/Temp/RtmpSWJs5d/pkg-lib14b8388495/dirtree.elections'
  
   Stack trace:
  
   12. (function (...)  ...
   13. base:::withCallingHandlers(cli_message = function(msg) { ...
   14. get("pkg_install_do_plan", asNamespace("pak"))(...)
   15. pkgdepends::install_package_plan(plan = plan, lib = lib, num_workers = num_ ...
   16. base:::withCallingHandlers({ ...
   17. pkgdepends:::handle_events(state, events)
   18. pkgdepends:::handle_event(state, i)
   19. pkgdepends:::stop_task(state, worker)
   20. pkgdepends:::stop_task_build(state, worker)
   21. base:::throw(new_pkg_build_error("Failed to build source package {pkg}",  ...
   22. base:::signalCondition(cond)
   23. (function (e)  ...
   24. base:::stop(e)
   25. (function (e)  ...
  
     x Failed to build source package 'dirtree.elections' 
  
  Execution halted
  Error: Process completed with exit code 1.

Note that there are three warnings being displayed, and only one of them is in my source.

Publish to CRAN

We're very close to being able to submit this package to CRAN. We just have a few steps we need to get done first:

  • Choose a license for the repository.
  • Add some references and acknowledgements to README.md.
  • Create NEWS.md in the home directory. Increment version to 1.0 for an initial release?
  • Run a final R CMD check . and document the results in cran-comments.md.
  • Submit using devtools::release().

What do you think @dvukcevic?

Need a PIRVBallots constructor

Sometimes I would like to construct some ballot data 'on the fly' for testing and debugging. It would be handy to have an easy way to do that, without needing to construct it all by hand (setting attributes, etc.).

Update citation

Our paper describing this work has now been published (here, and our earlier paper here). We should update the documentation and citation info to point to these.

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.