comparison core/tools/machine_learning/sim_get_traintest_clip_overlap.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function [relative, absolute, test_cn, train_cn] = sim_get_traintest_clip_overlap(datafile)
2 %
3 % get_traintest_clip_overlap(datafile)
4 %
5 % returns the percentage of overlapping constraints
6 % with the corresponding training set for each test set
7 %
8 % how many percent of the test set are reappearing in the training set
9
10
11 % simdata = load(datafile);
12 if nargin < 1
13 simdata = load('comp_partBinData_unclustered_cupaper_01');
14 else
15 simdata = load(datafile);
16 end
17 nTestSets = size(simdata.partBinTst, 2); % num cv bins
18 ntrainsizes = size(simdata.partBinTrn, 2); % num increases of training
19
20
21 absolute = zeros(nTestSets, ntrainsizes);
22 relative = zeros(nTestSets, ntrainsizes);
23 for k = 1:nTestSets % all test/training combinatios
24
25 % get clips of this test set
26 test_clips = unique([simdata.partBinTst{k}(:,1); simdata.partBinTst{k}(:,2); simdata.partBinTst{k}(:,3)]);
27 test_cn(k) = numel(test_clips);
28 for m = 1:ntrainsizes
29
30 % get clips of this training set
31 train_clips = unique([simdata.partBinTrn{k,m}(:,1); simdata.partBinTrn{k,m}(:,2); simdata.partBinTrn{k,m}(:,3)]);
32
33 % intersect both clip sets
34 same = intersect(train_clips, test_clips);
35
36 % get stats
37 absolute(k,m) = numel(same);
38 relative(k,m) = absolute(k,m) / numel(test_clips);
39 end
40 train_cn(k) = numel(train_clips);
41 end