interpret icon indicating copy to clipboard operation
interpret copied to clipboard

Using the init_score in EBM Classifier

Open emrynHofmannElephant opened this issue 2 years ago • 1 comments

Hi,

I'm trying to use the init_score parameter to offset a binary classification EBM by a couple of features using another EBM.

EBM_offset -> EBM_main

How should I use the predictions from the EBM_offset to create the init_score for the EBM_main? Currently we're using:

X_train["init_score"] = EBM_offset.predict_proba(X_train)[:,1]

However, we were wondering if this is the right approach? Alternatively we've considered using

preds = EBM_offset.predict_proba(X_train[offset_features])[:,1]
X_train["init_score"] = np.log(preds/(1-preds))

Which is the correct usage? - Or is there a better method to use?

emrynHofmannElephant avatar May 14 '24 14:05 emrynHofmannElephant

The decision_function returns raw scores, so an easy way to do this is:

init_scores = EBM_offset.decision_function(X) probs = EBM_main.predict_proba(X, init_scores)

Or, if you prefer, you can merge the two models. This is more complicated, but there's a related example in: https://interpret.ml/docs/python/examples/custom-interactions.html

paulbkoch avatar May 14 '24 19:05 paulbkoch