SlideShare a Scribd company logo
1 of 13
Download to read offline
GSP - Asian Soil
Partnership
Training Workshop on
Soil Organic Carbon
Mapping
Bangkok, Thailand,
24-29 April 2017
Yusuf YIGINI, PhD - FAO, Land and Water Division (CBL)
DAY 5 – 28 April 2017
TIME TOPIC INSTRUCTORS
8:30 - 10:30 Exploratory Data Analysis
Hands-on: Basic Spatial Operations
Dr. Yusuf Yigini, FAO
Dr. Ate Poortinga
Dr. Lucrezia Caon, FAO
10:30 - 11:00 COFFEE BREAK
11:00 - 13:00 Linear Models
Hands-on: Linear Models
13:00 - 14:00 LUNCH
14:00 - 16:00 Modelling Soil Properties
R - Spatial Multiple Linear Regression
R - Random Forests
16:00- 16:30 COFFEE BREAK
16:30 - 17:30 Hands-on
Random Forest
Random Forest
An increasingly popular data mining algorithm in
DSM and soil sciences, and even in applied sciences
in general is the Random Forests model. This
algorithm is provided in the randomForest package
and can be used for both regression and
classification.
Random Forest
Random Forests are a boosted decision tree model.
Fitting a Random Forest model in R is relatively
straightforward. It is better consulting the rhelp
files regarding the randomForest package and the
functions.
Random Forest
We will use the randomForest() function and a couple of
extractor functions to tease out some of the model fitting
diagnostics. We will use the sample() function to
randomly split the data into two parts: training and
testing.
> DSM_table2 <- read.csv("DSM_table2.csv")
> training <- sample(nrow(DSM_table2), 0.7 * nrow(DSM_table2))
> modelF <- randomForest(Value ~ dem + twi + slp + tmpd + tmpn, data =
DSM_table2[training, ],importance = TRUE, ntree = 1000)
Random Forest
The print function is to quickly assess the model fit.
print(modelF)
Call:
randomForest(formula = Value ~ dem + twi + slp + tmpd + tmpn,
data = DSM_table2[training, ], importance = TRUE, ntree = 1000)
Type of random forest: regression
Number of trees: 1000
No. of variables tried at each split: 1
Mean of squared residuals: 1.801046
% Var explained: 59.35
Random Forest
Generally, we confront this question by comparing
observed values with their predictions. Some of the more
common “quality” measures are the root mean square
error (RMSE), bias, and the R2 value
> Predicted <- predict(modelF, newdata =
DSM_table2[-training, ])
> RMSE <- sqrt(mean((DSM_table2$Value[-training] - Predicted)^2))
> RMSE
[1] 1.249491
> lm <- lm(Predicted~ DSM_table2$Value[-training])
> summary(lm)[["r.squared"]]
[1] 0.6079515
> bias <- mean(Predicted) - mean(DSM_table2$Value[-training])
> bias
[1] 0.01450241
Random Forest
plot(DSM_table2$Value[-training],Predicted)
abline(a=0,b=1,lty=2, col="red")
abline(lm, col="blue")
Random Forest
plot(DSM_table2$Value[-training],Predicted)
abline(a=0,b=1,lty=2, col="red")
abline(lm, col="blue")
regression on predicted and observed values - blue
1:1 comparison - red
Final Steps - Random Forest
Covs <- list.files(path = "C:/mc/covs", pattern = ".tif$",full.names
= TRUE)
covStack <- stack(Covs)
MapSoc <- predict(covStack, modelF, "SOCMAPofMAcedonia", format =
"GTiff", datatype = "FLT4S", overwrite = TRUE)
plot(MapSoc, main = "Random Forest model predicted 0-30cm SOC Map of
Macedonia %")
Final Steps - Random Forest
Covs <- list.files(path = "C:/mc/covs", pattern = ".tif$",full.names
= TRUE)
covStack <- stack(Covs)
MapSoc <- predict(covStack, modelF, "SOCMAPofMAcedonia", format =
"GTiff", datatype = "FLT4S", overwrite = TRUE)
plot(MapSoc, main = "Random Forest model predicted 0-30cm SOC Map of
Macedonia %")
Random Forest model predicted 0-30cm SOC Map
Exercise
Produce and plot the Soil Organic Carbon Map
Using your Multiple Linear Regression Model.
And share it here, https://goo.gl/jKxHfN

More Related Content

What's hot

Random Forest Algorithm - Random Forest Explained | Random Forest In Machine ...
Random Forest Algorithm - Random Forest Explained | Random Forest In Machine ...Random Forest Algorithm - Random Forest Explained | Random Forest In Machine ...
Random Forest Algorithm - Random Forest Explained | Random Forest In Machine ...Simplilearn
 
Decision trees & random forests
Decision trees & random forestsDecision trees & random forests
Decision trees & random forestsSC5.io
 
Exploratory data analysis data visualization
Exploratory data analysis data visualizationExploratory data analysis data visualization
Exploratory data analysis data visualizationDr. Hamdan Al-Sabri
 
From decision trees to random forests
From decision trees to random forestsFrom decision trees to random forests
From decision trees to random forestsViet-Trung TRAN
 
Text classification & sentiment analysis
Text classification & sentiment analysisText classification & sentiment analysis
Text classification & sentiment analysisM. Atif Qureshi
 
Decision Tree Algorithm With Example | Decision Tree In Machine Learning | Da...
Decision Tree Algorithm With Example | Decision Tree In Machine Learning | Da...Decision Tree Algorithm With Example | Decision Tree In Machine Learning | Da...
Decision Tree Algorithm With Example | Decision Tree In Machine Learning | Da...Simplilearn
 
Machine Learning - Splitting Datasets
Machine Learning - Splitting DatasetsMachine Learning - Splitting Datasets
Machine Learning - Splitting DatasetsAndrew Ferlitsch
 
Bias and variance trade off
Bias and variance trade offBias and variance trade off
Bias and variance trade offVARUN KUMAR
 
Random Forest and KNN is fun
Random Forest and KNN is funRandom Forest and KNN is fun
Random Forest and KNN is funZhen Li
 
Naïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptxNaïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptxShubham Jaybhaye
 
Data Science: Applying Random Forest
Data Science: Applying Random ForestData Science: Applying Random Forest
Data Science: Applying Random ForestEdureka!
 
Support Vector Machines
Support Vector MachinesSupport Vector Machines
Support Vector Machinesnextlib
 
Curse of dimensionality
Curse of dimensionalityCurse of dimensionality
Curse of dimensionalityNikhil Sharma
 
CART – Classification & Regression Trees
CART – Classification & Regression TreesCART – Classification & Regression Trees
CART – Classification & Regression TreesHemant Chetwani
 
Linear Regression vs Logistic Regression | Edureka
Linear Regression vs Logistic Regression | EdurekaLinear Regression vs Logistic Regression | Edureka
Linear Regression vs Logistic Regression | EdurekaEdureka!
 
decision tree regression
decision tree regressiondecision tree regression
decision tree regressionAkhilesh Joshi
 

What's hot (20)

Random Forest Algorithm - Random Forest Explained | Random Forest In Machine ...
Random Forest Algorithm - Random Forest Explained | Random Forest In Machine ...Random Forest Algorithm - Random Forest Explained | Random Forest In Machine ...
Random Forest Algorithm - Random Forest Explained | Random Forest In Machine ...
 
Decision trees & random forests
Decision trees & random forestsDecision trees & random forests
Decision trees & random forests
 
Decision tree and random forest
Decision tree and random forestDecision tree and random forest
Decision tree and random forest
 
Exploratory data analysis data visualization
Exploratory data analysis data visualizationExploratory data analysis data visualization
Exploratory data analysis data visualization
 
From decision trees to random forests
From decision trees to random forestsFrom decision trees to random forests
From decision trees to random forests
 
Text classification & sentiment analysis
Text classification & sentiment analysisText classification & sentiment analysis
Text classification & sentiment analysis
 
Decision Tree Algorithm With Example | Decision Tree In Machine Learning | Da...
Decision Tree Algorithm With Example | Decision Tree In Machine Learning | Da...Decision Tree Algorithm With Example | Decision Tree In Machine Learning | Da...
Decision Tree Algorithm With Example | Decision Tree In Machine Learning | Da...
 
Machine Learning - Splitting Datasets
Machine Learning - Splitting DatasetsMachine Learning - Splitting Datasets
Machine Learning - Splitting Datasets
 
Bias and variance trade off
Bias and variance trade offBias and variance trade off
Bias and variance trade off
 
Random Forest and KNN is fun
Random Forest and KNN is funRandom Forest and KNN is fun
Random Forest and KNN is fun
 
Learning from imbalanced data
Learning from imbalanced data Learning from imbalanced data
Learning from imbalanced data
 
Missing data handling
Missing data handlingMissing data handling
Missing data handling
 
Naïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptxNaïve Bayes Classifier Algorithm.pptx
Naïve Bayes Classifier Algorithm.pptx
 
Data Science: Applying Random Forest
Data Science: Applying Random ForestData Science: Applying Random Forest
Data Science: Applying Random Forest
 
Random Forest
Random ForestRandom Forest
Random Forest
 
Support Vector Machines
Support Vector MachinesSupport Vector Machines
Support Vector Machines
 
Curse of dimensionality
Curse of dimensionalityCurse of dimensionality
Curse of dimensionality
 
CART – Classification & Regression Trees
CART – Classification & Regression TreesCART – Classification & Regression Trees
CART – Classification & Regression Trees
 
Linear Regression vs Logistic Regression | Edureka
Linear Regression vs Logistic Regression | EdurekaLinear Regression vs Logistic Regression | Edureka
Linear Regression vs Logistic Regression | Edureka
 
decision tree regression
decision tree regressiondecision tree regression
decision tree regression
 

Similar to 12. Random Forest

A Study of Smoothing Methods for Relevance-Based Language Modelling of Recomm...
A Study of Smoothing Methods for Relevance-Based Language Modelling of Recomm...A Study of Smoothing Methods for Relevance-Based Language Modelling of Recomm...
A Study of Smoothing Methods for Relevance-Based Language Modelling of Recomm...Daniel Valcarce
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...ijceronline
 
Optimization of sample configurations for spatial trend estimation
Optimization of sample configurations for spatial trend estimationOptimization of sample configurations for spatial trend estimation
Optimization of sample configurations for spatial trend estimationAlessandro Samuel-Rosa
 
Bayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type iBayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type iAlexander Decker
 
Bayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type iBayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type iAlexander Decker
 
Método Topsis - multiple decision makers
Método Topsis  - multiple decision makersMétodo Topsis  - multiple decision makers
Método Topsis - multiple decision makersLuizOlimpio4
 
Tree net and_randomforests_2009
Tree net and_randomforests_2009Tree net and_randomforests_2009
Tree net and_randomforests_2009Matthew Magistrado
 
Reeves: Modelling & Estimating Forest Structure Attributes Using LiDAR
Reeves: Modelling & Estimating Forest Structure Attributes Using LiDARReeves: Modelling & Estimating Forest Structure Attributes Using LiDAR
Reeves: Modelling & Estimating Forest Structure Attributes Using LiDARCOGS Presentations
 
A 1 D Breakup Model For
A 1 D Breakup Model ForA 1 D Breakup Model For
A 1 D Breakup Model ForAnupam Dhyani
 
Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923Raman Kannan
 
Language Technology Enhanced Learning
Language Technology Enhanced LearningLanguage Technology Enhanced Learning
Language Technology Enhanced Learningtelss09
 
Meta heuristic based clustering of two-dimensional data using-2
Meta heuristic based clustering of two-dimensional data using-2Meta heuristic based clustering of two-dimensional data using-2
Meta heuristic based clustering of two-dimensional data using-2IAEME Publication
 
Dictionary Learning for Massive Matrix Factorization
Dictionary Learning for Massive Matrix FactorizationDictionary Learning for Massive Matrix Factorization
Dictionary Learning for Massive Matrix FactorizationArthur Mensch
 
Response Surface Methodology: In the Food Sector
Response Surface Methodology: In the Food SectorResponse Surface Methodology: In the Food Sector
Response Surface Methodology: In the Food SectorIIT Kharagpur
 
Dalut ppt. of factorial analysis of variance-b
Dalut ppt. of factorial analysis of variance-bDalut ppt. of factorial analysis of variance-b
Dalut ppt. of factorial analysis of variance-bIan Kris Lastimosa
 
Dalut ppt. of factorial analysis of variance-b
Dalut ppt. of factorial analysis of variance-bDalut ppt. of factorial analysis of variance-b
Dalut ppt. of factorial analysis of variance-bIan Kris Lastimosa
 
Dalut ppt. of factorial analysis of variance-b
Dalut ppt. of factorial analysis of variance-bDalut ppt. of factorial analysis of variance-b
Dalut ppt. of factorial analysis of variance-bIan Kris Lastimosa
 
CVPR2015 reading "Global refinement of random forest"
CVPR2015 reading "Global refinement of random forest"CVPR2015 reading "Global refinement of random forest"
CVPR2015 reading "Global refinement of random forest"Akisato Kimura
 

Similar to 12. Random Forest (20)

13. Random forest
13. Random forest13. Random forest
13. Random forest
 
A Study of Smoothing Methods for Relevance-Based Language Modelling of Recomm...
A Study of Smoothing Methods for Relevance-Based Language Modelling of Recomm...A Study of Smoothing Methods for Relevance-Based Language Modelling of Recomm...
A Study of Smoothing Methods for Relevance-Based Language Modelling of Recomm...
 
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...IJCER (www.ijceronline.com) International Journal of computational Engineerin...
IJCER (www.ijceronline.com) International Journal of computational Engineerin...
 
Optimization of sample configurations for spatial trend estimation
Optimization of sample configurations for spatial trend estimationOptimization of sample configurations for spatial trend estimation
Optimization of sample configurations for spatial trend estimation
 
Bayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type iBayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type i
 
Bayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type iBayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type i
 
Método Topsis - multiple decision makers
Método Topsis  - multiple decision makersMétodo Topsis  - multiple decision makers
Método Topsis - multiple decision makers
 
Tree net and_randomforests_2009
Tree net and_randomforests_2009Tree net and_randomforests_2009
Tree net and_randomforests_2009
 
Reeves: Modelling & Estimating Forest Structure Attributes Using LiDAR
Reeves: Modelling & Estimating Forest Structure Attributes Using LiDARReeves: Modelling & Estimating Forest Structure Attributes Using LiDAR
Reeves: Modelling & Estimating Forest Structure Attributes Using LiDAR
 
A 1 D Breakup Model For
A 1 D Breakup Model ForA 1 D Breakup Model For
A 1 D Breakup Model For
 
Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923
 
Language Technology Enhanced Learning
Language Technology Enhanced LearningLanguage Technology Enhanced Learning
Language Technology Enhanced Learning
 
Meta heuristic based clustering of two-dimensional data using-2
Meta heuristic based clustering of two-dimensional data using-2Meta heuristic based clustering of two-dimensional data using-2
Meta heuristic based clustering of two-dimensional data using-2
 
Dictionary Learning for Massive Matrix Factorization
Dictionary Learning for Massive Matrix FactorizationDictionary Learning for Massive Matrix Factorization
Dictionary Learning for Massive Matrix Factorization
 
Undergraduate Modeling Workshop - Hierarchical Models for Sparsely Sampled Hi...
Undergraduate Modeling Workshop - Hierarchical Models for Sparsely Sampled Hi...Undergraduate Modeling Workshop - Hierarchical Models for Sparsely Sampled Hi...
Undergraduate Modeling Workshop - Hierarchical Models for Sparsely Sampled Hi...
 
Response Surface Methodology: In the Food Sector
Response Surface Methodology: In the Food SectorResponse Surface Methodology: In the Food Sector
Response Surface Methodology: In the Food Sector
 
Dalut ppt. of factorial analysis of variance-b
Dalut ppt. of factorial analysis of variance-bDalut ppt. of factorial analysis of variance-b
Dalut ppt. of factorial analysis of variance-b
 
Dalut ppt. of factorial analysis of variance-b
Dalut ppt. of factorial analysis of variance-bDalut ppt. of factorial analysis of variance-b
Dalut ppt. of factorial analysis of variance-b
 
Dalut ppt. of factorial analysis of variance-b
Dalut ppt. of factorial analysis of variance-bDalut ppt. of factorial analysis of variance-b
Dalut ppt. of factorial analysis of variance-b
 
CVPR2015 reading "Global refinement of random forest"
CVPR2015 reading "Global refinement of random forest"CVPR2015 reading "Global refinement of random forest"
CVPR2015 reading "Global refinement of random forest"
 

More from FAO

Nigeria
NigeriaNigeria
NigeriaFAO
 
Niger
NigerNiger
NigerFAO
 
Namibia
NamibiaNamibia
NamibiaFAO
 
Mozambique
MozambiqueMozambique
MozambiqueFAO
 
Zimbabwe takesure
Zimbabwe takesureZimbabwe takesure
Zimbabwe takesureFAO
 
Zimbabwe
ZimbabweZimbabwe
ZimbabweFAO
 
Zambia
ZambiaZambia
ZambiaFAO
 
Togo
TogoTogo
TogoFAO
 
Tanzania
TanzaniaTanzania
TanzaniaFAO
 
Spal presentation
Spal presentationSpal presentation
Spal presentationFAO
 
Rwanda
RwandaRwanda
RwandaFAO
 
Nigeria uponi
Nigeria uponiNigeria uponi
Nigeria uponiFAO
 
The multi-faced role of soil in the NENA regions (part 2)
The multi-faced role of soil in the NENA regions (part 2)The multi-faced role of soil in the NENA regions (part 2)
The multi-faced role of soil in the NENA regions (part 2)FAO
 
The multi-faced role of soil in the NENA regions (part 1)
The multi-faced role of soil in the NENA regions (part 1)The multi-faced role of soil in the NENA regions (part 1)
The multi-faced role of soil in the NENA regions (part 1)FAO
 
Agenda of the launch of the soil policy brief at the Land&Water Days
Agenda of the launch of the soil policy brief at the Land&Water DaysAgenda of the launch of the soil policy brief at the Land&Water Days
Agenda of the launch of the soil policy brief at the Land&Water DaysFAO
 
Agenda of the 5th NENA Soil Partnership meeting
Agenda of the 5th NENA Soil Partnership meetingAgenda of the 5th NENA Soil Partnership meeting
Agenda of the 5th NENA Soil Partnership meetingFAO
 
The Voluntary Guidelines for Sustainable Soil Management
The Voluntary Guidelines for Sustainable Soil ManagementThe Voluntary Guidelines for Sustainable Soil Management
The Voluntary Guidelines for Sustainable Soil ManagementFAO
 
GLOSOLAN - Mission, status and way forward
GLOSOLAN - Mission, status and way forwardGLOSOLAN - Mission, status and way forward
GLOSOLAN - Mission, status and way forwardFAO
 
Towards a Global Soil Information System (GLOSIS)
Towards a Global Soil Information System (GLOSIS)Towards a Global Soil Information System (GLOSIS)
Towards a Global Soil Information System (GLOSIS)FAO
 
GSP developments of regional interest in 2019
GSP developments of regional interest in 2019GSP developments of regional interest in 2019
GSP developments of regional interest in 2019FAO
 

More from FAO (20)

Nigeria
NigeriaNigeria
Nigeria
 
Niger
NigerNiger
Niger
 
Namibia
NamibiaNamibia
Namibia
 
Mozambique
MozambiqueMozambique
Mozambique
 
Zimbabwe takesure
Zimbabwe takesureZimbabwe takesure
Zimbabwe takesure
 
Zimbabwe
ZimbabweZimbabwe
Zimbabwe
 
Zambia
ZambiaZambia
Zambia
 
Togo
TogoTogo
Togo
 
Tanzania
TanzaniaTanzania
Tanzania
 
Spal presentation
Spal presentationSpal presentation
Spal presentation
 
Rwanda
RwandaRwanda
Rwanda
 
Nigeria uponi
Nigeria uponiNigeria uponi
Nigeria uponi
 
The multi-faced role of soil in the NENA regions (part 2)
The multi-faced role of soil in the NENA regions (part 2)The multi-faced role of soil in the NENA regions (part 2)
The multi-faced role of soil in the NENA regions (part 2)
 
The multi-faced role of soil in the NENA regions (part 1)
The multi-faced role of soil in the NENA regions (part 1)The multi-faced role of soil in the NENA regions (part 1)
The multi-faced role of soil in the NENA regions (part 1)
 
Agenda of the launch of the soil policy brief at the Land&Water Days
Agenda of the launch of the soil policy brief at the Land&Water DaysAgenda of the launch of the soil policy brief at the Land&Water Days
Agenda of the launch of the soil policy brief at the Land&Water Days
 
Agenda of the 5th NENA Soil Partnership meeting
Agenda of the 5th NENA Soil Partnership meetingAgenda of the 5th NENA Soil Partnership meeting
Agenda of the 5th NENA Soil Partnership meeting
 
The Voluntary Guidelines for Sustainable Soil Management
The Voluntary Guidelines for Sustainable Soil ManagementThe Voluntary Guidelines for Sustainable Soil Management
The Voluntary Guidelines for Sustainable Soil Management
 
GLOSOLAN - Mission, status and way forward
GLOSOLAN - Mission, status and way forwardGLOSOLAN - Mission, status and way forward
GLOSOLAN - Mission, status and way forward
 
Towards a Global Soil Information System (GLOSIS)
Towards a Global Soil Information System (GLOSIS)Towards a Global Soil Information System (GLOSIS)
Towards a Global Soil Information System (GLOSIS)
 
GSP developments of regional interest in 2019
GSP developments of regional interest in 2019GSP developments of regional interest in 2019
GSP developments of regional interest in 2019
 

Recently uploaded

Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 

Recently uploaded (20)

Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 

12. Random Forest

  • 1. GSP - Asian Soil Partnership Training Workshop on Soil Organic Carbon Mapping Bangkok, Thailand, 24-29 April 2017 Yusuf YIGINI, PhD - FAO, Land and Water Division (CBL)
  • 2. DAY 5 – 28 April 2017 TIME TOPIC INSTRUCTORS 8:30 - 10:30 Exploratory Data Analysis Hands-on: Basic Spatial Operations Dr. Yusuf Yigini, FAO Dr. Ate Poortinga Dr. Lucrezia Caon, FAO 10:30 - 11:00 COFFEE BREAK 11:00 - 13:00 Linear Models Hands-on: Linear Models 13:00 - 14:00 LUNCH 14:00 - 16:00 Modelling Soil Properties R - Spatial Multiple Linear Regression R - Random Forests 16:00- 16:30 COFFEE BREAK 16:30 - 17:30 Hands-on
  • 4. Random Forest An increasingly popular data mining algorithm in DSM and soil sciences, and even in applied sciences in general is the Random Forests model. This algorithm is provided in the randomForest package and can be used for both regression and classification.
  • 5. Random Forest Random Forests are a boosted decision tree model. Fitting a Random Forest model in R is relatively straightforward. It is better consulting the rhelp files regarding the randomForest package and the functions.
  • 6. Random Forest We will use the randomForest() function and a couple of extractor functions to tease out some of the model fitting diagnostics. We will use the sample() function to randomly split the data into two parts: training and testing. > DSM_table2 <- read.csv("DSM_table2.csv") > training <- sample(nrow(DSM_table2), 0.7 * nrow(DSM_table2)) > modelF <- randomForest(Value ~ dem + twi + slp + tmpd + tmpn, data = DSM_table2[training, ],importance = TRUE, ntree = 1000)
  • 7. Random Forest The print function is to quickly assess the model fit. print(modelF) Call: randomForest(formula = Value ~ dem + twi + slp + tmpd + tmpn, data = DSM_table2[training, ], importance = TRUE, ntree = 1000) Type of random forest: regression Number of trees: 1000 No. of variables tried at each split: 1 Mean of squared residuals: 1.801046 % Var explained: 59.35
  • 8. Random Forest Generally, we confront this question by comparing observed values with their predictions. Some of the more common “quality” measures are the root mean square error (RMSE), bias, and the R2 value > Predicted <- predict(modelF, newdata = DSM_table2[-training, ]) > RMSE <- sqrt(mean((DSM_table2$Value[-training] - Predicted)^2)) > RMSE [1] 1.249491 > lm <- lm(Predicted~ DSM_table2$Value[-training]) > summary(lm)[["r.squared"]] [1] 0.6079515 > bias <- mean(Predicted) - mean(DSM_table2$Value[-training]) > bias [1] 0.01450241
  • 10. Random Forest plot(DSM_table2$Value[-training],Predicted) abline(a=0,b=1,lty=2, col="red") abline(lm, col="blue") regression on predicted and observed values - blue 1:1 comparison - red
  • 11. Final Steps - Random Forest Covs <- list.files(path = "C:/mc/covs", pattern = ".tif$",full.names = TRUE) covStack <- stack(Covs) MapSoc <- predict(covStack, modelF, "SOCMAPofMAcedonia", format = "GTiff", datatype = "FLT4S", overwrite = TRUE) plot(MapSoc, main = "Random Forest model predicted 0-30cm SOC Map of Macedonia %")
  • 12. Final Steps - Random Forest Covs <- list.files(path = "C:/mc/covs", pattern = ".tif$",full.names = TRUE) covStack <- stack(Covs) MapSoc <- predict(covStack, modelF, "SOCMAPofMAcedonia", format = "GTiff", datatype = "FLT4S", overwrite = TRUE) plot(MapSoc, main = "Random Forest model predicted 0-30cm SOC Map of Macedonia %") Random Forest model predicted 0-30cm SOC Map
  • 13. Exercise Produce and plot the Soil Organic Carbon Map Using your Multiple Linear Regression Model. And share it here, https://goo.gl/jKxHfN