Skip to content

Instantly share code, notes, and snippets.

@dragstar328
Created October 16, 2015 02:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dragstar328/4aca748c7056499756f9 to your computer and use it in GitHub Desktop.
Save dragstar328/4aca748c7056499756f9 to your computer and use it in GitHub Desktop.
Rでニューラルネットワーク irisデータを判別
library(nnet)
even.n = 2*(1:75)
iris.train = iris[even.n,]
iris.test = iris[-even.n,]
iris.nnet = nnet(Species~.,size=3, decay=0.1, data = iris.train)
iris.nnetp = predict(iris.nnet, iris.test[,-5], type="class")
table(iris.test[,5], iris.nnetp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment