[英]Suppress convergence message in nnet multinom function in R
I am using knitr in R to produce a document of model outputs. 我在R中使用knitr来生成模型输出的文档。 I have suppressed messages and warnings in my code chunk. 我在代码块中抑制了消息和警告。 But I still get the convergence messages. 但我仍然得到收敛信息。 I have looked for settings in the net package and in the multinom function. 我已经在net package和multinom函数中查找了设置。 Does anybody know how to suppress them? 有人知道如何抑制它们吗? I have looked on SO and on the internet. 我已经看过SO和互联网了。 Someone asked a question in 2006 but I can't get the answer returned (and I don't know if it relevant today). 有人在2006年提出了一个问题,但我无法得到答案(我不知道今天是否相关)。
I am running many models in a loop, so it gets verbose very quickly. 我在一个循环中运行很多模型,所以它很快就会变得冗长。 This also means that I can't easily put the model runs in a different chunk from the output because I am printing tables in each loop. 这也意味着我不能轻易地将模型运行放在输出的不同块中,因为我在每个循环中打印表。 An example of the output I am trying to suppress is below: 我试图压制的输出示例如下:
# weights: 10 (4 variable) initial value 2454.392816 iter 10 value 2175.558042 iter 10 value 2175.558039 final value 2175.558039 converged
I finally found a function argument called "trace" in the nnet function. 我终于在nnet函数中找到了一个名为“trace”的函数参数。 Its default is TRUE, and when set to "FALSE" the messages stop. 它的默认值为TRUE,当设置为“FALSE”时,消息将停止。 I am guessing that nnet is called by multinom. 我猜这个nnet是由multinom调用的。 Thank goodness for the ... in R so I could pass a function argument through. 谢天谢地......在R中我可以传递一个函数参数。
Hopefully this will help someone else. 希望这会帮助别人。 I didn't mean to answer my own question (but I hope that is ok). 我不是故意回答我自己的问题(但我希望没问题)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.