Skip to content

Commit 5eb9100

Browse files
committed
Added setMinCount to Word2Vec.scala
Wanted to customize the minCount variable in the Word2Vec class. Added a method to do so.
1 parent 2a2983f commit 5eb9100

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

mllib/src/main/scala/org/apache/spark/mllib/feature/Word2Vec.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,13 @@ class Word2Vec extends Serializable with Logging {
122122
/** context words from [-window, window] */
123123
private val window = 5
124124

125-
/** minimum frequency to consider a vocabulary word */
126-
private val minCount = 5
125+
/** minimum frequency to consider a vocabulary word */
126+
private var minCount = 5
127+
128+
def setMinCount(minCount: Int): this.type = {
129+
this.minCount = minCount
130+
this
131+
}
127132

128133
private var trainWordsCount = 0
129134
private var vocabSize = 0

0 commit comments

Comments
 (0)