spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jatin Puri <>
Subject Ability to have CountVectorizerModel vocab as empty
Date Wed, 19 Aug 2020 08:11:16 GMT

This is wrt

require(vocab.length > 0, "The vocabulary size should be > 0. Lower minDF
as necessary.")

Currently, if `CountVectorizer` is trained on an empty dataset results in
the following exception. But it is perfectly valid use case to send it
empty data (or if minDF filters everything).
HashingTF works fine in such scenarios. CountVectorizer doesn't.

Can we remove this constraint? Happy to send a pull-request

java.lang.IllegalArgumentException: requirement failed: The vocabulary
size should be > 0. Lower minDF as necessary.	at
scala.Predef$.require(Predef.scala:224)	at	at	at$$anonfun$fit$2.apply(Pipeline.scala:153)	at$$anonfun$fit$2.apply(Pipeline.scala:149)	at
scala.collection.Iterator$class.foreach(Iterator.scala:891)	at

View raw message