[
https://issues.apache.org/jira/browse/MAHOUT-550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12934244#action_12934244
]
Lance Norskog commented on MAHOUT-550:
--------------------------------------
Some comments:
bq. OperationNotSupportedException is not a good idea. If you need to use a
pre-existing exception like this, try UnsupportedOperationException from
java.lang. Picking a random exception out of javax.timing is just confusing.
I misread my autocomplete class hints.
bq.I think that an enum would be better for LINEAR, GAUSSIAN, GAUSSIAN01. For
most applications of random matrices, unit normal distributions are all that is
needed.
I don't know how to do enums- I'm a Java 9, not a 10. I'll look it up.
bq. I don't think that it is worth the memory to keep the cache matrix around.
Instead, like() should construct a matrix and you should forget caching.
The caching might be interesting in the case of large sparse matrices using
Gaussian. Gaussian is several times slower than linear. For a DenseVector,
you're right.
bq. The implementation of gaussian01 is probably incorrect since the result
does not have zero mean. Using nextGaussian() is better anyway.
My use case calculates distances between N-dimensional "points" of random
numbers. The space is normal distribution from 0->1. nextGaussian() generates
points outward to MAX_DOUBLE, so I have to clip it. gaussian01 generates a
normal distribution from 0 to 1.
( In RandomVector I switched to dividing the Gaussian and skipping past
out-of-bounds values; I'll switch to that here. It's much faster also.)
bq. You shouldn't need to over-ride any math from AbstractMatrix.
I first did like() as OperationNotSupported. This means I had to rewrite a lot.
These overrides will mostly disappear: I don't remember if I need all of them.
bq. It looks like a lot of your tests are copied from the standard matrix test
case. Why not just inherit?
Again, I went through an evolution in implementing read-only, and these ended
up dups.
Since these comments are all about improvements, I'm assuming the concept is
sound. Thanks for your time!
> Add RandomVector and RandomMatrix
> ---------------------------------
>
> Key: MAHOUT-550
> URL: https://issues.apache.org/jira/browse/MAHOUT-550
> Project: Mahout
> Issue Type: New Feature
> Components: Math
> Reporter: Lance Norskog
> Fix For: 0.5
>
> Attachments: RandomMatrix.patch
>
>
> Add Vector and Matrix implementations that generate a unique and reproducible
> random number for each index.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.