Matlab - 在命令行环境下运行train函数

发布于 2024-11-26 14:08:29 字数 702 浏览 2 评论 0原文

我正在尝试使用 train 函数来训练神经网络。问题是我想使用 SSH 连接通过互联网远程执行此操作。

但是,我收到以下错误:

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

我认为我收到此错误是因为当您想要执行神经网络训练时显示的训练界面。如果是这样,您能否告诉我,如何关闭该可视界面,以便我可以使用 ssh 连接来运行它。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

满身野味 2024-12-03 14:08:29

我相信您可以通过设置 网络对象 设置为 false ” rel="nofollow">nntraintool。例如,如果您的网络对象存储在变量 net 中,则您需要在训练之前执行以下操作:

net.trainParam.showWindow = false;

MATLAB 新闻组线程 还建议您可能需要注释掉 nntraintool,您可以在使用命令 edit nntraintool 进行编辑。

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.

很酷又爱笑 2024-12-03 14:08:29

免责声明:以下内容未经测试。我目前只能访问 Windows 安装的 MATLAB)

尝试以下命令序列来启动 MATLAB(请注意,您不应使用 -nojvm 选项):

# on your machine
ssh -x user@host

# on the host
unset DISPLAY
matlab -nodisplay

进入 MATLAB 后,您可以明确检查 Java 是否可用:

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

接下来,继续创建和使用神经网络(您只需抑制 训练反馈):

%# 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)

作为旁注,即使我们禁用了所有显示,我们仍然可以绘制内容(尽管不可见)并将图形导出到文件,正如我在 上一页相关问题...

(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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文