code: def test_ebm_sweep():
      data = synthetic_regression()
      X = data["full"]["X"]
      y = data["full"]["y"]
  
      clf = ExplainableBoostingRegressor(interactions=[(1, 2), (1, 3)])
      clf.fit(X, y)
  
      clf.term_scores_[0].fill(0)  # set 'A' to zero
      clf.term_scores_[len(clf.term_scores_) - 1].fill(
          0
      )  # set 'B & D' to zero
  
      # the synthetic dataset is random and if no progress is made
      # during boosting it can have zeros, so force to non-zero
      clf.term_scores_[1][1] = 99.0
      clf.term_scores_[2][1] = 99.0
      clf.term_scores_[3][1] = 99.0
      clf.term_scores_[4][1, 1] = 99.0
  
      clf.sweep(terms=True, bins=True, features=True)
  
      # check that sweeping the features removed feature 'A' which was not used in a term
      assert clf.feature_names_in_ == ["B", "C", "D"]
      assert len(clf.histogram_edges_) == 3
      assert len(clf.histogram_weights_) == 3
      assert len(clf.unique_val_counts_) == 3
      assert len(clf.bins_) == 3
      assert len(clf.feature_names_in_) == 3
      assert len(clf.feature_types_in_) == 3
      assert clf.feature_bounds_.shape[0] == 3
      assert clf.n_features_in_ == 3
  
      # check that sweeping the bins deleted the pair bins in D
      assert len(clf.bins_[0]) == 2  # feature 'B'
      assert len(clf.bins_[1]) == 2  # feature 'C'
      assert len(clf.bins_[2]) == 1  # feature 'D'
  
      # check that sweeping the terms removed the zeroed terms
      assert clf.term_names_ == ["B", "C", "D", "B & C"]
      assert len(clf.term_features_) == 4
      assert len(clf.term_scores_) == 4
      assert len(clf.bagged_scores_) == 4
      assert len(clf.bagged_intercept_) == len(clf.bagged_scores_[0])
      assert len(clf.standard_deviations_) == 4
      assert len(clf.bin_weights_) == 4
  
imports: import math
  from sklearn.metrics import log_loss
  from interpret.utils import make_synthetic
  from ...tutils import synthetic_multiclass, synthetic_classification, iris_classification, smoke_test_explanations
  from ...tutils import synthetic_regression
  from interpret.glassbox import ExplainableBoostingRegressor, ExplainableBoostingClassifier
  from interpret.privacy import DPExplainableBoostingClassifier, DPExplainableBoostingRegressor
  from interpret.utils import inv_link
  from io import StringIO
  import json
  import numpy
  import pandas
  from sklearn.model_selection import train_test_split
  from sklearn.metrics import accuracy_score
  from sklearn.utils.estimator_checks import check_estimator
  import pytest
  import warnings
label_desc: Use image node_id 8 for calling a global function with example usage: test_ebm_sweep() without return types