-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-11207][ML] Add test cases for solver selection of LinearRegres… #9180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
11cd9c1
28427d2
f85bca6
22ba64e
f6b2256
2082d47
003d3bd
0a43033
59383fd
888b216
c27a4c3
97c76c9
74de81e
241ec72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,8 +139,9 @@ object LinearDataGenerator { | |
| x.foreach { v => | ||
| var i = 0 | ||
| val len = v.length | ||
| val sparceRnd = new Random(seed) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you seed
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we use same random generator for both creating features and choice which columns to zero, x is different from current ones. This cause unit test failures. Can we change the assertion tolerance or target written in |
||
| while (i < len) { | ||
| if (rnd.nextDouble() <= sparcity) { | ||
| if (sparceRnd.nextDouble() < sparcity) { | ||
| v(i) = 0.0 | ||
| } else { | ||
| v(i) = (v(i) - 0.5) * math.sqrt(12.0 * xVariance(i)) + xMean(i) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once you have
sparsity, randomly choosen = numFeatures * (1 - sparsity)as non-zero features, and zero the rest out.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also add the variance of sparsity such that the num of non zeros will not be constant.