I tried neural net in R on Boston data set available.

```
data("Boston",package="MASS") 
data <- Boston

```

Retaining only those variable we want to use:

```
keeps <- c("crim", "indus", "nox", "rm" , "age", "dis", "tax" ,"ptratio", "lstat" ,"medv" ) 
data <- data[keeps]

```

In this case the formula is stored in an R object called f. 
The response variable medv is to be “regressed” against the remaining nine attributes. I have done it as below:

```
f <- medv ~ crim + indus + nox + rm + age + dis + tax + ptratio + lstat

```

To set up train sample 400 of the 506 rows of data without replacement is collected using the sample method:

```
set.seed(2016) 
n = nrow(data) 
train <- sample(1:n, 400, FALSE)

```

neuralnet function of R is fitted.

```
library(neuralnet)
fit<- neuralnet(f, data = data[train ,], hidden=c(10 ,12 ,20), 
                 algorithm = "rprop+", err.fct = "sse", act.fct = "logistic", 
                 threshold =0.1, linear.output=TRUE)

```

But warning message is displayed as algorithm not converging.

Warning message:
algorithm did not converge in 1 of 1 repetition(s) within the stepmax 

Tried Prediction using compute,

```
 pred <- compute(fit,data[-train, 1:9])

```

Following error msg is displayed

```
Error in nrow[w] * ncol[w] : non-numeric argument to binary operator
In addition: Warning message:
In is.na(weights) : is.na() applied to non-(list or vector) of type 'NULL'

```

Why the error is coming up and how to recover from it for prediction. I want to use the neuralnet function on that data set.