wolffd@0: function [r, valididx, clip_ids, P] = ranking_from_comparison_Stober_diffs(nDatasets, nRuns) wolffd@0: wolffd@0: global globalvars; wolffd@0: global comparison; wolffd@0: global comparison_ids; wolffd@0: wolffd@0: % --- wolffd@0: % get the standard test set wolffd@0: % NOTE: we will keep the r and valididx, and just use wolffd@0: % the rest of the data for determining the issing edges etc wolffd@0: % --- wolffd@0: load('comp_SimGraphMulti_SimDataDump', 'G', 'r', 'valididx', 'clip_ids'); wolffd@0: nData = sum(valididx > 0); wolffd@0: wolffd@0: % --- wolffd@0: % initialise the new partition wolffd@0: % --- wolffd@0: P = cvpartition_alltrain(nData, nDatasets * nRuns); wolffd@0: wolffd@0: wolffd@0: for i = 1:nDatasets wolffd@0: wolffd@0: % --- wolffd@0: % create new Stober graph wolffd@0: % --- wolffd@0: Gstob = ClipSimGraphStober(); wolffd@0: Gstob.random_all_constraints_graph; wolffd@0: Gdiff = G - ClipSimGraphMulti(Gstob.to_DiGraph()); wolffd@0: wolffd@0: % --- wolffd@0: % get missing entries in stober similarity wolffd@0: % --- wolffd@0: idx = find_graph_in_valid(r, comparison_ids(clip_ids),valididx, Gdiff); wolffd@0: lostData = sum(idx); wolffd@0: if lostData ~= Gdiff.num_edges wolffd@0: error ('Inconsistent Data: edges in gdiff could not be found'); wolffd@0: end wolffd@0: wolffd@0: % --- wolffd@0: % save entries in DataPartition (remove from valid sets) wolffd@0: % NOTE: this is manhual intervention into Class territory :( wolffd@0: % --- wolffd@0: for j = 1:nRuns wolffd@0: jd = j + (i-1) * nRuns; wolffd@0: P.mtraining{jd} = ones(P.N, 1) - idx(valididx)'; wolffd@0: P.mtest{jd} = ones(P.N, 1) - idx(valididx)'; wolffd@0: P.TrainSize(jd) = P.N - lostData; wolffd@0: P.TestSize(jd) = P.N - lostData; wolffd@0: end wolffd@0: end wolffd@0: end wolffd@0: wolffd@0: % --- wolffd@0: % This finds all graphs edges in the ranking wolffd@0: % --- wolffd@0: function idx = find_graph_in_valid(r, clip_ids, valididx, G) wolffd@0: wolffd@0: idx = zeros(1,size(r,1)); wolffd@0: for i = find(valididx) wolffd@0: wolffd@0: a = clip_ids(i); wolffd@0: b = clip_ids(r{i,1}); wolffd@0: c = clip_ids(r{i,2}); wolffd@0: if G.edge(a,b,c) > 0 wolffd@0: idx(i) = 1; wolffd@0: end wolffd@0: end wolffd@0: end wolffd@0: