install.packages("neuralnet")
install.packages("dplyr")
require(neuralnet)
NBA_Data <- read.csv("C:\\Users\\Andrew\\Downloads\\NBA_Test.csv",TRUE)
df <- data.frame(NBA_Data)
training <- data.frame(head(df,10))
tester <- data.frame(tail(df,20))
ast <- c(list(training[20]))
pts <- c(list(training[25]))
wins <- c(list(training[26]))
net_test <- data.frame(ast,pts,wins)
nn=neuralnet(wins~ast+pts,data=net_test, hidden=3,act.fct = "logistic",
linear.output = FALSE)
I'm trying to start out with neural networks and am starting by trying to shape and train with two inputs(assists and points) and one output (wins). When I run the code above I receive this error:
Error in model.frame.default(as.formula(call("~", formula[[2]])), data) :
invalid type (list) for variable 'wins'
I'm not sure why my variable type isn't valid here. Any insight is appreciated. Thanks!
Below is the data.frame net_test I created and referenced in the code:
AST PTS WINS 1 1228 5800 45 2 1191 5749 14 3 1226 5652 36 4 1243 5355 23 5 1224 5626 16 6 1160 5512 19 7 1276 6155 13 8 1390 5831 32 9 1326 5967 37 10 1336 5640 19