Skip to content

Instantly share code, notes, and snippets.

@frogermcs
Last active May 28, 2019 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frogermcs/46d3839d2aba7fe7b4af1f627dfd8756 to your computer and use it in GitHub Desktop.
Save frogermcs/46d3839d2aba7fe7b4af1f627dfd8756 to your computer and use it in GitHub Desktop.
# Concatenate results from all models
all_models_dataframe = pd.concat([tf_pred_dataframe,
tflite_pred_dataframe,
tflite_q_pred_dataframe],
keys=['TF Model', 'TFLite', 'TFLite quantized'],
axis='columns')
# Swap columns to hava side by side comparison
all_models_dataframe = all_models_dataframe.swaplevel(axis='columns')[tflite_pred_dataframe.columns]
# Highlight TFLite models predictions that are different from original model
def highlight_diff(data, color='yellow'):
attr = 'background-color: {}'.format(color)
other = data.xs('TF Model', axis='columns', level=-1)
return pd.DataFrame(np.where(data.ne(other, level=0), attr, ''),
index=data.index, columns=data.columns)
all_models_dataframe.style.apply(highlight_diff, axis=None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment