code: def test_explain_hashing_vectorizer(newsgroups_train_binary):
      # test that we can pass InvertableHashingVectorizer explicitly
      vec = HashingVectorizer(n_features=1000)
      ivec = InvertableHashingVectorizer(vec)
      clf = LogisticRegression(random_state=42)
      docs, y, target_names = newsgroups_train_binary
      ivec.fit([docs[0]])
      X = vec.fit_transform(docs)
      clf.fit(X, y)
  
      get_res = lambda **kwargs: explain_prediction(
          clf,
          docs[0],
          vec=ivec,
          target_names=target_names,
          top=20,
          **kwargs,
      )
      res = get_res()
      check_explain_linear_binary(res, clf)
      assert res == get_res()
      res_vectorized = explain_prediction(
          clf,
          vec.transform([docs[0]])[0],
          vec=ivec,
          target_names=target_names,
          top=20,
          vectorized=True,
      )
      pprint(res_vectorized)
      assert res_vectorized == _without_weighted_spans(res)
  
      assert res == get_res(
          feature_names=ivec.get_feature_names(always_signed=False)
      )
  
imports: from __future__ import absolute_import
  from pprint import pprint
  import attr
  import pytest
  from sklearn.base import BaseEstimator
  from sklearn.feature_extraction import DictVectorizer
  from sklearn.feature_extraction.text import CountVectorizer, HashingVectorizer
  from sklearn.linear_model import LinearRegression
  from sklearn.linear_model import LogisticRegression
  from sklearn.pipeline import FeatureUnion
  from eli5 import explain_prediction, explain_weights
  from eli5.formatters import format_as_html
  from eli5.sklearn import invert_hashing_and_fit, InvertableHashingVectorizer
  from .utils import format_as_all, get_all_features, get_names_coefs, write_html
label_desc: Use image node_id 3 for calling a global function with example usage: test_explain_hashing_vectorizer(newsgroups_train_binary) without return types