-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-10478][ML] Performance, organization, and style improvements for multi-layer perceptron #8648
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
Conversation
|
Test build #42107 has finished for PR 8648 at commit
|
|
Test build #42113 has finished for PR 8648 at commit
|
|
Test build #42121 has finished for PR 8648 at commit
|
|
Test build #42137 has finished for PR 8648 at commit
|
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.
Flatten might be expensive for array of large arrays, is not it?
|
@feynmanliang Thank you for reviewing the code! I made one pass. It seems that UFunc simplifies it a lot. However I am not sure about |
|
@avulanov The benchmarking code is written against a WIP implementation; I sent you a PR for bringing it up to date. LBFGS is taking significantly long time on my machine: I've removed the |
|
Test build #42348 has finished for PR 8648 at commit
|
|
@feynmanliang I suggest using native BLAS for testing. It worth checking the impact of using UFunc as well. |
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.
@feynmanliang Could you run some micro-benchmark on this function? I think this is the only place that might cause performance issues.
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.
@mengxr Local benchmarks here. Performance improves across the board except for (n=100000, k=50)
|
@mengxr added benchmarks, can you make another pass when you have a chance |

UFuncs, vectorized, and broadcasted operationswhileandfor->foreachandmaps,System.arraycopy->++){})Notes to Reviewers
UFuncs simplifiesActivationFunctioncode significantly at the cost of more complicated implementations forcrossEntropy,derivative, etc... I'm not sure if the tradeoff here is worth itSoftmaxFunction.evalsince we add an additional iteration over each column ofx(previously computing exp(x - maxVal) and accumulating a sum were done at the same time whereas now the exp(x - maxVal) computation is done in one loop and the sum is computed after), but I feel that this is acceptable given the significant reduction in complexity. Thoughts?CC @avulanov @mengxr