Skip to content

Random V 2.0 task items #31

Description

@cartazio

based up on the lovely GSOC work by @nkartashov at https://github.com/nkartashov/SplitMix (and associated repos https://github.com/nkartashov/htestu for big crush/small crush statistical validation along and then https://github.com/nkartashov/prng-bench for performance comparison), @zaxtax and I are starting some planning work for Random Version 2.0
(and fyi to @idontgetoutmuch @gbaz et al)

let it be known

  1. based upon experimental data thus far, splitmix (subject to certain caveats that are mostly around bad seed subsets that can be easily addressed by porting applicable machinery from the java sibling and possibly pestering guy steele as suggested by some folks at oracle labs i spoke with this week), splitmix is the only rng aside from PCG-Random implemented in haskell that has a sequential next operation that passes big crush
  2. splitmix is the only RNG we know of implemented in haskell that supports a split operation that passes big crush when used as the sequencing operation
    (i need to do further auditing of how those crush tests were setup, but thats another sub item)

the following (approximate) task items, in part leveraging the excellent work by @nkartashov should form the foundation for prepping a v2 of random

  • have fast gen float / double siblings (theres fast ways to generate unit interval floats, and unbiased ways, we cant have both at the same time )
  • modern travis CI setup
  • moving the c code back into haskell
  • criterion benchmarks to compare
  • test suite to compare impls
  • test suite to validate determination of stream given several seeds
  • migrating the bad seed mitigation stuff from the Java sibling
  • emailing GUY!!!! (about the splitmix improvement work he's apparently up to, i'll handle this one next weekend)
  • doc updates
  • considering UX changes
  • RandomT??
    • Should monadic bind do a split (a la quicheck )
  • cleanup big crush stuff and have that as an ancillary library (does @nkartashov want to own that? its his core work, and its an incredibly valuable tool, though he's busy with grad school and i dont want to impose that on him )

Activity

  1. added this to the 2.0 milestone on Dec 8, 2015
  2. idontgetoutmuch commented on Dec 9, 2015

    @idontgetoutmuch
    Member

    This is great news.

    Do we have the results of the tests written up somewhere?

    I had a communication from Guy in April:

    "My one recommendation is that you not standardize on a single algorithm.
    Rather, make a SplittableRandom type class and provide multiple implementations."

    Are we saying that PCG is somehow not as suitable as splitmix? I guess a write up of the tests would help answer this question.

  3. cartazio commented on Dec 9, 2015

    @cartazio
    ContributorAuthor

    Pcg doesn't have a good quality split operator at present.

    I do have the basic test run data lying around on my work computer, I just
    Got a bit buried this fall, I'll see about digging it up

    On Wednesday, December 9, 2015, idontgetoutmuch [email protected]
    wrote:

    This is great news.

    Do we have the results of the tests written up somewhere?

    I had a communication from Guy in April:

    "My one recommendation is that you not standardize on a single algorithm.
    Rather, make a SplittableRandom type class and provide multiple
    implementations."

    Are we saying that PCG is somehow not as suitable as splitmix? I guess a
    write up of the tests would help answer this question.

    —
    Reply to this email directly or view it on GitHub
    #31 (comment).

  4. nkartashov commented on Dec 9, 2015

    @nkartashov

    You are free to use the code in any way you see fit, I'll try to help as much as I can.
    @cartazio what parts of C code would you like to move to Haskell? TestU01 code is a mess written in a bad style (global variables, uninformative names etc.), I didn't refactor partly because it had no tests and I could break it without noticing, so I made only patchwork additions.
    I moved parts of splitmix to C only for performance, although I cannot claim that my Haskell code is optimal.
    @idontgetoutmuch correctness tests can be run using https://github.com/nkartashov/prng-test
    btw, if you find any of the tools lacking, I can add you to collaborators, if you like.

  5. idontgetoutmuch commented on Jan 24, 2016

    @idontgetoutmuch
    Member

    @nkartashov I haven't tried prng-test yet but see the issues I have raised for htestu. Perhaps I should not be trying htestu?

  6. nkartashov commented on Jan 26, 2016

    @nkartashov

    @idontgetoutmuch You mean discard it as a tool?

  7. idontgetoutmuch commented on Feb 18, 2016

    @idontgetoutmuch
    Member

    See my comment on nkartashov/htestu#2. I am going to find a way we can run all the tests in htestu and store the results somewhere. It probably ought to be part of a CI process for RNG.

    @cartazio do we have a CI set up? I know very little about how to provide such a thing but I can investigate.

  8. idontgetoutmuch commented on Feb 28, 2016

    @idontgetoutmuch
    Member

    I have made some small progress e.g. I can now show that tf-random passes smallcrush:

    [OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK,OK]
    

    But I am having problems using htestu at the command line - see: nkartashov/htestu#3.

  9. idontgetoutmuch commented on May 5, 2016

    @idontgetoutmuch
    Member

    I am copying my comments from a closed ticket so they don't get lost.

    It's not ideas that are in short supply. We know we need to a) test the various PRNGs against the various randomness tests (and in particular L'Ecuyers Test01 suite) and b) test their performance.

    I have a colleague who is an expert in the field of RNGs but who does not know Haskell. I have created a binding from R to allow him to test their effectiveness https://github.com/idontgetoutmuch/RandomHaskellFromR. I don't think we need a Haskell binding to Test01 (since we can call it from R) but we have one anyway: https://github.com/idontgetoutmuch/RandomHaskellFromR.

    Oneuseful thing someone could do would be to create a runnable and repeatable performance test suite maybe using https://github.com/nkartashov/prng-bench but note the issue I raised with it.

    My suspicion is that SplitMix will probably be a good replacement but we don't know yet. QuickCheck uses https://hackage.haskell.org/package/tf-random; my testing of it with Test01 shows it passes smallcrush.

    If I sound frustrated, it's because I am.

  10. cartazio commented on May 5, 2016

    @cartazio
    ContributorAuthor

    We have that code , and we need find the time to clean it up. I've
    scheduled the time this weekend. Let's synch up after that :)

    Or is there other bits I'm overlooking? I was a bit buried under job stuff
    this winter and I'm only now climbing back up (eg I did my first new
    package to havksge in a while this week ;))

    On Thursday, May 5, 2016, idontgetoutmuch [email protected] wrote:

    I am copying my comments from a closed ticket so they don't get lost.

    It's not ideas that are in short supply. We know we need to a) test the
    various PRNGs against the various randomness tests (and in particular
    L'Ecuyers Test01 suite) and b) test their performance.

    I have a colleague who is an expert in the field of RNGs but who does not
    know Haskell. I have created a binding from R to allow him to test their
    effectiveness https://github.com/idontgetoutmuch/RandomHaskellFromR. I
    don't think we need a Haskell binding to Test01 (since we can call it from
    R) but we have one anyway:
    https://github.com/idontgetoutmuch/RandomHaskellFromR.

    One useful thing someone could do would be to create a runnable and
    repeatable performance test suite maybe using
    https://github.com/nkartashov/prng-bench but note the issue I raised with
    it.

    My suspicion is that SplitMix will probably be a good replacement but we
    don't know yet. QuickCheck uses
    https://hackage.haskell.org/package/tf-random; my testing of it with
    Test01 shows it passes smallcrush.

    If I sound frustrated, it's because I am.

    —
    You are receiving this because you were mentioned.
    Reply to this email directly or view it on GitHub
    #31 (comment)

  11. Zemyla commented on May 10, 2016

    @Zemyla

    RandomT should not use split like QuickCheck. First off, split can be slow, and splitting for every operation is pretty bad for performance. Second, it means that it violates the monad laws:

    m >>= return /= m

    However, it should support using split to feed one half into a calculation and use the other half as the new random state.

  12. cartazio commented on May 10, 2016

    @cartazio
    ContributorAuthor

    Split in the splitmix is cheap, agree it's problematic in current random
    and tf random. But let me catchup on stuff and finish getting that branch
    up

    Also benchmarks :)

    On Tuesday, May 10, 2016, Zemyla [email protected] wrote:

    RandomT should not use split like QuickCheck. First off, split can be
    slow, and splitting for every operation is pretty bad for performance.
    Second, it means that it violates the monad laws:

    m >>= return /= m

    However, it should support using split to feed one half into a calculation
    and use the other half as the new random state.

    —
    You are receiving this because you were mentioned.
    Reply to this email directly or view it on GitHub
    #31 (comment)

  13. cchalmers commented on Jun 17, 2016

    @cchalmers
    Contributor

    splitmix is the only RNG we know of implemented in haskell that supports a split operation that passes big crush when used as the sequencing operation

    That's strange, I ran the c_bigCrush tests from https://github.com/nkartashov/htestu with nextStreamFromGen, splitNextStreamFromGen and leftSplitStreamFromGen for PCG and it passed them all. Are you where you where using the right generator? (the fast generator would be horrible for splitting, you'd want the multiple sequence generator (the standard one))

    Also I recently wrote a pure Haskell version of the standard generator if you're interested.

  14. zaxtax commented on Jun 17, 2016

    @zaxtax

    Is this a pure Haskell version of splitmix?

    On Fri, Jun 17, 2016 at 2:51 PM, Chris [email protected] wrote:

    splitmix is the only RNG we know of implemented in haskell that supports a
    split operation that passes big crush when used as the sequencing
    operation

    That's strange, I ran the c_bigCrush tests from
    https://github.com/nkartashov/htestu with nextStreamFromGen,
    splitNextStreamFromGen and leftSplitStreamFromGen for PCG and it passed
    them all. Are you where you where using the right generator? (the fast
    generator would be horrible for splitting, you'd want the multiple sequence
    generator (the standard one))

    Also I recently wrote a pure Haskell version
    http://hackage.haskell.org/package/pcg-random-0.1.3.3/docs/System-Random-PCG-Pure.html
    of the standard generator if you're interested.

    —
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub
    #31 (comment), or mute
    the thread
    https://github.com/notifications/unsubscribe/AAAhUQ4jx5oAI2L4b_tVma6iV49WxHnRks5qMuysgaJpZM4Gxd7y
    .

  15. cchalmers commented on Jun 17, 2016

    @cchalmers
    Contributor

    No, a pure version of multiple sequence variant of PCG (I only had a pure version of the fast variant of PCG before).

  16. 17 remaining items

  17. cartazio commented on Feb 21, 2018

    @cartazio
    ContributorAuthor
  18. cartazio commented on Feb 21, 2018

    @cartazio
    ContributorAuthor
  19. zaxtax commented on Feb 25, 2018

    @zaxtax
  20. cartazio commented on Feb 25, 2018

    @cartazio
    ContributorAuthor

    @zaxtax the last bit I was stuck on (which the friendly inquiries last week prompted me to finally ) was what design to put in an intermediate release that wouldn't be a 100% breaking change for ( existing historical codes).

    https://github.com/cartazio/random/tree/v1.2.0 is the current wip, doesn't include some of the cleanup, and i've also been figuring out how to formall characterize the set of types i can give clean semantics too, vs which ones are system / platform dependent. I want samplers to have clear meaning !

  21. cartazio commented on Feb 25, 2018

    @cartazio
    ContributorAuthor

    the system.random api there is mid refactor, because theres a subtle problem with the current api, its not portable between 32 bit and 64bit, and honestly those system dependent types should be under their own interface, at least wrt mathematical sampling code (vs system testing code)

  22. cartazio commented on Feb 25, 2018

    @cartazio
    ContributorAuthor

    (also this thread is strictly for technical discourse, anything else is not constructive, demotivating, and I will delete :) )

  23. zaxtax commented on Feb 25, 2018

    @zaxtax
  24. cartazio commented on Feb 25, 2018

    @cartazio
    ContributorAuthor

    @zaxtax as long as GHC tier 1 platforms include 32bit flavors, pretty important

    thats not the actual blocker, even among 32bit platforms, some sizes of types can vary between OSes etc, though in haskell code thats usually isolated to C related types

  25. cartazio commented on Feb 25, 2018

    @cartazio
    ContributorAuthor

    either way, i have a satisfactory story for that issue now, so its now on the top of my oss queue... been buried under type system design work for a bit

  26. zaxtax commented on Feb 25, 2018

    @zaxtax
  27. cartazio commented on Feb 25, 2018

    @cartazio
    ContributorAuthor
  28. cartazio commented on Feb 25, 2018

    @cartazio
    ContributorAuthor

    i'll be pushing periodically to https://github.com/haskell/random/tree/v1.2.0

  29. Bodigrim commented on Jun 24, 2020

    @Bodigrim
    Contributor

    I believe this discussion is obsolete now. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions