code: def test_invertable_hashing_vectorizer(
      always_signed, binary, alternate_sign
  ):
      n_features = 8
      n_words = 4 * n_features
      kwargs = dict(n_features=n_features, binary=binary)
      if sklearn_version() < "0.19":
          kwargs["non_negative"] = not alternate_sign
      else:
          kwargs["alternate_sign"] = alternate_sign
      vec = HashingVectorizer(**kwargs)
      words = ["word_{}".format(i) for i in range(n_words)]
      corpus = [
          w for i, word in enumerate(words, 1) for w in repeat(word, i)
      ]
      split = len(corpus) // 2
      doc1, doc2 = " ".join(corpus[:split]), " ".join(corpus[split:])
  
      ivec = InvertableHashingVectorizer(vec)
      ivec.fit([doc1, doc2])
      check_feature_names(
          vec, ivec, always_signed, corpus, alternate_sign
      )
  
      ivec = InvertableHashingVectorizer(vec)
      ivec.partial_fit([doc1])
      ivec.partial_fit([doc2])
      check_feature_names(
          vec, ivec, always_signed, corpus, alternate_sign
      )
  
      ivec = InvertableHashingVectorizer(vec)
      for w in corpus:
          ivec.partial_fit([w])
      check_feature_names(
          vec, ivec, always_signed, corpus, alternate_sign
      )
  
file_path: eli5/tests/test_sklearn_unhashing.py
imports: from itertools import repeat
  from collections import Counter
  import pytest
  import numpy
  from sklearn.feature_extraction.text import HashingVectorizer
  from eli5.sklearn.unhashing import InvertableHashingVectorizer
  from eli5.sklearn.utils import sklearn_version
label_desc: Use image node_id 1 for calling a global function with example usage: test_invertable_hashing_vectorizer(always_signed, binary, alternate_sign) without return types