Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/17263#discussion_r105552188
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/feature/Word2Vec.scala ---
@@ -581,22 +581,23 @@ class Word2VecModel private[spark] (
blas.sgemv(
"T", vectorSize, numWords, alpha, wordVectors, vectorSize, fVector,
1, beta, cosineVec, 1)
- val cosVec = cosineVec.map(_.toDouble)
- var ind = 0
- while (ind < numWords) {
- val norm = wordVecNorms(ind)
+ var i = 0
+ while (i < numWords) {
+ val norm = wordVecNorms(i)
if (norm == 0.0) {
- cosVec(ind) = 0.0
+ cosineVec(i) = 0
--- End diff --
I'd still write 0.0f for clarity but it's no big deal. I guess we can write
`norm == 0.0f` too
---
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]