Closed Alex-Wenner-FHR closed 1 year ago
Was Able to solve this with a snippit of Autogluon code that wraps their predictor ... See below:
class AutogluonWrapper:
def __init__(self, predictor, feature_names, target_class=None):
self.ag_model = predictor
self.feature_names = feature_names
self.target_class = target_class
def predict_proba(self, X):
if isinstance(X, pd.Series):
X = X.values.reshape(1,-1)
if not isinstance(X, pd.DataFrame):
X = pd.DataFrame(X, columns=self.feature_names)
preds = self.ag_model.predict_proba(X)
if predictor.problem_type == "regression" or self.target_class is None:
return preds
else:
return preds.to_numpy()
This may exist today, but I cannot figure out how to do it.
It appears that lime wants a 1d array as the
data_row
parameter in the.explain_instance
method. However AutoGluon Predictor Fns appear to only support their type ofTabularDataset
or that of apd.DataFrame
.Both AutoGluon & Lime are great packages and it would be awesome if these two projects played nice and were able to be used together. Let me know if I am missing something or if this is supported today and I just am unable to figure it out. Thanks!