@@ -0,0 +1,1125 @@
+import sklearn%0Aimport numpy as np%0Aimport shap%0A%0Adef test_sklearn_interaction():%0A    from sklearn.model_selection import train_test_split%0A    from sklearn.ensemble import RandomForestClassifier%0A    X,y = shap.datasets.iris()%0A    X_train,X_test,Y_train,Y_test = train_test_split(*shap.datasets.iris(), test_size=0.2, random_state=0)%0A    rforest = RandomForestClassifier(n_estimators=100, max_depth=None, min_samples_split=2, random_state=0)%0A    model = rforest.fit(X_train, Y_train)%0A    interaction_vals = shap.TreeExplainer(model).shap_interaction_values(X)%0A    for i in range(len(interaction_vals)):%0A        for j in range(len(interaction_vals%5Bi%5D)):%0A            for k in range(len(interaction_vals%5Bi%5D%5Bj%5D)):%0A                for l in range(len(interaction_vals%5Bi%5D%5Bj%5D%5Bk%5D)):%0A                    assert abs(interaction_vals%5Bi%5D%5Bj%5D%5Bk%5D%5Bl%5D-interaction_vals%5Bi%5D%5Bj%5D%5Bl%5D%5Bk%5D)%3C0.0000001%0A            if j%3Clen(interaction_vals%5Bi%5D)-1:%0A                assert abs(interaction_vals%5Bi%5D%5Bj%5D%5Blen(interaction_vals%5Bi%5D%5Bj%5D)-1%5D%5Blen(interaction_vals%5Bi%5D%5Bj%5D)-1%5D-interaction_vals%5Bi%5D%5Bj+1%5D%5Blen(interaction_vals%5Bi%5D%5Bj%5D)-1%5D%5Blen(interaction_vals%5Bi%5D%5Bj%5D)-1%5D)%3C0.0000001%0A

add test for sklearn interaction calculations