階層型ニューラルネットワークでのデータの分類(学習、検証、テスト)
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
階層型ニューラルネットワークでのデータの分類方法(学習、検証、テスト)がわかりません。
double配列だと分類できますがcell配列ではうまく分類出来ません。
net = network; % ネットワーク初期化
net.numInputs = 2; % 入力層の数を指定 (ユニットではなくグループ数)
net.numLayers = 3; % 隠れ層(2)と出力層(1)の数
net.layers{1}.size = 10; % 隠れ層1のユニット数(10)
net.layers{2}.size = 5; % 隠れ層2のユニット数(5)
net.layers{3}.size = 3; % 出力層のユニット数
net.biasConnect = [1;1;1];
net.inputConnect = [1 0;0 1;0 0]; % 入力層から直接接続される隠れ層/出力層設定
net.LayerConnect = [0 0 0;1 0 0;0 1 0]; % 隠れ層同士の接続状況
net.outputConnect = [0 0 1]; % 出力への接続状況
net.trainFcn = 'trainlm'; % 学習関数
% 伝達関数指定
net.layers{1}.transferFcn = 'logsig';
net.layers{2}.transferFcn = 'logsig';
net.layers{3}.transferFcn = 'purelin';
% 入出力データ設定
X = rand(105,1000);
T = rand(3,1000);
X = con2seq(mat2cell(X,[100 5]))
T = con2seq(T);
% データの分類
net.divideFcn = 'dividerand';
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
[trainInd,valInd,testInd] = dividerand(Input,0.7,0.15,0.15);
% 学習
net = train(net,X,T);
view(net)
0 Kommentare
Antworten (1)
Naoya
am 30 Mai 2021
net.DivideMode の設定を既定の sample から time に変更しますと、1000点の時間刻みに対して、学習、検証、テストの 3項目にデータを分割することができます。
net.plotFcns = {'plotperform','plottrainstate'};
net.initFcn = 'initlay';
net.performFcn = 'mse';
net.DivideMode = 'time'; % 追加
0 Kommentare
Siehe auch
Kategorien
Mehr zu Define Shallow Neural Network Architectures finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!