Skip to content

skrub/string-encoder-hashing-vocabulary

Pack Severity Fix Versions
skrub error none, edit by hand All versions

StringEncoder(vectorizer="hashing") uses scikit-learn's stateless HashingVectorizer, so passing a non-None vocabulary raises ValueError during fit.

enc = StringEncoder(vectorizer="hashing", vocabulary=["abc", "def"])
enc = StringEncoder(vectorizer="tfidf", vocabulary=["abc", "def"])

Calls to StringEncoder that set vectorizer="hashing" together with a non-None vocabulary argument.

Use vectorizer="tfidf" (the default) when supplying a fixed vocabulary, or omit vocabulary when using vectorizer="hashing".

StringEncoder with vectorizer='hashing' does not support a custom vocabulary and raises ValueError at fit time. Use vectorizer='tfidf' or drop vocabulary=.

See all rules in the skrub pack.