フィルターのクリア

クラスタリングについて

1 回表示 (過去 30 日間)
早恵香
早恵香 2024 年 4 月 22 日
クラスタリングを重心法か群平均法で行いたいのですが、どうすればいいのでしょうか。
重心法と群平均法に関しては以下の通りです。
重心法 「重心の組み合わせ」にする方法であり、計算はクラスターの大きさで行われる
群平均法 「個体間全ての対の距離の平均値」にする方法であり、クラスター同士の拡散と樹形図の鎖効果を起こさない
%% 図面の枠を生成
f1 = figure;
ax1 = gca;
tfontsizeorg1 = ax1.FontSize;
tfontscale1 = 1.1 * 1.5;
leafcount = 50;
%% 図面の大きさを調整
if leafcount > 15
f1_scale3 = 28 * leafcount * 4 / 3;
f1_scale4 = 28 * leafcount * 2 / 3;
else
f1_scale3 = 560;
f1_scale4 = 280;
end
if f1_scale3 > 1920
f1_scale3 = 1920;
f1_scale4 = f2_scale3 / 2;
end
legcol = fix((leafcount - 1) / 15) + 1;
f1.Position(3) = f1_scale3;
f1.Position(4) = f1_scale4;
tfontsize1 = tfontscale1 * tfontsizeorg1 / 560 * f1_scale3;
ZXAxis1 = max(tfontsize1 * 9 / 11 /2, 9);
Zlegend1 = ZXAxis1 * 9 / 10;
pd = makedist('Normal');
valid_rows = 300;
r = random(pd,[valid_rows,1]);
% 範囲内の整数の乱数行列を生成
Zleaf = randi([1, leafcount], valid_rows, 1);
Xl = [r ones(sum(valid_rows), 1)];
orgplot = gscatter(Xl(:,1),Xl(:,2),Zleaf); % 読み込んだデータをグラフ化して確認
OrgCol = vertcat(orgplot.Color);
[OrgCsize, ~, iOrgdx] = unique(OrgCol, 'rows');
usedata_name="sample";
legend('Location','eastoutside')
title(usedata_name,'FontSize',tfontsize1); % グラフのタイトル(データ名)
ax1.XAxis.FontSize = ZXAxis1;
ax1.Legend.FontSize = Zlegend1;
ax1.YTick = [];

回答 (0 件)

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!