Catwalk breaks when feature importance contains nan
- Dominant language
- Jupyter Notebook
- Stars
- 201
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
_From @hakoenig on August 15, 2017 21:27_
Adaboost can get overflow errors leading to nan's in feature importances. When that happens, catwalk breaks when we call int(rank_abs) with error: _cannot convert float nan to integer_.
Source: function __write_model_to_db_ in https://github.com/dssg/catwalk/blob/master/catwalk/model_trainers.py
```
...
for feature_index, importance, rank_abs, rank_pct in zip(
features_index,
feature_importance,
rankings_abs,
rankings_pct):
feature_importance = FeatureImportance(
model=model,
feature_importance=round(float(importance), 10),
feature=feature_names[feature_index],
rank_abs=int(rank_abs),
rank_pct=round(float(rank_pct), 10)
)
```
_Copied from original issue: dssg/catwalk#11_
Contributor guide
Research direction
Start in catwalk/model_trainers.py at __write_model_to_db__, where feature importances are converted into FeatureImportance records. Reproduce the AdaBoost case with NaN feature importances and trace the ranking values through the loop. Done means Catwalk no longer raises the float-NaN-to-integer error when writing the model.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100