1

I am trying to train a neural network, by using the train function. The thing is that I want to do this remotely over the internet by using a SSH connection.

However, I am receiving the following error:

??? Error using ==> nntraintool at 28
NNTRAINTOOL requires Java which is not available
Error in ==> trainbr>train_network at 257
[userStop,userCancel] = nntraintool('check');`
Error in ==> trainbr at 116`
[net,tr] = train_network(net,tr,data,fcns,param);`
Error in ==> network.train at 107`
[net,tr] = feval(net.trainFcn,net,X,T,Xi,Ai,EW,net.trainParam);`
Error in ==> ClassifierScript at 28`
[MFLDefectSNetwork,  tr] = train(MFLDefectSNetwork, TrainingInputSet,
TrainingSTargets);`

I think I receive this error because of the training interface which is displayed when you want to perform a neural net training. If so, could you please tell me, how can I turn that visual interface off so that I can run this by using ssh connection.

Amro
  • 123,847
  • 25
  • 243
  • 454
Simon
  • 4,999
  • 21
  • 69
  • 97

2 Answers2

2

I believe you can solve this by setting the trainParam.showWindow parameter of your network object to false before calling nntraintool. For example, if your network object is stored in the variable net, you would do this before you train:

net.trainParam.showWindow = false;

This MATLAB Newsgroup thread also suggests that you may have to comment out some lines in nntraintool, which you can open in the editor with the command edit nntraintool.

gnovice
  • 125,304
  • 15
  • 256
  • 359
  • it doesn't work... I have tried to edit nntraintool, but it won't open in unix environment, I don't know why... – Simon Jul 28 '11 at 16:14
  • 1
    Did you figure out the problem? – gnovice Jul 28 '11 at 17:38
  • not quite... I just used instead the visual connection for ssh, and I tried running the training by using the visual remote connection and this way it worked... – Simon Jul 28 '11 at 21:03
  • @Simon: I posted a possible solution, can you check it (without enabling X11 forwarding) – Amro Jul 28 '11 at 21:11
0

(Disclaimer: the following is untested. I currently only have access to a Windows installation of MATLAB)

Try the following sequence of commands to start MATLAB (note that you should NOT use the -nojvm option):

# on your machine
ssh -x user@host

# on the host
unset DISPLAY
matlab -nodisplay

Once in MATLAB, you can explicitly check that Java is available:

>> usejava('jvm')
>> java.lang.String('str')

Next, proceed to create and use the neural network (you just have to suppress training feedback):

%# load sample dataset
load simpleclass_dataset

%# create and train neural network
net = newpr(simpleclassInputs, simpleclassTargets, 20);
net.trainParam.showWindow = false;          %# no GUI (as @gnovice suggested)
net.trainParam.showCommandLine = true;      %# display in command line
net.trainParam.show = 1;                    %# display every iteration
net = train(net, simpleclassInputs, simpleclassTargets);

%# predict and evaluate performance
simpleclassOutputs = sim(net, simpleclassInputs);
[c,cm] = confusion(simpleclassTargets,simpleclassOutputs)

As a side note, even though we disabled all display, we can still plot stuff (although invisible) and export figures to files, as I have shown in previous related questions...

Community
  • 1
  • 1
Amro
  • 123,847
  • 25
  • 243
  • 454