Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Verify that old and new versions of parse_log.py give the same results
function verify_parse_log_equal(filename_old, filename_new)
% Verify that the old and new versions of the caffe parse_log.py output are the same
%% Setup
close all;
%% Read tables and homogenize variable names
t_old = readtable(filename_old, 'FileType', 'text', 'Delimiter', ',');
t_new = readtable(filename_new, 'FileType', 'text', 'Delimiter', ',');
var_old_to_new_map = containers.Map('KeyType', 'char', 'ValueType', 'char');
var_old_to_new_map('TestAccuracy') = 'accuracy';
var_old_to_new_map('TestLoss') = 'loss';
var_old_to_new_map('TrainingLoss') = 'loss';
% Rename variables in old table to match those in new table
key_list = keys(var_old_to_new_map);
for kk = 1:length(key_list)
if ismember(key_list{kk}, t_old.Properties.VariableNames)
t_old.Properties.VariableNames(key_list{kk}) = {var_old_to_new_map(key_list{kk})};
end
end
%% Trim tables to be the same length
min_height = min(height(t_old), height(t_new));
t_old = t_old(1:min_height, :);
t_new = t_new(1:min_height, :);
%% Plot difference
var_names = t_old.Properties.VariableNames;
figure;
for kk = 1:length(var_names)
subplot(2, 2, kk);
histogram(t_new.(var_names{kk}) - t_old.(var_names{kk}));
title(var_names{kk});
xlabel('Error');
end
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment