Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Random forest example
#Random Forest Example data(iris) str(iris) head(iris) attach(iris) library(randomForest) #Seperating the training and testing data Ind=sample(2, nrow(iris), replace=TRUE, prob=c(0.7, 0.3)) TrainData=iris[Ind==1, ] TestData=iris[Ind==2, ] #Building the random forest Iris_rf=randomForest(Species~.,data=TrainData,ntree=100,proximity=TRUE) #Check accuracy of the training set table(predict(Iris_rf), TrainData$Species) print(Iris_rf) plot(Iris_rf) #Using the model on the test dataset Test=predict(Iris_rf, TestData) table(Test, TestData$Species) plot(margin(Iris_rf,TestData$Species)) tune.rf=tuneRF(iris[,-5],iris[,5], stepFactor=0.5) print(tune.rf)
run
|
edit
|
history
|
help
0
Stock Data - Basics
dataset1
funções iron
Correlation
21-09-2020Intpoli
SampleDiscrFR.r
Chev-nodes
PUP LDA
Phyllotaxis in R
Carr Madan formula for Laplace distribution