Re: [Numpy-discussion] Proposal: numpy.random.random_seed

2016-05-16 Thread Stephan Hoyer
Looking at the dask helper function again reminds me of an important cavaet to this approach, which was pointed out to me by Clark Fitzgerald. If you generate a moderately large number of random seeds in this fashion, you are quite likely to have collisions due to the Birthday Paradox. For example

[Numpy-discussion] Proposal: numpy.random.random_seed

2016-05-16 Thread Stephan Hoyer
I have recently encountered several use cases for randomly generate random number seeds: 1. When writing a library of stochastic functions that take a seed as an input argument, and some of these functions call multiple other such stochastic functions. Dask is one such example [1]. 2. When a libr

Re: [Numpy-discussion] Remove a random sample from array

2016-05-16 Thread josef.pktd
On Mon, May 16, 2016 at 12:24 PM, Elliot Hallmark wrote: > Use `random.shuffle(range(len(arr))` to make a list of indices. Use a > slices to get your 20/80. Convert to integer arrays and index your > original array with them. Use sorted on the 80% list if you need to > preserve the order. > s

[Numpy-discussion] Scipy John Hunter Plotting Contest: DEADLINE EXTENDED TO JUNE 3

2016-05-16 Thread Michael Droettboom
The Scipy John Hunter Excellence in Plotting Contest is a great opportunity to showcase advancement in the start of the art of visualization. Entries are still welcome, as the deadline has been extended to June 3, 2016. Entry Instructions - Participants are invited to submit scientific plo

Re: [Numpy-discussion] Remove a random sample from array

2016-05-16 Thread Elliot Hallmark
Use `random.shuffle(range(len(arr))` to make a list of indices. Use a slices to get your 20/80. Convert to integer arrays and index your original array with them. Use sorted on the 80% list if you need to preserve the order. -Elliot On Mon, May 16, 2016 at 11:04 AM, Martin Noblia < martin.nob.

Re: [Numpy-discussion] Remove a random sample from array

2016-05-16 Thread Martin Noblia
I think with `np.random.choice` http://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.random.choice.html On 05/16/2016 11:08 AM, Florian Lindner wrote: Hello, I have an array of shape (n, 2) from which I want to extract a random sample of 20% of rows. The choosen samples should be remo

Re: [Numpy-discussion] Remove a random sample from array

2016-05-16 Thread Florian Lindner
Am Montag, 16. Mai 2016, 10:01:38 CEST schrieb Elliot Hallmark: > What do you mean remove them from the array? Replace with zero or NaN? Removed like when 10 samples are taken from a (100, 2) array it becomes a (90, 2) array. Copying the array is no problem, it removing inplace is not possible.

Re: [Numpy-discussion] Remove a random sample from array

2016-05-16 Thread Elliot Hallmark
What do you mean remove them from the array? Replace with zero or NaN? On May 16, 2016 9:08 AM, "Florian Lindner" wrote: > Hello, > > I have an array of shape (n, 2) from which I want to extract a random > sample > of 20% of rows. The choosen samples should be removed the original array > and > m

[Numpy-discussion] Remove a random sample from array

2016-05-16 Thread Florian Lindner
Hello, I have an array of shape (n, 2) from which I want to extract a random sample of 20% of rows. The choosen samples should be removed the original array and moved to a new array of the same shape (n, 2). What is the most clever way to do with numpy? Thanks, Florian