Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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
You can’t perform that action at this time.