Closed wowinter13 closed 7 years ago
In the python example I see numpy as the distribution gem equivalent. Something like pandas would be the Daru equivalent.
Daru::Vector
supports array or range arguments to new
for easy creation. I would think if the distribution gem provided an easy way (alias/shortcut) of creating the distribution in the as an array it might significantly simplify vector creation. E.g. Daru::Vector.new(Distribution::Normal.rng(mu, sigma).take(1000))
. Don't know if it does something like this already. This might make it easier to use in general rather than the specific context of Daru::Vector
. It might be a good addition to the distribution gem.
Purely as a user of Daru
, IMHO Daru
should do DataFrame
and Vector
really really well and iron out any wrinkles before looking into tighter integration with other gems. Perhaps, the core team can comment.
TBH, I don't see any value in bundling. It is how proper Ruby gems work: they solve one task, and solve it well (or die trying). We are not building some "framework for everything" here. You almost can make your code simpler this way:
rng = Distribution::Normal.rng(mu, sigma)
Daru::Vector.new_with_size 1000, &rng
...except for the fact Daru expects block to accept 1 argument. This syntax working should be a reasonable improvement request ;) But probably even to Distribution gem, not Daru, because in my head, this should work too, without any Daru:
Array.new(100, &rng)
...but it does not.
Okay, thank you, guys!
I will rethink how to fix &rng
& other methods of normalization in Distribution and PR solution in the near future.
Actually if one needs only the Normal distribution and sees the whole bunch of other implementations as overhead why not to extract the code and build a targeted normal_distribution
gem? That's the solution which makes things simpler in my view of this world :)
I think it's the way to build interoperable software packages and if it's required we can always build a meta-gem which combines everything and installs everything.
Doesn't make sense to bundle distribution with daru. Close this issue?
Yea, close this issue.
In Python we can easily create vectors with normal distribution in one string using numpy:
While in Ruby we should use Distribution gem:
Distribution gem contains a lot of ways for normalization. And it's a little overhead to include it if we just want to use basic functionality. Because normal Gaussian distribution is often used as a basic function for a lot of statistic and ML tasks, I think it will be a useful idea to add some interface to work with the most popular distribution (as fact, it's a normal distr) and make it work in the way like this:
Correct me if that issue is more suitable to Distribution gem rather Daru. Or maybe we just can make this syntax less complex.
I can realize it if community will thumb up this idea!