I am using nnet package in R for training Artificial Neural Network. Some tell that weights are assigned to each case in training set, and some say that no. of weights are equal to the no. of connections in structure of neural network. I didn't understand this. Can anybody help me out.

I looked at the R code of nnet i.e.

What is the difference between weights & Wts in the nnet code below?

nnet(x, y, weights, size, Wts, mask, linout = FALSE, entropy = FALSE, softmax = FALSE, censored = FALSE, skip = FALSE, rang = 0.7, decay = 0, maxit = 100, Hess = FALSE, trace = TRUE, MaxNWts = 1000, abstol = 1.0e-4, reltol = 1.0e-8, ...)


From the documentation we can find out that:

  • weights: (case) weights for each example – if missing defaults to 1.
  • Wts: initial parameter vector. If missing chosen at random.

Though I'm no R expert, my understanding is:

  • weights is something like sample_weight in python, which controls the weight of each sample. It's useful when dealing with imbalanced class issue.
  • Wts is the initial weights of neural network. Random weights will be initiated if this parameter is not passed.

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .