measure_interactions#

interpret.utils.measure_interactions(X, y, interactions=None, init_score=None, sample_weight=None, feature_names=None, feature_types=None, max_interaction_bins=32, min_samples_leaf=2, min_hessian=0.001, reg_alpha=0.0, reg_lambda=0.0, max_delta_step=0.0, objective=None)#

Run the FAST algorithm and return the ranked interactions and their strengths as a dictionary.

Parameters:
  • X – Array of training samples

  • y – Array of training targets

  • interactions – Interactions to evaluate Either a list of tuples of feature indices, or an integer for the max number of pairs returned. None evaluates all pairwise interactions

  • init_score – Either a model that can generate scores or per-sample initialization score. If samples scores it should be the same length as X and y.

  • sample_weight – Optional array of weights per sample. Should be the same length as X and y

  • feature_names – List of feature names

  • feature_types – List of feature types, for example “continuous” or “nominal”

  • max_interaction_bins – Max number of bins per interaction terms

  • min_samples_leaf – Minimum number of samples for tree splits used when calculating gain

  • min_hessian – Minimum hessian required to consider a potential split valid

  • reg_alpha – L1 regularization.

  • reg_lambda – L2 regularization.

  • max_delta_step – Used to limit the max output of tree leaves. <=0.0 means no constraint.

  • objective – None (rmse or log_loss), “rmse” (regression default), “log_loss” (classification default), “poisson_deviance”, “tweedie_deviance:variance_power=1.5”, “gamma_deviance”, “pseudo_huber:delta=1.0”, “rmse_log” (rmse with a log link function)

Returns:

List containing a tuple of feature indices for the terms and interaction strengths,

e.g. [((1, 2), 0.134), ((3, 7), 0.0842)]. Ordered by decreasing interaction strengths.