I'm learning R and wanted to train a nnet classifier (from the caret package) that could correctly output the class of an object based on 5 arguments (2 possible classes, "Yes" or "No")
But my classifier is actually shit, I split my data into training and test set, but basically my classifier almost gives no "Yes" label, less than 2% of its calculated output is "Yes" even though it should be around 35%.
Even when I give it the training data it was built with it gives me less than 0.5% Yes, so it's not even overfitting it's just shit
ctrl= trainControl(method = 'cv', number = 10, summaryFunction=twoClassSummary ,classProbs = TRUE)
paramGrid <- expand.grid(mtry = c(1,2,3,4), size = 4, decay = 0.1)
model = train( /... set training data and labels./)
metric = "ROC",
method = "nnet",
maxit = 1000,
algorithm='backprop',
learningrate=0.25,
preproc = c("range"),
tunegrid = paramGrid,
trControl = ctrl)
anybody here knows about nnet ? Because idk what I'm doing wrong
>>58042019
Get a brain Moran
>>58042019
I feel your pain. Data types correct? NN like numerical i think. Also if you have too many hidden nodes/layers, otherwise im at a loss with limited info in ur post m8.
>>58042053
this
Use a debugger
It's tuneGrid and preProc not tunegrid and preproc, right now your nnet is just using the default.
Changing that will help a bit, but I doubt it'll be enough to make your classifier entirely efficient
>>58042019
Is training data normalized?
>>58042019
more iterations
less learning rate
different activation function
etc like all machine learning its just chaning some values until it kinda works
>>58045123
oh shit, I expected R to tell me the name of the arguments were wrong. Well it's a bit better now, but not that much, like 3% Yes
>>58043882
>>58045272
data is numerical and normalized, tried normalizing it with both the preProc = "range" and preProc = ("center", "scale"), scaling is a bit better than range but the effect isn't that big, I still can't manage to get an half decent classifier
>>58044733
isn't debugging a huge pain in the ass for neural network ? What would I even be looking for ?
>>58045329
Don't try to debug a NN. Consider the NN a black box in terms of weight and bias values
how much test data did you provide it?
>>58045329
Best practice for training is providing 5-10 times the number of weights in samples
>>58045409
about 5000 tuples with approx 35% Yes and 65% No, which should be representative of the population
>>58045465
haven't tried manually setting weights yet, I'll try it even though 500 weight seems a bit strong
>>58045276
yeah, but this far every time I change something I take one step forward and two steps back, I'm not sure which values are actually helping
>>58045617
5000 inputs to 500 weights is just 10x the number of weights, there is no need to alter the number of weights