Mean of squared residuals: 0.4278436 % Var explained: 90.23 > plot(Solu.train$log10sol,predict(solu.final),xlab="Actual Solubility", ylab = "Predicted Solubility") > abline(0,1,lwd=3,col="blue") As there are 227 predictors in our model, it would be helpful to know which are important. The varImpPlot randomForest function in the library will plot the most important predictors in the forest. > varImpPlot(solu.final) How does solubility change as a function of the top four numeric predictors? The command partialPlot in the randomForest library will display relationship between the response and the predictor of interest. > par(mfrow=c(2,2)) > partialPlot(solu.final,Solu.train,MolWeight) > partialPlot(solu.final,Solu.train,NumCarbon) > partialPlot(solu.final,Solu.train,NumNonHBonds) > partialPlot(solu.final,Solu.train,SurfaceArea1) plotmo The package is a general plotting package for plotting models of various types including random forest. > plotmo(solu.final) Finally we predict the of the test cases. > ypred = predict(solu.final,newdata=Solu.test) > PredAcc(Solu.test$log10sol,ypred) RMSEP =============== 0.6470864 MAE =============== 0.4559606
Mean of squared residuals: 0.4278436 % Var explained: 90.23 > plot(Solu.train$log10sol,predict(solu.final),xlab="Actual Solubility", ylab = "Predicted Solubility") > abline(0,1,lwd=3,col="blue") As there are 227 predictors in our model, it would be helpful to know which are important. The function varImpPlot in the randomForest library will plot the most important predictors in the forest. > varImpPlot(solu.final) How does solubility change as a function of the top four numeric predictors? The command partialPlot in the randomForest library will display relationship between the response and the predictor of interest. > par(mfrow=c(2,2)) > partialPlot(solu.final,Solu.train,MolWeight) > partialPlot(solu.final,Solu.train,NumCarbon) > partialPlot(solu.final,Solu.train,NumNonHBonds) > partialPlot(solu.final,Solu.train,SurfaceArea1) The plotmo package is a general plotting package for plotting models of various types including random forest. > plotmo(solu.final) Finally we predict the of the test cases. > ypred = predict(solu.final,newdata=Solu.test) > PredAcc(Solu.test$log10sol,ypred) RMSEP =============== 0.6470864 MAE =============== 0.4559606
Handout%204.2%20-Tree%20Models%20for%20Regression.docx