1

I'm having difficulty loading my tab-delimited input file into MATLABs nprtool, which I think is because nprtool GUI doesn't support loading of mixed data types. The .tab file I am loading in has roughly 1100 data samples (rows), each of which look like:

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/

The above is just a single sample in the input vector. I've tried loading the file in using the nprtool GUI, but it doesn't recognize the data correctly. It treats it all as 'textdata' with some junk in the 'data' section. I then tried to do it without the GUI via script. This method throws an error (below). Any way around this? Below is a snippet of the script I'm using to load the file and the error. Any help is appreciated. Thanks!

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);

1 Answer 1

1

Thats right, Matlab Neural network doesn't support mixed data type. But don't worry there are multiple ways to handle this. The easiest way is to categorize your data. For example all data including HTTP are represented with 1 while other can be represent by 2, 3,.... There are some other softwares available. I think R neural net package can handle this (not sure).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.