Shivpe_R
Shivpe_R

Reputation: 1080

Too Many Weights in Multinomial logistic regression and the code is running for hours

I have a DF(train_market) having 8523 rows and 12 Columns as shown enter image description here

And I'm Doing multinomial logistic regression model to get the ITem_Outlet_Sales on the test_data. but the code to run the model is running from hours together

 model <- nnet(Item_Outlet_Sales~.,train_market,family="multinomial",size = 5574900,softmax=TRUE)

I tried others two shown below but still its running for hours, what changes should i do to get it done

 model <- multinom(Item_Outlet_Sales~.,train_market,family="multinomial")
 model <- nnet(Item_Outlet_Sales~.,train_market,family="multinomial",size = 5574900,softmax=TRUE)

And i got the error for the 2nd Code as

Error in nnet.default(X, Y, w, mask = mask, size = 0, skip = TRUE, softmax = TRUE,  : 
 too many (5574828) weights

so kept size =5574900 in 3rd and tried,Which dint help.

Upvotes: 1

Views: 6790

Answers (1)

submartingale
submartingale

Reputation: 755

There is the argument MaxNWts in the nnet package in general for controlling the maximum number of weights. Hence, setting MaxNWts to a sufficiently large integer (for example, MaxNWts =10000000) should do the job:

model <- nnet(Item_Outlet_Sales~.,train_market,family="multinomial",size = 5574900,softmax=TRUE,MaxNWts =10000000)

Upvotes: 5

Related Questions