title: I get error "Error in nnet.default(x, y, w, ...) : too many (77031) weights" while training neural networks
body: <p>I am trying to train neural networks in R using package <code>nnet</code>. Following is the information about my training data.</p>
  
  <pre><code>str(traindata)
  
  'data.frame':   10327 obs. of  196 variables:
  $ stars                          : num  5 5 5 3.5 3.5 4.5 3.5 5 5 3.5 ...
  $ open                           : num  1 1 1 1 1 1 1 1 1 1 ...
  $ city                           : Factor w/ 61 levels "ahwatukee","anthem",..: 36 38
  $ review_count                   : int  3 5 4 5 14 6 21 4 14 10 ...
  $ name                           : Factor w/ 8204 levels " leftys barber shop",..:
  $ longitude                      : num  -112 -112 -112 -112 -112 ...
  $ latitude                       : num  33.6 33.6 33.5 33.4 33.7 ...
  $ greek                          : int  0 0 0 0 0 0 0 0 0 0 ...
  $ breakfast...brunch             : int  0 0 0 0 0 0 0 0 0 0 ...
  $ soup                           : int  0 0 0 0 0 0 0 0 0 0 ...
  </code></pre>
  
  <p>I have truncated this information.</p>
  
  <p>When I run the following:</p>
  
  <pre><code>library(nnet)  
  m4 &lt;- nnet(stars~.,data=traindata,size=10, maxit=1000)
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>Error in nnet.default(x, y, w, ...) : too many (84581) weights
  </code></pre>
  
  <p>When I try changing weights in the argument like:</p>
  
  <pre><code>m4 &lt;- nnet(stars~.,data=traindata,size=10, maxit=1000,weights=1000)
  </code></pre>
  
  <p>Then I get the following error:</p>
  
  <pre><code>Error in model.frame.default(formula = stars ~ ., data = traindata, weights = 1000) : 
  variable lengths differ (found for '(weights)')
  </code></pre>
  
  <p>What is the mistake I am making? How do I avoid or correct this error? Maybe the problem is with my understanding of "weights".</p>