Skip to content

Commit

Permalink
Remove the workaround in confusion matrix component for correctly han…
Browse files Browse the repository at this point in the history
…dling boolean cases. (kubeflow#526)
  • Loading branch information
qimingj authored and k8s-ci-robot committed Dec 12, 2018
1 parent 6d8db6c commit d79a835
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions components/local/confusion_matrix/src/confusion_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ def main(argv=None):
if args.target_lambda:
df['target'] = df.apply(eval(args.target_lambda), axis=1)

# Convert "True" to "True_" and "False" to "False_" for frontend to work.
# TODO: Investigate frontend handling of boolean values.
# https://github.com/kubeflow/pipelines/issues/446
convert_fn = lambda x: str(x) + '_' if str(x).lower() in ['true', 'false'] else x
df['target'] = df['target'].apply(convert_fn)
df['predicted'] = df['predicted'].apply(convert_fn)

vocab = list(df['target'].unique())
cm = confusion_matrix(df['target'], df['predicted'], labels=vocab)
data = []
Expand All @@ -83,7 +76,8 @@ def main(argv=None):
{'name': 'count', 'type': 'NUMBER'},
],
'source': cm_file,
'labels': vocab,
# Convert vocab to string because for bealean values we want "True|False" to match csv data.
'labels': list(map(str, vocab)),
}]
}
with file_io.FileIO('/mlpipeline-ui-metadata.json', 'w') as f:
Expand Down

0 comments on commit d79a835

Please sign in to comment.