Comments (5)
The no guarantee is my reaction to , IMO, NumPy's excessively stringent compatibility guarantee for its PRNG (commitment to never change, ever, irrespective of improvements). This has created a lot of difficulties with adding better algorithms for generating random numbers (e.g. the improved normal generator that is here, which is ~4x faster than NumPy with the same underlying PRNG). I think this is the wrong choice, and it seems a little strange in an OSS world where one can simply use a requirements file to specify specific versions, which will always produce identical results.
I think one way forward would be to include version-specific RandomState objects whenever there is a change. For example, if there was a change in, say 1.12, then the main RandomState object would be the current one, but there could be a RandomState object called, e.g., RandomState111
that would be identical to the 1.11 version. This would be pretty maintainable since one can simply use inheritance to override updated methods,
class RandomState(object):
def random_nums(...):
# new algo
class RandomState111(RandomState)
def random_nums(...):
# old algo
The exact interface for getting the old version would be something like
rs = RandomState(version='1.11')
which would then return the RandomState from that version, which might be the current one if there are no breaking changes.
from ng-numpy-randomstate.
Version-specific RandomState objects seem a great solution to me. As long as there is some easy way to generate the "old version" numbers, that's good.
I fear that "simply use a requirements file to specify specific versions" might not be that simple in the long run: wouldn't there be cases where old versions of ng-numpy-randomstate would not be installable with more recent versions of numpy, cython, pip, or whatnot? This means you would have a cascade of other libs you could not upgrade which is not desirable.
from ng-numpy-randomstate.
Ideally requirements files are highly specific so that the version of Python, NumPy, SciPy, would all be specified. This is the only way to know you are going to have code that will always work and get the same algorithms. This said, you should get mostly similar even from different algos, within numerical limits. PRNGs are a different beast and different algos only preserve results in a probabilistic sense -- that is, you could get random numbers from the same distribution, not the same random numbers.
I have started a bit of work on this by adding a version to the state. More investigation is needed to figure out how exactly to return a different class in Cython than the one requested.
Kevin
from ng-numpy-randomstate.
Ideally requirements files are highly specific ...
That's precisely what I would like to avoid. I would like to be able to continue adding new features to my application, some of which require to use features of newer libraries (numpy or otherwise) AND be able to reproduce results from earlier versions of my application. If users of my app cannot compare the results they obtain using newer versions of my app to those of earlier versions, some of them will never upgrade. If I can simply tell them: "if comparing with older versions is important to you, set this variable to the name of the older version", that seems very reasonable. If however, every two versions of my app breaks their comparisons without any way for them to fix that, that is likely to piss them off.
PS: I just want you to understand why I would like this feature, but I don't mean to put any pressure on you.
from ng-numpy-randomstate.
I'm going to close this. I'm currently working on what will likely be the real next generation NumPy API which will separate the core PRNG from the functions which transform random integers to distributions or do other things. This second structure will maintain backward compat while allowing progress with new algorithms.
from ng-numpy-randomstate.
Related Issues (20)
- is this normal? HOT 5
- Python 3.6 wheels HOT 8
- help on RandomState functions show numpy examples HOT 3
- Can not be used on Debian 9 HOT 3
- Can you provide a function to generate random number from multiple streams HOT 3
- Jump is too slow for larger jump steps! HOT 10
- optimized uniform small integers? HOT 4
- Add xoroshiro128+ HOT 1
- Improve docstring for dtype
- Upload the latests releases to pypi? HOT 1
- faster ziggurat-like methods HOT 9
- did random_uintegers go away? HOT 11
- Segfault when seeding some prng's with float64 HOT 6
- Jump function for the MT19937 HOT 9
- A bug in MultithreadedRNG HOT 8
- Is there a generic randomstate class I can inherit from? HOT 3
- lognormal doc enhancement? HOT 2
- 1.13 fails to build HOT 13
- `advance` and `randint` HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng-numpy-randomstate.