clear all
rng(sum('anson'))

data = readmatrix('C:\Coding\fusion-properties\prepped.csv')
%df = normc(data)
w = 1./var(data)
[wcoeff,score,latent,tsquared,explained] = pca(data,'VariableWeights',w)

coefforth  = inv(diag(std(data)))* wcoeff


[idx,C] = kmeans(data(:,1:2),3)

gscatter(data(:,1), data(:,2), idx)

hold on
plot(C(:,1),C(:,2),'kx',...
     'MarkerSize',15,'LineWidth',3) 
legend('Cluster 1','Cluster 2','Cluster 3', 'Centroids',...
       'Location','NW')
xlabel('Mass (grams)')
ylabel('Volume (mm^3)')
title('Volume vs. Mass Clusters')

hold off
histcounts(idx)
scatter3(data(:,1),data(:,2),data(:,3),ones(length(idx),1).*10,idx)