code: def test_explain_linear_dense():
      clf = LogisticRegression(random_state=42)
      data = [
          {"day": "mon", "moon": "full"},
          {"day": "tue", "moon": "rising"},
          {"day": "tue", "moon": "rising"},
          {"day": "mon", "moon": "rising"},
      ]
      vec = DictVectorizer(sparse=False)
      X = vec.fit_transform(data)
      clf.fit(X, [0, 1, 1, 0])
      test_day = {"day": "tue", "moon": "full"}
      target_names = ["sunny", "shady"]
      res1 = explain_prediction(
          clf, test_day, vec=vec, target_names=target_names
      )
      expl_text, expl_html = format_as_all(res1, clf)
      assert "day=tue" in expl_text
      assert "day=tue" in expl_html
      [test_day_vec] = vec.transform(test_day)
      res2 = explain_prediction(
          clf,
          test_day_vec,
          target_names=target_names,
          vectorized=True,
          feature_names=vec.get_feature_names(),
      )
      assert res1 == res2
  
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 5 for calling a global function with example usage: test_explain_linear_dense() without return types