Skip to content
Snippets Groups Projects
Commit c9079573 authored by ac_fx's avatar ac_fx
Browse files

synthetic example update

parent f4343f40
Branches
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ wkb=[];
for k=1:kMax+1
idx(k,:)=kmeans(X,k,'replicates',10);
wk(k)=wkSpatial(X,idx(k,:));
parfor i=1:B
for i=1:B
idxb=kmeans(UV(:,:,i),k,'replicates',10);
wkb(k,i)=wkSpatial(UV(:,:,i),idxb);
end
......
% load('synthetic_results_sep_21_2022.mat');
for i=1:length(res)
acc = res(i).acc;
xx=acc{:,:};
xx01 = (xx==3);
res(i).mu = mean(xx01,1)
res(i).ci = bootci(100,@mean,xx01);
res(i).ciErrorBar(1,:) = res(i).mu - res(i).ci(1,:);
res(i).ciErrorBar(2,:) = res(i).ci(2,:) - res(i).mu;
end
ciErrorBar = vertcat(res(:).ciErrorBar);
mu = vertcat(res(:).mu);
\ No newline at end of file
......@@ -3,8 +3,9 @@ DRAW = 0;
ccc=hsv(6);
mcdf = {};
scdf = {};
warning('off','stats:gmdistribution:FailedToConvergeReps');
for K=1:kMax
idx=kmeans(X,K);
idx=kmeans(X,K,'Replicates',5);
delta=[];
dmax=-1;
if DRAW
......
spacing=1;
N=1e4;
acc=table();
% figure(1);clf;plot(X(:,1),X(:,2),'.b');hold on
covm=[eye(2)];
for nrep=1:100
res = [];
for spacing = 0.5:0.25:2
nr = [];
nr.spacing = spacing;
acc = table();
parfor nrep=1:100
warning('off','stats:gmdistribution:FailedToConvergeReps');
warning('off','stats:kmeans:FailedToConvergeRep');
od=[];
X = getRandomSpatialData(spacing,covm,N);
kCSF = getCSF_spatial(X,6);
kGap = Cluster.gapSpatial(X,6,DRAW);
aic = [];
bic = [];
kGap = Cluster.gapSpatial(X,6);
for kgmm = 1:6
gmm = fitgmdist(X,kgmm,'replicates',5);
aic(kgmm) = gmm.AIC;
......@@ -31,9 +39,12 @@ for nrep=1:100
na = table();
na.kCSF = kCSF;
na.kGap = kGap;
na.kaic = kaic;
na.kbic = kbic;
na.kAIC = kaic;
na.kBIC = kbic;
acc = [acc;na]
acc(nrep,:) = na;
%
end
nr.acc = acc;
res=[res;nr]
end
\ No newline at end of file
Source diff could not be displayed: it is stored in LFS. Options to address this: view the blob.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment