title: error in roc: Neural Network in R
body: <p>I want to use neural network in R to predict the price of a car, having 144 independent variables. 
  Below my code. Everything works fine, except the last 2 lines: AUC and plot.</p>
  
  <p>This is the error I got:</p>
  
  <p><strong>Error in roc(predNN, yTEST) : 
    Not enough distinct predictions to compute area under the ROC curve.</strong> </p>
  
  <p>I already computed the dependent variable as a factor, but this error remains.
  How should I resolve this problem?</p>
  
  <pre><code> allind &lt;- sample(x=1:nrow(data_price2),size=nrow(data_price2))
  
   trainind &lt;- allind[1:round(length(allind)/3)]
   valind &lt;- allind[(round(length(allind)/3)+1):round(length(allind)*(2/3))]
   testind &lt;- allind[round(length(allind)*(2/3)+1):length(allind)]
  
   BasetableTRAIN &lt;- data_price2[trainind,]
   BasetableVAL &lt;- data_price2[valind,]
   Basetablebig &lt;-rbind(BasetableTRAIN,BasetableVAL)
   BasetableTEST &lt;- data_price2[testind,]
  
   #Create a separate response variable
   yTRAIN &lt;- BasetableTRAIN$Price
   BasetableTRAIN$Price &lt;- NULL
  
   yVAL &lt;- BasetableVAL$Price
   BasetableVAL$Price &lt;- NULL
  
   yTEST &lt;- BasetableTEST$Price
   BasetableTEST$Price &lt;- NULL
  
   yBIG &lt;- Basetablebig$Price
   Basetablebig$Price &lt;- NULL
  
   yTRAIN &lt;- as.factor(yTRAIN)
   yVAL &lt;- as.factor(yVAL)
   yTEST &lt;- as.factor(yTEST)
   yBIG &lt;- as.factor(yBIG)
  
   if (require("nnet")==FALSE) install.packages("nnet") ; library(nnet)
   if (require("AUC")==FALSE) install.packages("AUC") ; library(AUC)
  
   size &lt;- 5 #number of units in the hidden layer
   decay &lt;- 0.1 #weight decay. Same as lambda in regularized LR. Controls for
                 overfitting. 
   rang &lt;- 0.5 #the range of the initial random weights parameter
   maxit &lt;- 2000 #set high in order not to run into early stopping 
  
   NN &lt;- nnet(yBIG ~ ., Basetablebig, size = size, 
         rang = rang, decay = decay, maxit = maxit,MaxNWts= Inf)
  
   predNN &lt;- as.numeric(predict(NN,BasetableTEST,type="raw"))
   AUC::auc(roc(predNN,yTEST))
   plot(roc(predNN,yTEST))
  </code></pre>