Skip to content

Commit e0e2ac8

Browse files
author
Whitney O'Meara
committed
Added matlab scripts for plotting benchmark results
1 parent 81085d1 commit e0e2ac8

File tree

8 files changed

+217
-0
lines changed

8 files changed

+217
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
function plotQueryTimes(plotTitle, pointsPerTile, rastFeatQueryTimes, rastCollQueryTimes, rastMinTimes, rastMaxTimes, rastStanDev, vecFeatQueryTimes, vecCollQueryTimes, vecMinTimes, vecMaxTimes, vecStanDev)
2+
for i=1:size(rastCollQueryTimes, 2)
3+
myFig = figure;
4+
semilogx(pointsPerTile, ones(size(pointsPerTile))*rastFeatQueryTimes(i)/1000, 'r--') % feature data - raster
5+
hold on;
6+
semilogx(pointsPerTile, ones(size(pointsPerTile))*vecFeatQueryTimes(i)/1000, 'b--') %feature data - vector
7+
xlim([pointsPerTile(1)*0.8 pointsPerTile(end)*1.2])
8+
9+
text(pointsPerTile(1), rastFeatQueryTimes(i)/1000, sprintf('%.2f', rastFeatQueryTimes(i)/1000))
10+
text(pointsPerTile(1), vecFeatQueryTimes(i)/1000, sprintf('%.2f', vecFeatQueryTimes(i)/1000))
11+
12+
semilogx(pointsPerTile, rastCollQueryTimes(:,i)./1000, 'rx-')
13+
semilogx(pointsPerTile, vecCollQueryTimes(:,i)./1000, 'bx-')
14+
% now plot error bars
15+
for j=1:size(pointsPerTile, 2)
16+
semilogx([pointsPerTile(j) pointsPerTile(j)], [(rastCollQueryTimes(j,i)-rastStanDev(j,i))/1000 (rastCollQueryTimes(j,i)+rastStanDev(j,i))/1000], 'm+-')
17+
18+
semilogx([pointsPerTile(j) pointsPerTile(j)], [(vecCollQueryTimes(j,i)-vecStanDev(j,i))/1000 (vecCollQueryTimes(j,i)+vecStanDev(j,i))/1000], 'c+-')
19+
end
20+
21+
title(sprintf('%s - Query %d', plotTitle, i))
22+
ylabel('Time in Seconds')
23+
xlabel('Points Per Tile')
24+
legend('FeatureData (Raster)', 'FeatureData (Vector)', 'FeatureCollectionData (Raster)', 'FeatureCollectionData (Vector)')
25+
for j=1:size(pointsPerTile, 2)
26+
text(pointsPerTile(j), rastCollQueryTimes(j,i)/1000, sprintf('[%.0f, %.2f]', pointsPerTile(j), rastCollQueryTimes(j,i)/1000))
27+
text(pointsPerTile(j), vecCollQueryTimes(j,i)/1000, sprintf('[%.0f, %.2f]', pointsPerTile(j), vecCollQueryTimes(j,i)/1000))
28+
end
29+
30+
hold off;
31+
saveas(myFig, sprintf('%s - Query %d', plotTitle, i), 'png');
32+
end
33+
end
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
function plotResults(pointsPerColl, pointsPerTile, numQueries, numRuns)
2+
3+
rasterSmall = load('./raster/smallQueryRuntimes.txt');
4+
rasterMed = load('./raster/medQueryRuntimes.txt');
5+
rasterLarge = load('./raster/largeQueryRuntimes.txt');
6+
7+
vectorSmall = load('./vector/smallQueryRuntimes.txt');
8+
vectorMed = load('./vector/medQueryRuntimes.txt');
9+
vectorLarge = load('./vector/largeQueryRuntimes.txt');
10+
11+
rasterSmallQueryRuntimes = reshape(rasterSmall, [numQueries(1), size(pointsPerTile, 2)+1, numRuns]);
12+
rasterMedQueryRuntimes = reshape(rasterMed, [numQueries(2), size(pointsPerTile, 2)+1, numRuns]);
13+
rasterLargeQueryRuntimes = reshape(rasterLarge, [numQueries(3), size(pointsPerTile, 2)+1, numRuns]);
14+
15+
vectorSmallQueryRuntimes = reshape(vectorSmall, [numQueries(1), size(pointsPerTile, 2)+1, numRuns]);
16+
vectorMedQueryRuntimes = reshape(vectorMed, [numQueries(2), size(pointsPerTile, 2)+1, numRuns]);
17+
vectorLargeQueryRuntimes = reshape(vectorLarge, [numQueries(3), size(pointsPerTile, 2)+1, numRuns]);
18+
19+
rasterFeatSmallQueryTimes = mean(rasterSmallQueryRuntimes(:, 1, :), 3);
20+
rasterFeatMedQueryTimes = mean(rasterMedQueryRuntimes(:, 1, :), 3);
21+
rasterFeatLargeQueryTimes = mean(rasterLargeQueryRuntimes(:, 1, :), 3);
22+
23+
vectorFeatSmallQueryTimes = mean(vectorSmallQueryRuntimes(:, 1, :), 3);
24+
vectorFeatMedQueryTimes = mean(vectorMedQueryRuntimes(:, 1, :), 3);
25+
vectorFeatLargeQueryTimes = mean(vectorLargeQueryRuntimes(:, 1, :), 3);
26+
27+
rasterCollSmallQueryTimes = mean(rasterSmallQueryRuntimes(:, 2:end, :), 3);
28+
rasterCollMedQueryTimes = mean(rasterMedQueryRuntimes(:, 2:end, :), 3);
29+
rasterCollLargeQueryTimes = mean(rasterLargeQueryRuntimes(:, 2:end, :), 3);
30+
31+
vectorCollSmallQueryTimes = mean(vectorSmallQueryRuntimes(:, 2:end, :), 3);
32+
vectorCollMedQueryTimes = mean(vectorMedQueryRuntimes(:, 2:end, :), 3);
33+
vectorCollLargeQueryTimes = mean(vectorLargeQueryRuntimes(:, 2:end, :), 3);
34+
35+
% Plot query times
36+
plotQueryTimes('Small Query Times',
37+
pointsPerTile,
38+
rasterFeatSmallQueryTimes, rasterCollSmallQueryTimes', min(rasterSmallQueryRuntimes(:, 2:end, :), [], 3)', max(rasterSmallQueryRuntimes(:, 2:end, :), [], 3)', std(rasterSmallQueryRuntimes(:, 2:end, :), 0, 3)',
39+
vectorFeatSmallQueryTimes, vectorCollSmallQueryTimes', min(vectorSmallQueryRuntimes(:, 2:end, :), [], 3)', max(vectorSmallQueryRuntimes(:, 2:end, :), [], 3)', std(vectorSmallQueryRuntimes(:, 2:end, :), 0, 3)')
40+
plotQueryTimes('Medium Query Times',
41+
pointsPerTile,
42+
rasterFeatMedQueryTimes, rasterCollMedQueryTimes', min(rasterMedQueryRuntimes(:, 2:end, :), [], 3)', max(rasterMedQueryRuntimes(:, 2:end, :), [], 3)', std(rasterMedQueryRuntimes(:, 2:end, :), 0, 3)',
43+
vectorFeatMedQueryTimes, vectorCollMedQueryTimes', min(vectorMedQueryRuntimes(:, 2:end, :), [], 3)', max(vectorMedQueryRuntimes(:, 2:end, :), [], 3)', std(vectorMedQueryRuntimes(:, 2:end, :), 0, 3)')
44+
plotQueryTimes('Large Query Times',
45+
pointsPerTile,
46+
rasterFeatLargeQueryTimes, rasterCollLargeQueryTimes', min(rasterLargeQueryRuntimes(:, 2:end, :), [], 3)', max(rasterLargeQueryRuntimes(:, 2:end, :), [], 3)', std(rasterLargeQueryRuntimes(:, 2:end, :), 0, 3)',
47+
vectorFeatLargeQueryTimes, vectorCollLargeQueryTimes', min(vectorLargeQueryRuntimes(:, 2:end, :), [], 3)', max(vectorLargeQueryRuntimes(:, 2:end, :), [], 3)', std(vectorLargeQueryRuntimes(:, 2:end, :), 0, 3)')
48+
end
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
% use this code to load all of the histograms in the directory
2+
function [hists, featsPerQuery, runtimes] = loadHistograms(loadFullData)
3+
global tileSizes;
4+
5+
if nargin < 1
6+
loadFullData = false;
7+
end
8+
9+
% load the number of features returned for each query
10+
featsPerQuery = load('large-results.txt');
11+
12+
% load the runtimes
13+
load('largeQueryRuntimes.txt');
14+
largeQueryRuntimes = reshape(largeQueryRuntimes, [size(featsPerQuery, 1), size(tileSizes, 1)+1, 10]);
15+
runtimes = mean(largeQueryRuntimes(:, 2:end, :), 3);
16+
17+
% initialize data for numTiles x numQueries
18+
hists = cell(size(tileSizes, 1), size(featsPerQuery, 1));
19+
20+
% load each histogram
21+
if ~loadFullData
22+
for i=1:size(tileSizes, 1)
23+
for j=1:size(featsPerQuery, 1)
24+
hists(i, j) = load(sprintf('./data/hist_%d_%d.txt', j, tileSizes(i)));
25+
end
26+
end
27+
else
28+
% load the unfiltered histograms
29+
for i=1:size(tileSizes, 1)
30+
for j=1:size(featsPerQuery, 1)
31+
hists(i, j) = load(sprintf('./data/hist_full_%d_%d.txt', j, tileSizes(i)));
32+
end
33+
end
34+
end
35+
end
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
% use this function to plot a single histogram
2+
% - assumes runtimes, featsPerQuery, tileSizes and hists are loaded
3+
function plotHist(tileSize, queryNum, lineFormat, color)
4+
global tileSizes;
5+
global hists;
6+
global featsPerQuery;
7+
global runtimes;
8+
9+
hist = hists{find(tileSizes == tileSize), queryNum};
10+
x = (0:(size(hist, 1)-1))*2;
11+
12+
if nargin == 2
13+
p1 = plot(x, hist / sum(hist));
14+
elseif nargin == 3
15+
p1 = plot(x, hist / sum(hist), lineFormat);
16+
elseif nargin == 4
17+
p1 = plot(x, hist / sum(hist), lineFormat, 'Color', color);
18+
end
19+
20+
xlabel('Features Per Collection')
21+
22+
% get the current title for the figure
23+
t = get(get(gca,'Title'),'String');
24+
25+
% update the title
26+
title(
27+
sprintf('%sQuery %d - %d Features - %.2fs - Tile Size %d\n',
28+
t,
29+
queryNum,
30+
featsPerQuery(queryNum),
31+
runtimes(queryNum, find(tileSizes == tileSize))/1000,
32+
tileSize))
33+
34+
% Get object handles
35+
[LEGH,OBJH,OUTH,OUTM] = legend;
36+
legend([OUTH p1],OUTM,sprintf('Query %d - %d', queryNum, tileSize))
37+
end
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
% use this function to plot multiple histograms automatically
2+
function plotHists(tileSizes, queryNums)
3+
figure
4+
colors = hsv(size(tileSizes, 1));
5+
hold on
6+
for i=1:size(tileSizes, 1)
7+
plotHist(tileSizes(i), queryNums(i), '-', colors(i,:))
8+
end
9+
hold off
10+
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
% this will setup the environment for looking at histograms
2+
3+
global hists = [];
4+
global featsPerQuery = [];
5+
global runtimes = [];
6+
global tileSizes = [100; 500; 1000; 5000; 10000; 50000];
7+
8+
[hists, featsPerQuery, runtimes] = loadHistograms();
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
function plotQueryTimes(plotTitle, pointsPerTile, featQueryTimes, collQueryTimes, minTimes, maxTimes, vars)
2+
for i=1:size(collQueryTimes, 2)
3+
myFig = figure;
4+
semilogx(pointsPerTile, ones(size(pointsPerTile))*featQueryTimes(i)/1000, '--')
5+
xlim([pointsPerTile(1)*0.8 pointsPerTile(end)*1.2])
6+
text(pointsPerTile(1), featQueryTimes(i)/1000, sprintf('%.2f', featQueryTimes(i)/1000))
7+
hold on;
8+
semilogx(pointsPerTile, collQueryTimes(:,i)./1000, 'rx-')
9+
% now plot error bars
10+
for j=1:size(pointsPerTile, 2)
11+
semilogx([pointsPerTile(j) pointsPerTile(j)], [(collQueryTimes(j,i)-vars(j,i))/1000 (collQueryTimes(j,i)+vars(j,i))/1000], 'm+-')
12+
end
13+
title(sprintf('%s - Query %d', plotTitle, i))
14+
ylabel('Time in Seconds')
15+
xlabel('Points Per Tile')
16+
legend('FeatureData', 'FeatureCollectionData')
17+
for j=1:size(pointsPerTile, 2)
18+
text(pointsPerTile(j), collQueryTimes(j,i)/1000, sprintf('[%.0f, %.2f]', pointsPerTile(j), collQueryTimes(j,i)/1000))
19+
end
20+
hold off;
21+
saveas(myFig, sprintf('%s - Query %d', plotTitle, i), 'png');
22+
end
23+
end
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
function plotResults(pointsPerColl, pointsPerTile, numQueries, numRuns)
2+
3+
load('smallQueryRuntimes.txt');
4+
load('medQueryRuntimes.txt');
5+
load('largeQueryRuntimes.txt');
6+
7+
smallQueryRuntimes = reshape(smallQueryRuntimes, [numQueries(1), size(pointsPerTile, 2)+1, numRuns]);
8+
medQueryRuntimes = reshape(medQueryRuntimes, [numQueries(2), size(pointsPerTile, 2)+1, numRuns]);
9+
largeQueryRuntimes = reshape(largeQueryRuntimes, [numQueries(3), size(pointsPerTile, 2)+1, numRuns]);
10+
11+
featSmallQueryTimes = mean(smallQueryRuntimes(:, 1, :), 3);
12+
featMedQueryTimes = mean(medQueryRuntimes(:, 1, :), 3);
13+
featLargeQueryTimes = mean(largeQueryRuntimes(:, 1, :), 3);
14+
15+
collSmallQueryTimes = mean(smallQueryRuntimes(:, 2:end, :), 3);
16+
collMedQueryTimes = mean(medQueryRuntimes(:, 2:end, :), 3);
17+
collLargeQueryTimes = mean(largeQueryRuntimes(:, 2:end, :), 3);
18+
19+
% Plot query times
20+
plotQueryTimes('Small Query Runtime', pointsPerTile, featSmallQueryTimes, collSmallQueryTimes', min(smallQueryRuntimes(:, 2:end, :), [], 3)', max(smallQueryRuntimes(:, 2:end, :), [], 3)', std(smallQueryRuntimes(:, 2:end, :), 0, 3)')
21+
plotQueryTimes('Medium Query Runtime', pointsPerTile, featMedQueryTimes, collMedQueryTimes', min(medQueryRuntimes(:, 2:end, :), [], 3)', max(medQueryRuntimes(:, 2:end, :), [], 3)', std(medQueryRuntimes(:, 2:end, :), 0, 3)')
22+
plotQueryTimes('Large Query Runtime', pointsPerTile, featLargeQueryTimes, collLargeQueryTimes', min(largeQueryRuntimes(:, 2:end, :), [], 3)', max(largeQueryRuntimes(:, 2:end, :), [], 3)', std(largeQueryRuntimes(:, 2:end, :), 0, 3)')
23+
end

0 commit comments

Comments
 (0)