Corrected a bug, improved analysis

This commit is contained in:
Thomas FORGIONE 2015-10-09 09:34:27 +02:00
parent e28145c366
commit 7576b6ca05
6 changed files with 136 additions and 8 deletions

View File

@ -174,9 +174,28 @@ Lib.numberOfInteraction = function(exp) {
}
}
return i;
};
Lib.durationBetweenCoins = function(exp) {
var ret = [];
var events = exp.elements.events;
var lastTime = events[0].time;
var ids = [];
for (var i = 0; i < events.length; i++) {
var event = events[i];
if (event.type === 'coin') {
if (ids.indexOf(event.id) === -1) {
ids.push(event.id);
ret.push(Lib.timeDifference(lastTime, event.time));
lastTime = event.time;
}
}
}
return ret;
};

View File

@ -1,7 +1,16 @@
var;
timecoins;
plot(X,Y1);
hold on;
plot(X, Y2, 'red');
hold on;
plot(X, Y3, 'green');
legend('Without recommendation', 'Worst with recommendation', 'Best with recommendation');
names = who('Y*');
N = size(names, 1);
for i = 1:N,
name = names(i)
name = name{1};
plot(X, eval(name));
pause
clf
end
close all;

8
analysis/matlab/table.m Normal file
View File

@ -0,0 +1,8 @@
X = [ 0 1 2 3 4 5 6 7 ];
Y1 = [ 770 368 277 180 361 189 137 198 ];
Y2 = [ 444 224 437 214 345 159 201 114 ];
Y3 = [ 427 168 437 137 345 127 64 114 ];

View File

@ -0,0 +1,44 @@
X = [ 0 1 2 3 4 5 6 7 ];
Y1 = [ 3068 9946 3634 4027 9753 11505 6507 93235 ];
Y2 = [ 2789 11895 10008 4944 23040 25736 90313 30974 ];
Y3 = [ 6414 11518 4577 26118 8629 18662 77239 39086 ];
Y4 = [ 7070 4095 9949 5162 4389 52880 53789 3704 ];
Y5 = [ 8288 1973 3047 5335 28975 11402 1323 29225 ];
Y6 = [ 4512 2627 11536 9231 1770 6568 1559 71200 ];
Y7 = [ 7277 25015 9905 5433 7887 4711 2827 19877 ];
Y8 = [ 8197 16319 7969 5113 4970 143998 114894 5803 ];
Y9 = [ 44253 1303 718 544 772 22305 574 925 ];
Y10 = [ 39705 703 603 12045 61187 2950 2333 Inf ];
Y11 = [ 12821 5736 4465 29048 1369 3951 35108 25275 ];
Y12 = [ 95786 3499 5134 1272 1068 1031 917 897 ];
Y13 = [ 2066 10052 22932 1413 8777 20339 46760 54828 ];
Y14 = [ 10480 2647 2386 10853 4771 5069 7630 16776 ];
Y15 = [ 7528 10848 2836 16234 13345 14158 20331 5378 ];
Y16 = [ 5106 1355 6797 3039 21677 14987 27681 3628 ];
Y17 = [ 8655 3581 7869 7049 10186 7133 2617 Inf ];
Y18 = [ 3617 1516 8342 4511 1490 1748 6360 7718 ];
Y19 = [ 8890 1567 5736 10528 4161 1554 11644 78341 ];
Y20 = [ 4755 4872 2905 4616 4898 2549 26217 2158 ];
Y21 = [ 6185 14015 5533 7327 1237 7990 6032 38959 ];

View File

@ -0,0 +1,47 @@
// Shows with and without : time to last coin = f(CoinCombination)
var lib = require('./lib.js');
function main(path) {
var db = lib.loadFromFile(path);
var groups = lib.makeGroups(db);
// Erase groups that are not usable
groups = groups.filter(function(elt) {
// An elt is valid if it contains at least 2 exp, BaseRecommendation included
return elt.length > 1 && elt.find(function(e) { return e.recommendation_style[4] === 'B'; }) !== undefined;
});
console.log(lib.toMatlabArray('X', lib.range(0,8)));
var counter = 0;
groups.forEach(function(elt) {
elt.sort(lib.compareRecommendationStyle);
elt.forEach(function(elt) {
elt.durationBetweenCoins = lib.durationBetweenCoins(elt);
console.log(lib.toMatlabArray('Y' + (++counter), lib.range(0,8, function(i) {
var ret = elt.durationBetweenCoins[i];
if (ret === undefined)
ret = 'Inf';
return ret;
})));
});
});
}
if (process.argv.length !== 3) {
process.stderr.write('Error : please give me a JSON file to work on\n');
process.exit(-1);
}
main(process.argv[2]);

View File

@ -697,6 +697,7 @@ DBReq.ExpCreator.prototype.execute = function() {
" Scene.name != 'peachcastle' AND\n" +
" CoinCombination.id = Experiment.coin_combination_id AND\n" +
" Other.id = Experiment.user_id AND\n" +
" Other.valid IS false AND\n" +
" Experiment.finished = true AND\n" +
" Other.rating = U.rating AND\n" +
" Other.id != U.id AND\n" +