purijatin commented on a change in pull request #29482:
URL: https://github.com/apache/spark/pull/29482#discussion_r474145796



##########
File path: 
mllib/src/main/scala/org/apache/spark/ml/feature/CountVectorizer.scala
##########
@@ -241,7 +241,9 @@ class CountVectorizer @Since("1.5.0") (@Since("1.5.0") 
override val uid: String)
     }
     wordCounts.unpersist()
 
-    require(vocab.length > 0, "The vocabulary size should be > 0. Lower minDF 
as necessary.")
+    if (vocab.isEmpty) {
+      this.logWarning("The vocabulary size is empty. Alter minDF/maxDF as 
necessary.")

Review comment:
       Shouldn't it be `minDF` instead of `minTF`?
   
   As per 
[this](https://github.com/apache/spark/blob/f73ca919251f9c054671ddbf3fecb8f005d66836/mllib/src/main/scala/org/apache/spark/ml/feature/CountVectorizer.scala#L119),
 minTF is only used in transform and not fitting. `minDF` and `maxDF` are used 
to filter out words in vocabulary during fitting.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to