dssg / dssg/triage

Catwalk breaks when feature importance contains nan

Open
#291 0 comments 0 reactions 0 assignees View on GitHub
trivial
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.