code: def test_demo_blackbox_explainer():
      from interpret.ext.blackbox import ExampleBlackboxExplainer
      from interpret.ext.greybox import ExampleGreyboxExplainer
      from interpret.ext.glassbox import ExampleGlassboxExplainer
      from interpret.ext.data import ExampleDataExplainer
      from interpret.ext.perf import ExamplePerfExplainer
  
      data = synthetic_classification()
      blackbox = LogisticRegression()
      blackbox.fit(data["train"]["X"], data["train"]["y"])
      predict_fn = lambda x: blackbox.predict_proba(x)  # noqa: E731
  
      explainer = ExampleBlackboxExplainer(
          predict_fn, data["train"]["X"]
      )
      explanation = explainer.explain_local(
          data["test"]["X"].head(), data["test"]["y"].head()
      )
      assert_valid_explanation(explanation)
  
      explainer = ExampleGreyboxExplainer(blackbox, data["train"]["X"])
      explanation = explainer.explain_local(
          data["test"]["X"].head(), data["test"]["y"].head()
      )
      assert_valid_explanation(explanation)
  
      explainer = ExampleGlassboxExplainer()
      explainer.fit(data["train"]["X"], data["train"]["y"])
      explainer.predict(data["test"]["X"].head())
      explanation = explainer.explain_local(
          data["test"]["X"].head(), data["test"]["y"].head()
      )
      assert_valid_explanation(explanation)
  
      explainer = ExampleDataExplainer()
      explanation = explainer.explain_data(
          data["test"]["X"].head(), data["test"]["y"].head()
      )
      assert_valid_explanation(explanation)
  
      explainer = ExamplePerfExplainer(predict_fn)
      explanation = explainer.explain_perf(
          data["test"]["X"].head(), data["test"]["y"].head()
      )
      assert_valid_explanation(explanation)
  
imports: from six import raise_from
  from .tutils import assert_valid_explanation
  from .tutils import synthetic_classification
  from interpret.glassbox import LogisticRegression
label_desc: Use image node_id 2 for calling a global function with example usage: test_demo_blackbox_explainer() without return types