-2

ニューラル ネットワークの使用は、トレーニングよりも時間がかかります。私はひどく間違ったことをしていますか?使用に 2 分、トレーニングに 14 秒。

load building_dataset % 4208 examples

inputs = buildingInputs; 
targets = buildingTargets;

% Create a Fitting Network
hiddenLayerSize = 10;
net = fitnet(hiddenLayerSize);

% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;

% Train the Network
tic
[net,tr] = train(net,inputs,targets);
training_time = toc % ~= 14 seconds

% use the neural network
time = 0;
for i = 1:4208
  test_input = buildingInputs(:,i);
  tic
  test_output = net(test_input);
  time = time + toc;
end

time % ~= 117 seconds
average_time = time / 4208 % ~= 0.028 seconds
4

1 に答える 1

1

入力をベクトル化する必要があります。for ループを次のように置き換えます。

  test_input = buildingInputs(:,:);
  tic
  test_output = net(test_input);
  time = time + toc;

出力は結果のマトリックスになります

于 2012-04-25T16:18:44.820 に答える