Questions tagged [nnet]

Software for feed-forward neural networks with a single hidden layer, and for multinomial log-linear models.

167 questions
1
vote
1 answer

Predicting with a model created using multinom hangs and errors

I'm trying to use the nnet library to create a multinomial logistic regression model from my training data to see if I can use it to predict my test data. I set everything up in R using this script: library(nnet) folder <- "C:/***/" trainingfile <-…
Roy T.
  • 9,429
  • 2
  • 48
  • 70
0
votes
0 answers

ERROR: compilation failed for package ‘nnet’

I just updated R version to R 4.3.1. Together with the new R, I downloaded XQuartz-2.8.5.pkg and gfortran-12.2-universal.pkg. In my project, the lockfile of my renv was generated with R 4.2.0. Initialising the project, it tells me: - One or more…
menarest
  • 3
  • 4
0
votes
0 answers

How do I fix Error in cbind(1, pred) %*% weights[[num_hidden_layers + 1]] : requires numeric/complex matrix/vector arguments

I built a neural network using nnet. When I tried to compute the test data values, I got the following: Error in cbind(1, pred) %*% weights[[num_hidden_layers + 1]] : requires numeric/complex matrix/vector arguments. Selector is the class I'm…
melo
  • 1
  • 1
0
votes
0 answers

Multinomial logistic regression in R: multicollinearity issues in mlogit, not in multinom (nnet)

I want to run a multinomial logistic regression model, to compare the accuracy results of a random forest model in predicting a three-levels outcome. From what I read, the possible alternatives in R are multinom from nnet package and mlogit.…
kris
  • 109
  • 6
0
votes
1 answer

Obtaining predicted values of the outcome variable using margins command

I have fit a multinomial logistic model as shown below. Using the margins command, I would like to obtain the predicted values for my outcome variable while setting the predictors to some specific values. In other words, I would like to replicate…
Nader Mehri
  • 514
  • 1
  • 5
  • 21
0
votes
1 answer

Saving and Loading a PyTorch NN model (.nnet or .onnx format)

I am trying to train and save a PyTorch model locally in my computer (preferably in .nnet or .onnet format). # Defining the neural network class class Net(nn.Module): def __init__(self, input_size, hidden_size1, hidden_size2, output_size): …
Coder Boy
  • 41
  • 1
  • 5
0
votes
1 answer

Using modelsummary() 'shape' argument as alternative to deprecated modelsummary_wide()

I'm running a multinomial logit model using nnet, and then want to display the results, with the factor levels as columns, in a modelsummary table: library("nnet") multi <- multinom(DV ~ var1, data = wave1) alpha <- summary(multi)$coefficients /…
0
votes
0 answers

nnet() different results in different operating systems (Windows vs Linux)

I am working with R scripts specifically for ANN models using the nnet() package. I run my scripts on my local computer (Windows) and my colleague runs the same R scripts on his computer (Docker -> Linux). We get similar but different results for…
0
votes
2 answers

Nnet in caret, basic structure

I'm very new to caret package and nnet in R. I've done some projects related to ANN with Matlab before, but now I need to work with R and I need some basic help. My input dataset has 1000 observations (in rows) and 23 variables (in columns). My…
0
votes
0 answers

How does `nnet::multinom()` deal with ordered categorical independent variables?

I fit a multinomial logistic regression model that includes an ordered categorical independent variable using nnet::multinom(). I was wondering if anyone can explain the coefficients provided for the ordered categorical independent variable. Here's…
0
votes
0 answers

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

Trying to build a multinomial time series regression for epidemic data according to different lineages. > model3.0.test1 = multinom(as.factor(Value)~as.Date(date), + data=df_reg,weights=as.numeric(LinPerWeek)) Error in nnet.default(X,…
therickster
  • 111
  • 6
0
votes
0 answers

Multinomial logistic regression - Error in nnet.default

I am trying to running a multinomial logistic regression and am getting the error: Error in nnet.default(X, Y, w, mask = mask, size = 0, skip = TRUE, softmax = TRUE, : too many (1182) weights My code is fairly simple and the model appears to build…
0
votes
0 answers

Caret NNest: Groups of categorical variable are empty?

I want to train a NNet with Caret in R. For that, I created a response variable of my data like this: Class 2165 0 4146 0 18212 1 9439 0 12589 …
Ai4l2s
  • 525
  • 2
  • 9
0
votes
1 answer

Fitting a multinomial glm for a very large dataset

I have multinomial compositional data for 100 categories from two groups, where each is represented by two ages: set.seed(1) df <- data.frame(group = c(rep("g1",200),rep("g2",200)), age =…
dan
  • 6,048
  • 10
  • 57
  • 125
0
votes
1 answer

Suppress weights information from nnet package in rmarkdown

Is it possible to suppress the weights information from the nnet package in rmarkdown? If I set include = FALSE, everything will be hidden. message = FALSE does not appear to work. --- title: "Crimes" date: "19/11/2021" output:…
Moses
  • 1,391
  • 10
  • 25