Use feature legend in the commit classifier

This commit is contained in:
Marco Castelluccio 2019-07-23 12:09:28 +02:00
Родитель e66eab0ccf
Коммит 3e7c2016cd
1 изменённых файлов: 1 добавлений и 3 удалений

Просмотреть файл

@ -107,8 +107,6 @@ class CommitClassifier(object):
commits[-1], probabilities=True, importances=True commits[-1], probabilities=True, importances=True
) )
feature_names = self.model.get_human_readable_feature_names()
features = [] features = []
for i, (val, feature_index, is_positive) in enumerate( for i, (val, feature_index, is_positive) in enumerate(
importance["importances"]["classes"][1][0] importance["importances"]["classes"][1][0]
@ -116,7 +114,7 @@ class CommitClassifier(object):
features.append( features.append(
[ [
i + 1, i + 1,
feature_names[int(feature_index)], importance["feature_legend"][str(i + 1)],
f'({"+" if (is_positive) else "-"}{val})', f'({"+" if (is_positive) else "-"}{val})',
] ]
) )