Skip to content

Instantly share code, notes, and snippets.

@bobye
Last active August 29, 2015 14:18
Show Gist options
  • Save bobye/310e264777a6e7c00119 to your computer and use it in GitHub Desktop.
Save bobye/310e264777a6e7c00119 to your computer and use it in GitHub Desktop.
post_evaluate.matlab
% select img_id,artist_id from images into outfile '/tmp/art_wiki_img2artist.csv';
% select task_id,artist_id from tasks into outfile '/tmp/art_wiki_task2artist.csv';
% select usr_id,task_id,chosen from events where usr_id ='admin' into outfile '/tmp/art_wiki_admin.csv' ;
t2a=load('art_wiki_task2artist.csv');
i2a=load('art_wiki_img2artist.csv');
username={'admin', 'fei', 'chenl', 'yukun', 'xinlu'};
correctness=zeros(500,length(username));
for i=1:length(username)
f=fopen(['art_wiki_' username{i} '.csv'], 'r+');
count=0;
while ~feof(f)
un=fscanf(f, '%s', 1);
if strcmp(un, username{i})==0
break;
end
taskid=fscanf(f, '%d', 1);
arr_imgs_str=fscanf(f, '%s', 1);
arr_imgs=strsplit(arr_imgs_str(2:(end-1)), ',');
img1=str2num(arr_imgs{1});
img2=str2num(arr_imgs{2});
count = count + 1;
if (i2a(img1,2) == t2a(taskid,2)) && (i2a(img2,2) == t2a(taskid,2))
correctness(count,i) = 1;
else
correctness(count,i) = 0;
end
end
fclose(f);
sum(correctness(:,i))/count
end
dlmwrite('consist_cases.csv', find(sum(correctness,2 )>= 4))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment