www.crosshyou.info

政府統計の総合窓口のデータや、OECDやUCIやのデータを使って、Rの練習をしています。ときどき、読書記録も載せています。

World Bank's Pregnant women receiving prenatal care (%) data analysis 7 - Random Forest Method with "tidymodel"

Generated by Bing Image Creator: Long view photo of Yakushima Island

www.crosshyou.info

This post is following of the above post. In the above post, I use Logistinc Regression to predict ninety. In this post I will use Random Forest.

I refere to tidymodels - Evaluate your model with resampling

First, I create Random Forest model.

Next, I will make workflow.

I use the same recipe in the previous post.

Next, I use fit() to training.

Then, predict ninety with test_data.

Let's make a ROC Curve Plot.

Let's calcurate ROC Area.

The ROC Area predicted by Logistic Regression in the previous post is 0.789. So, Random Forest is slightly worse than Logistic Regression.

Let's calculate Accuracy.

Accuracy of Logistic Regression in the previous post is 0.711. So, Random Forest is slightly better than Logistic Regression.

That's it! Thank you!

 

To read from the 1st post,

www.crosshyou.info