Index: birds/birdsexp.m
===================================================================
--- birds/birdsexp.m	(revision 65)
+++ birds/birdsexp.m	(revision 65)
@@ -0,0 +1,22 @@
+load birds_7D;
+a = makemillabeled(a,2);
+
+u = {...
+   scalem([],'variance')*milproxm([],'meanmin')*loglc2;
+   scalem([],'variance')*miles([],0.1);
+   };
+nrfolds = 10;
+
+nru = size(u,1);
+I = nrfolds;
+e = zeros(nru,nrfolds);
+for f = 1:nrfolds
+   f
+   [x,z,I] = milcrossval(a,I);
+   for i=1:nru
+      w = x*u{i};
+      e(i,f) = dd_auc(z*w*milroc);
+   end
+end
+R = results(e,getwnames(u),nrfolds);
+show(average(100*R),'max1');
Index: birds/createmilbirds.m
===================================================================
--- birds/createmilbirds.m	(revision 64)
+++ 	(revision )
@@ -1,80 +1,0 @@
-% create a MIL dataset from the original WAV-files, segmentation of the
-% spectrograms, and computation of features on the segmented regions
-
-% some settings:
-windowlen = 512;
-fmax = 256;
-intens_thr = 0.8;   % remove 80% of the signal??
-f_min = 2000;       % frequency threshold (everything below is removed)
-
-% load the 'meta' data like labels and filenames
-dpath = fullfile(mildatapath,'birds');
-[bagid,names] = textread(fullfile(dpath,'id2filename.txt'),'%n%s','headerlines',1);
-[bagid2,labstr] = textread(fullfile(dpath,'hja_birdsong_bag_labels.txt'),'%n%s','headerlines',1);
-
-if any(bagid~=bagid2)
-	error('Bagid''s do not match.');
-end
-G = fspecial('gaussian',[5 5],2);
-
-% run over the files, and get the features:
-B = size(bagid,1);
-x = cell(B,1);
-baglab = zeros(B,13);
-instlab = '';
-bagid = [];
-for i=1:B
-	%load the signal;
-	[signal,fs] = wavread(fullfile(dpath,'wavs',names{i}(2:end)));
-	[S,f,t] = spectrogram(signal,windowlen,windowlen/2,fmax,fs);
-	% smooth and threshold the spectrogram:
-	I = imfilter(abs(S),G,'same');
-	mask = (I>dd_threshold(I(:),intens_thr));
-	mask(f<f_min) = 0;
-	% find interesting regions:
-	props = regionprops(bwlabel(mask),abs(S));
-	bloblab = bwlabel(mask);
-	Nseg = max(unique(bloblab));
-
-	% run over blobs:
-	im = abs(S);
-	thisx = zeros(Nseg,3);
-	for j=1:Nseg
-		ix = (bloblab==j);
-		thisx(j,:) = [props(j).Area props(j).Centroid];
-		% don't forget:
-		bagid(end+1) = i;
-	end
-	x{i} = thisx;
-
-	% get the labels right:
-	eval(['baglab(i,[',labstr{i}(2:end),'])=1;']);
-end
-
-% create a dataset
-a = genmil(x);
-% add the labels one by one:
-ll = [...
-'BRCR - Brown Creeper            ';
-'WIWR - Winter Wren              ';
-'PSFL - Pacific-slope Flycatcher ';
-'RBNU - Red-breasted Nuthatch    ';
-'DEJU - Dark-eyed Junco          ';
-'OSFL - Olive-sided Flycatcher   ';
-'HETH - Hermit Thrush            ';
-'CBCH - Chestnut-backed Chickadee';
-'VATH - Varied Thrush            ';
-'HEWA - Hermit Warbler           ';
-'SWTH - Swainsons Thrush         ';
-'HAFL - Hammonds Flycatcher      ';
-'WETA - Western Tanager          '];
-
-for i=1:size(baglab,2)
-   I = ismember(bagid,find(baglab(:,i)));
-   a = addlabels(a,genmillabels(I',1),ll(i,:));
-end
-% set it to the first bird:
-a = changelablist(a,2);
-thisll = getlablistnames(a);
-a = setname(a,strtrim(thisll(curlablist(a),:)));
-
Index: birds/createmilbirds_13cl.m
===================================================================
--- birds/createmilbirds_13cl.m	(revision 65)
+++ birds/createmilbirds_13cl.m	(revision 65)
@@ -0,0 +1,83 @@
+% Create a MIL dataset from the original WAV-files, segmentation of the
+% spectrograms, and computation of features on the segmented regions
+%
+% This data was the original Briggs data with 13 species.
+
+% some settings:
+windowlen = 512;
+fmax = 256;
+intens_thr = 0.8;   % remove 80% of the signal??
+f_min = 2000;       % frequency threshold (everything below is removed)
+
+% load the 'meta' data like labels and filenames
+dpath = fullfile(mildatapath,'birds');
+[bagid,names] = textread(fullfile(dpath,'id2filename.txt'),'%n%s','headerlines',1);
+[bagid2,labstr] = textread(fullfile(dpath,'hja_birdsong_bag_labels.txt'),'%n%s','headerlines',1);
+
+if any(bagid~=bagid2)
+	error('Bagid''s do not match.');
+end
+G = fspecial('gaussian',[5 5],2);
+
+% run over the files, and get the features:
+B = size(bagid,1);
+x = cell(B,1);
+baglab = zeros(B,13);
+instlab = '';
+bagid = [];
+for i=1:B
+	%load the signal;
+	[signal,fs] = wavread(fullfile(dpath,'wavs',names{i}(2:end)));
+	[S,f,t] = spectrogram(signal,windowlen,windowlen/2,fmax,fs);
+	% smooth and threshold the spectrogram:
+	I = imfilter(abs(S),G,'same');
+	mask = (I>dd_threshold(I(:),intens_thr));
+	mask(f<f_min) = 0;
+	% find interesting regions:
+	props = regionprops(bwlabel(mask),abs(S));
+	bloblab = bwlabel(mask);
+	Nseg = max(unique(bloblab));
+
+	% run over blobs:
+	im = abs(S);
+	thisx = zeros(Nseg,7);
+	for j=1:Nseg
+		ix = (bloblab==j);
+      % compute/add some blob-properties:
+		thisx(j,:) = [props(j).Area, props(j).Centroid, props(j).BoundingBox];
+		% don't forget:
+		bagid(end+1) = i;
+	end
+	x{i} = thisx;
+
+	% get the labels right:
+	eval(['baglab(i,[',labstr{i}(2:end),'])=1;']);
+end
+
+% create a dataset
+a = genmil(x);
+% add the labels one by one:
+ll = [...
+'BRCR - Brown Creeper            ';
+'WIWR - Winter Wren              ';
+'PSFL - Pacific-slope Flycatcher ';
+'RBNU - Red-breasted Nuthatch    ';
+'DEJU - Dark-eyed Junco          ';
+'OSFL - Olive-sided Flycatcher   ';
+'HETH - Hermit Thrush            ';
+'CBCH - Chestnut-backed Chickadee';
+'VATH - Varied Thrush            ';
+'HEWA - Hermit Warbler           ';
+'SWTH - Swainsons Thrush         ';
+'HAFL - Hammonds Flycatcher      ';
+'WETA - Western Tanager          '];
+
+for i=1:size(baglab,2)
+   I = ismember(bagid,find(baglab(:,i)));
+   a = addlabels(a,genmillabels(I',1),ll(i,:));
+end
+% set it to the first bird:
+a = changelablist(a,2);
+thisll = getlablistnames(a);
+a = setname(a,strtrim(thisll(curlablist(a),:)));
+
Index: birds/createmilbirds_19cl.m
===================================================================
--- birds/createmilbirds_19cl.m	(revision 65)
+++ birds/createmilbirds_19cl.m	(revision 65)
@@ -0,0 +1,95 @@
+% create a MIL dataset from the original WAV-files, segmentation of the
+% spectrograms, and computation of features on the segmented regions
+%
+% This is the new 19 species dataset from the MLSP competition
+
+% some settings:
+windowlen = 512;
+fmax = 256;
+intens_thr = 0.8;   % remove 80% of the signal??
+f_min = 2000;       % frequency threshold (everything below is removed)
+
+% load the 'meta' data like labels and filenames
+dpath = '/data/birds_mlsp2013/mlsp_contest_dataset2/essential_data/';
+[bagid,names] = textread(fullfile(dpath,'rec_id2filename.txt'),'%n%s','headerlines',1);
+[bagid2,labstr] = textread(fullfile(dpath,'rec_labels_test_hidden.txt'),'%n%s','headerlines',1);
+[bagid3,Itst] = textread(fullfile(dpath,'CVfolds_2.txt'),'%n%d','headerlines',1);
+
+
+if any(bagid~=bagid2)
+	error('Bagid''s do not match.');
+end
+G = fspecial('gaussian',[5 5],2);
+
+% run over the files, and get the features:
+B = size(bagid,1);
+x = cell(B,1);
+baglab = zeros(B,13);
+instlab = '';
+bagid = [];
+for i=1:B
+	%load the signal;
+	[signal,fs] = wavread(fullfile(dpath,'wavs',names{i}(2:end)));
+	[S,f,t] = spectrogram(signal,windowlen,windowlen/2,fmax,fs);
+	% smooth and threshold the spectrogram:
+	I = imfilter(abs(S),G,'same');
+	mask = (I>dd_threshold(I(:),intens_thr));
+	mask(f<f_min) = 0;
+	% find interesting regions:
+	props = regionprops(bwlabel(mask),abs(S));
+	bloblab = bwlabel(mask);
+	Nseg = max(unique(bloblab));
+
+	% run over blobs:
+	im = abs(S);
+	thisx = zeros(Nseg,7);
+	for j=1:Nseg
+		ix = (bloblab==j);
+      % compute/add some blob-properties:
+		thisx(j,:) = [props(j).Area, props(j).Centroid, props(j).BoundingBox];
+		% don't forget:
+		bagid(end+1) = i;
+	end
+	x{i} = thisx;
+
+	% get the labels right for the training bags:
+   if ~Itst(i)
+      eval(['baglab(i,[',labstr{i}(2:end),'])=1;']);
+   end
+end
+
+% create a dataset
+a = genmil(x);
+% add the labels one by one:
+ll = [...
+'BRCR-Brown Creeper            ';
+'PAWR-Pacific Wren             ';
+'PSFL-Pacific-slope Flycatcher ';
+'RBNU-Red-breasted Nuthatch    ';
+'DEJU-Dark-eyed Junco          ';
+'OSFL-Olive-sided Flycatcher   ';
+'HETH-Hermit Thrush            ';
+'CBCH-Chestnut-backed Chickadee';
+'VATH-Varied Thrush            ';
+'HEWA-Hermit Warbler           ';
+'SWTH-Swainsons Thrush         ';
+'HAFL-Hammonds Flycatcher      ';
+'WETA-Western Tanager          ';
+'BHGB-Black-headed Grosbeak    ';
+'GCKI-Golden Crowned Kinglet   ';
+'WAVI-Warbling Vireo           ';
+'MGWA-MacGillivrays Warbler    ';
+'STJA-Stellars Jay             ';
+'CONI-Common Nighthawk         '];
+
+
+for i=1:size(baglab,2)
+   I = ismember(bagid,find(baglab(:,i)));
+   a = addlabels(a,genmillabels(I',1),ll(i,:));
+end
+% set it to the first bird:
+a = changelablist(a,2);
+thisll = getlablistnames(a);
+a = setname(a,strtrim(thisll(curlablist(a),:)));
+
+J = Itst(bagid);
