タブ区切りの入力ファイルを MATLAB の nprtool に読み込むのに問題があります。これは、nprtool GUI が混合データ型の読み込みをサポートしていないためだと思います。読み込んでいる .tab ファイルには、およそ 1100 のデータ サンプル (行) があり、それぞれ次のようになっています。
864 1342470776.212023000 172.25.177.41 155.34.234.20 HTTP 440 58689 http-alt GET http://i.cdn.turner.com/cnn/.e/img/3.0/global/header/hdr-main.gif image/png,image/*;q=0.8,*/*;q=0.5 gzip,deflate 0.000094000 http://www.cnn.com/
上記は、入力ベクトルの 1 つのサンプルにすぎません。nprtool GUI を使用してファイルをロードしようとしましたが、データが正しく認識されません。それはすべてを「テキストデータ」として扱い、「データ」セクションにいくつかのジャンクがあります。次に、スクリプトを使用して GUI なしで実行しようとしました。このメソッドはエラーをスローします (以下)。これを回避する方法はありますか?以下は、ファイルとエラーをロードするために使用しているスクリプトのスニペットです。どんな助けでも大歓迎です。ありがとう!
text1 = fopen('/Users/cgarry/Desktop/CRANEUM/output.tab');
pacTargets = importdata('/Users/cgarry/Desktop/CRANEUM/data.tab','\t');
pacInputs = textscan(text1,'%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s');
fclose(text1);
inputs = pacInputs;
targets = pacTargets;
% Create a Pattern Recognition Network
hiddenLayerSize = 10;
net = patternnet(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
[net,tr] = train(net,inputs,targets);
% Test the Network
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs);
% View the Network
view(net)
% Plots
% Uncomment these lines to enable various plots.
%figure, plotperform(tr)
%figure, plottrainstate(tr)
%figure, plotconfusion(targets,outputs)
%figure, ploterrhist(errors)
>> nnet
Error using trainscg (line 97)
Inputs X{1,1} is not numeric or logical.
Error in network/train (line 106)
[net,tr] = feval(net.trainFcn,net,X,T,Xi,Ai,EW,net.trainParam);
Error in nnet (line 21)
[net,tr] = train(net,inputs,targets);