Last active
May 28, 2019 06:13
-
-
Save frogermcs/46d3839d2aba7fe7b4af1f627dfd8756 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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