mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
ensure continued operation despite not being able to plot
This commit is contained in:
parent
2c23effbf2
commit
68f7a31504
|
@ -156,6 +156,8 @@ def plot_feature_importance(model: Any, pair: str, dk: FreqaiDataKitchen,
|
||||||
if 'FreqaiMultiOutputRegressor' in str(model.__class__):
|
if 'FreqaiMultiOutputRegressor' in str(model.__class__):
|
||||||
for estimator, label in zip(model.estimators_, dk.label_list):
|
for estimator, label in zip(model.estimators_, dk.label_list):
|
||||||
models[label] = estimator
|
models[label] = estimator
|
||||||
|
else:
|
||||||
|
models[dk.label_list[0]]
|
||||||
|
|
||||||
for label in models:
|
for label in models:
|
||||||
mdl = models[label]
|
mdl = models[label]
|
||||||
|
@ -164,8 +166,8 @@ def plot_feature_importance(model: Any, pair: str, dk: FreqaiDataKitchen,
|
||||||
elif "lightgbm.sklearn" or "xgb" in str(mdl.__class__):
|
elif "lightgbm.sklearn" or "xgb" in str(mdl.__class__):
|
||||||
feature_importance = mdl.feature_importances_
|
feature_importance = mdl.feature_importances_
|
||||||
else:
|
else:
|
||||||
# TODO: Add support for more libraries
|
logger.info('Model type not support for generating feature importances.')
|
||||||
raise NotImplementedError(f"Cannot extract feature importance from {mdl.__class__}")
|
return
|
||||||
|
|
||||||
# Data preparation
|
# Data preparation
|
||||||
fi_df = pd.DataFrame({
|
fi_df = pd.DataFrame({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user