我正试图使用方法as_pyplot_figure()
来绘制石灰报告分类算法,以供LimetabulareExplainer解释。它正在工作,但我正在使用mpld3库中的save_html()
以html格式保存本地数据,该库的压缩程度太高(实际上不可见)。
处理这种情况的任何其他方法都会有所帮助
我的代码目前看起来像
from lime.lime_tabular import LimeTabularExplainer
model= LGBMClassifier(boosting_type='gbdt', class_weight=None,
colsample_bytree=1.0,
importance_type='split', learning_rate=0.1, max_depth=-1,
min_child_samples=20, min_child_weight=0.001, min_split_gain=0.0,
n_estimators=100, n_jobs=-1, num_leaves=31, objective=None,
random_state=None, reg_alpha=0.0, reg_lambda=0.0, silent=True,
subsample=1.0, subsample_for_bin=200000, subsample_freq=0)
predict_function = model.predict
explainer = LimeTabularExplainer(train_data,mode='classification')
exp = explainer.explain_instance(
data, predict_function)
fig = exp.as_pyplot_figure()
mpld3.save_html(fig, lime_report.html)
exp.as_pyplot_figure()
返回pyplot图形(条形图)您应将该pyplot图保存如下-
为了以HTML格式保存LIME解释,解释对象提供了一种方法-
相关问题 更多 >
编程相关推荐