library(neuralnet)
data1<-read.csv("C:/Users/LENOVO/Desktop/mbaper.csv")
data1$Specialization<-as.factor(data1$Specialization)
nn <- neuralnet(Specialization~Percentage_in_10_Class+
Percentage_in_12_Class+
Percentage_in_Under_Graduate+
percentage_MBA,data=data1,
hidden=c(3,3,3),
linear.output=FALSE,
threshold=0.01)
#hidden---c(m,n, o,...), m, n, o= number of neurons in 1,2,3...layer
nn$result.matrix
plot(nn)
#-----------------
library(caret)
library(nnet)
data1$Specialization<-as.factor(data1$Specialization)
nn1<-train(Specialization~Percentage_in_10_Class+
Percentage_in_12_Class+
Percentage_in_Under_Graduate+
percentage_MBA,data=data1, method= "nnet",
Size=4, maxit =50)
#size is the number of neurons in hidden layer
nn1
predict1<-predict(nn1,data1)
confusionMatrix(data1$Specialization,predict1)
#----------
nn1<-train( percentage_MBA~Percentage_in_10_Class+
Percentage_in_12_Class+
Percentage_in_Under_Graduate,
data=data1, method= "nnet")
nn1
predict1<-predict(nn1,data1)
RMSE(predict1,data1$percentage_MBA)
No comments:
Post a Comment