-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Open
Copy link
Labels
Priority/2-LowTo do after P1To do after P1
Description
Description
Following #458, intepretation models would be buildable from fitter KhiopsClassifier estimator instances, but they would still not be usable solely through the Sklearn API.
The goal of this issue is to make the interpretation usable, by taking loose inspiration from the SHAP library (https://shap.readthedocs.io)'s Explainer class:
- build a
KhiopsIntepreterclass, which would take as parameters:khc: a fittedKhiopsClassifierinstance;- the Khiops interpretation-specific parameters
n_variable_importancesandimportance_ranking;
- upon initialization of an instance,
KhiopsIntepreterwould:- check that
khcis an instance ofKhiopsClassifierand it is fitted (viasklearn.utils.validation.check_is_fitted); - create target Khiops interpretation file path
- call into
api.interpret_predictorby usingkhc.model_andkhc.model_main_dictionary_name_as the first 2 positional parameters, as well as the Khiops interpretation file path. - create, via
api.read_khiops_dictionary_file, aDictionaryDomainfrom the interpretation model built at the previous step; - store the interpretation model
DictionaryDomainas a private attribute of theKhiopsIntepreter;
- check that
- pass a test dataset to the instantiated
KhiopsInterpreterclass:khc = KhiopsClassifier(...) khc.fit(X_train) interpreter = KhiopsInterpreter(khc, n_variable_importances=10, importance_ranking="Local") interpretation = interpreter(X_test) shapley_values = interpretation.values
- the
.valuesis computed by doing a series of processing steps that are similar toKhiopsClassifier.predictsteps, roughly:- convert
X_testto one or several (for muti-table datasets) CSV files; - call
api.deploy_modelusing the interpretationDictionaryDomaincomputed upon theKhiopsInterpreterinstance creation; - convert the resulting CSV files with the Shapley values to a Pandas
DataFrame(or a NuPy array ifX_testis a NumPy array).
- convert
folmos-at-orange
Metadata
Metadata
Assignees
Labels
Priority/2-LowTo do after P1To do after P1