自己組織化マップにおけるカラーバーの作成方法
3 views (last 30 days)
Show older comments
現在、ドキュメンテーションの「アヤメのクラスタリング」を基に自己組織化マップの作成を試みており、plotsomplanes関数から各項目における重み分布の可視化を実施しています。
しかし、挿入→カラーバーによって出力されるカラー分布はマップ上のカラー分布と対応していないようです。
重み配列は確認できるので、関数内部で色分けが為されている思われますが、マップ上のカラー分布に対応したカラーバーの取得方法がわかりません。
ご存じの方がいればご回答いただけますと嬉しいです。
以下は使用している関数コ―ドです。
-----------------------------------------------------------------
function y = norm_som(x)
x = normalize(x,'range')
x = table2array(x);
x = x.';
net = selforgmap([27 27],1000,3,'hextop','dist');
net = train(net,x);
view(net);
y = net(x);
classes = vec2ind(y);
end
-----------------------------------------------------------------
0 Comments
Accepted Answer
Atsushi Ueno
on 14 Feb 2022
【結論】多分これで表示できると思います。動作確認できないplotsomplanes関数の代わりにsurf関数を表示しています
x = iris_dataset;
net = selforgmap([5 5]);
net = train(net,x);
plotData = plotsomplanes(net); % 代わりにsurf(peaks);を表示
R = [0:0.1:1 ones(1,9)]'; % 数値はRGB各20個でカラーマップを作成しています
G = [zeros(1,9) 0:0.1:1]'; % 数値の数を増やせばより滑らかなカラーマップになります
B = zeros(1,20)';
colormap(plotData.axis,[R G B]); % 代わりにcolormap([R G B]);を表示
colorbar(plotData.axis); % 代わりにcolorbar();を表示
【plotsomplanes関数で用いられるカラーマップの調査】
% 最も負の接続は黒、ゼロ接続は赤、最も強い正の接続は黄色で示される。
これを裏付ける為、色の設定に着目してplotsomplanes関数(一番下参照)の一部を抽出すると、上記の様にカラーマップを使わずカスタム色でパッチの色を設定しています。黒⇒赤⇒黄はカラーマップの'hot'に近いですが白色を含みません。これを真似てカラーマップを作成すると一番上の結論の様になります。
% z = fill(a,pos(1,ii)+shapex,pos(2,ii)+shapey,[1 1 1]); % パッチを作成
% set(z,'EdgeColor','none'); % パッチのエッジ色は無し
% plotData.Patches{k}(ii) = z;
% red = min(1,level*2);
% green = max(0,level*2-1);
% blue = 0; % level=0,R0G0B0:黒、level=0.5,R1G0B0:赤、level=1,R1G1B0:黄
% set(plotData.pathces{i}(j),'FaceColor',[red green blue]);% パッチの色設定
type plotsomplanes
1 Comment
Atsushi Ueno
on 14 Feb 2022
最新のplotsomplanes関数内部を良く見ると以前は異なる配色(red,green,blue要素を全て使う)でしたが、コメントアウトされて今はblue要素がずっと0のままになっています。理由は良くわかりません(コメント読んでない:p)
More Answers (0)
See Also
Categories
Find more on 自己組織化マップ in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!