Hi William,
Yes, that's my feeling as well. I'm working with PDL and recently with
PDL::CCS for my AI::MXNet module for a year now and still feel very much as
a beginner. There's just so much in there.
One curious example. I needed to shuffle pdl via last dimension for my
iterator (batch dimension).
First version was cat(List::Utill::shuffle(dog($pdl))), second one just
looping via the last dimension and using $copy->slice .= $pdl->slice, and
finally I stumbled upon $pdl->dice_axis(-1, pdl(\@shuffled_indices))
All over the course of year and continuously trying to improve the
performance.
I feel like you almost need to be a PDL dev and know it from inside to use
it well :-)
Glad to be of help.
Thanks.
On Sun, Apr 8, 2018 at 12:54 PM, William Schmidt <
[email protected]> wrote:
> Sergey,
>
> Much obliged. Very good suggestion. Math::Random and
> Math::Random::Discrete have very rich sets of methods, and quite intuitive
> to use. Pure PDL tools may be overkill for me since at this point my work
> only uses 1-dimensional vectors. If or when I move up to multivariate sets
> then I think PDL is boss... or R. I will experiment with pure PDL stuff as
> I learn more about what it can do and may wind up building data sets with
> those Math:: packages and then assign the arrays to piddles for additional
> munging, analysis and plotting. Just a note: finding the right PDL POD to
> read for the task at hand can be challenging, at least for a PDL beginner.
> The PDL Book blows one away but leaves beginners in the dust. A tutorial
> that starts with the basics, something like Cotton's *Learning R*, and
> builds up from there would be more useful. One probably exists but as yet I
> haven't found it. I think the PDL Book attempts too hard to impress, and it
> does, but it is not very illuminating.
>
> Thanks again and regards,
> Will
>
>
>
>
> On Sat, Apr 7, 2018 at 10:33 PM, Sergey Kolychev <
> [email protected]> wrote:
>
>> Hi Will,
>> I don't know solve the task via PDL, but in the past I used this
>> http://search.cpan.org/~nwellnhof/Math-Random-Discrete-
>> 1.01/lib/Math/Random/Discrete.pm#rand to get a random weighed sample.
>> Thanks.
>>
>>
>> On Fri, Apr 6, 2018, 16:16 William Schmidt <[email protected]>
>> wrote:
>>
>>> Hello Piddlers,
>>>
>>> I am moving from R to PDL, with tons of experience with Perl, lots with
>>> R but zero with PDL,
>>> so this is a pretty basic question. I can see from the PDL Book that PDL
>>> is very
>>> sophisticated, with much more functionality than I will ever use, but I
>>> want
>>> to master basic PDL to leverage my Perl. My focus is on probability in
>>> two dimensions so
>>> I will be working mostly with 1-dimensional vectors. Here is an example
>>> from R that
>>> I would like to learn how to do in PDL. It is a small example but once I
>>> master
>>> the construction of this data I will extend it to much larger vectors.
>>>
>>> Suppose I have random variable X whose values and probabilities are as
>>> follows:
>>>
>>> *x* *p(x)*
>>> 0 1/8
>>> 1 3/8
>>> 2 3/8
>>> 3 1/8
>>>
>>> To get a sample of 50 random values drawn from this population with
>>> replacement in R I
>>> would say:
>>>
>>> x <- seq.int(0,3) # Concatenate a sequence of ints from 0 to 3.
>>> x # print x.
>>> [1] 0 1 2 3
>>>
>>> weights <- c(1/8, 3/8, 3/8, 1/8) # Another form of concatenation.
>>> weights
>>> [1] 0.125 0.375 0.375 0.125
>>>
>>> s <- sample(x, 50, replace=TRUE, prob=weights)
>>> s
>>> [1] 0 1 1 3 2 2 2 3 2 0 0 1 3 1 1 3 0 2 1 2 2 1 3 1 2 2 0 2 2 2 3 2
>>> [33] 1 1 3 1 2 2 1 1 0 1 3 2 2 1 3 0 1 1
>>>
>>> I can now manipulate *s*, calculate its statistical properties and
>>> graph its probability distribution. Fifty integer values is not very
>>> interesting but the problems I am studying have thousands of values and
>>> very different weights. How do I do this in PDL? I have PDL::Stats::Basic
>>> and PDL::Stats::Distr installed along with PGPLOT but it's generating this
>>> basic data that has me stumped.
>>>
>>> Thanks and regards,
>>>
>>> Will Schmidt
>>> [email protected]
>>>
>>>
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot______
>>> _________________________________________
>>> pdl-general mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/pdl-general
>>>
>>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general