GitHub user dbtsai opened a pull request:
https://github.com/apache/spark/pull/3435
[SPARK-4581][MLlib] Refactorize StandardScaler to improve the
transformation performance
The following optimizations are done to improve the StandardScaler model
transformation performance.
1) Covert Breeze dense vector to primitive vector to reduce the overhead.
2) Since mean can be potentially a sparse vector, we explicitly convert it
to dense primitive vector.
3) Have a local reference to `shift` and `factor` array so JVM can locate
the value with one operation call.
4) In pattern matching part, we use the mllib SparseVector/DenseVector
instead of breeze's vector to
make the codebase cleaner.
Benchmark with mnist8m dataset:
Before,
DenseVector withMean and withStd: 50.97secs
DenseVector withMean and withoutStd: 42.11secs
DenseVector withoutMean and withStd: 8.75secs
SparseVector withoutMean and withStd: 5.437
With this PR,
DenseVector withMean and withStd: 5.76secs
DenseVector withMean and withoutStd: 5.28secs
DenseVector withoutMean and withStd: 5.30secs
SparseVector withoutMean and withStd: 1.27
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/AlpineNow/spark standardscaler
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/3435.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #3435
----
commit 5bffd3d29ba0c601e91cfb0818b35eed1c8230ff
Author: DB Tsai <[email protected]>
Date: 2014-11-24T23:45:04Z
first commit
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]