<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mariana Fontenele on Medium]]></title>
        <description><![CDATA[Stories by Mariana Fontenele on Medium]]></description>
        <link>https://medium.com/@marifontenele?source=rss-e9a64c18d10c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*87KWmQMQ8HueMFQAh6SW5w.jpeg</url>
            <title>Stories by Mariana Fontenele on Medium</title>
            <link>https://medium.com/@marifontenele?source=rss-e9a64c18d10c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 15:41:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@marifontenele/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Amazon rainforest: deforestation study from 2008 to 2019]]></title>
            <link>https://marifontenele.medium.com/amazon-rainforest-deforestation-study-from-2008-to-2019-e1216be9f7ab?source=rss-e9a64c18d10c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1216be9f7ab</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[deforestation]]></category>
            <category><![CDATA[amazon]]></category>
            <dc:creator><![CDATA[Mariana Fontenele]]></dc:creator>
            <pubDate>Thu, 25 Feb 2021 20:13:53 GMT</pubDate>
            <atom:updated>2021-04-23T15:06:56.113Z</atom:updated>
            <content:encoded><![CDATA[<p>Combining Rural industry, Social &amp; Economic and Legal protected areas data to find which factors have greater impact on deforestation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MmMfruZ-H4bhtzMMFN5opQ.jpeg" /></figure><p><a href="https://github.com/MariFontenele/AmazonRainforest/blob/main/Amazon.ipynb">MariFontenele/AmazonRainforest</a></p><p><strong>Deforestation data</strong></p><p>The data examined in this study is from <a href="http://terrabrasilis.dpi.inpe.br/">Terrabrasilis — Plataforma de dados geográficos — INPE</a>. It is the Brazilian government organization that supervise the Amazon rainforest area. Here, the focus is going to be on deforestation data throughout the years 2008 to 2019</p><p><strong>Counties: the ground for analysis</strong></p><p>The first step is to situate the geospacial deforestation data into the basis for our analysis: Legal Amazon counties. All other sources of data are going to be on this same frame. A geopandas spatial join function is used to find the placement of each deforestation focus</p><pre>df1 = gpd.sjoin(df year, mun, how=&#39;inner&#39;, op=&#39;within&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*RZcSuEKMGoOcU3aJ5T5qwQ.png" /></figure><p><strong>Target variable</strong></p><p>The variable we are interested in is deforestation. More specifically the cumulative deforestation from 2008 to 2019</p><p>Since ~20% of Counties doesn’t have any deforestation area, the rest of the Counties with deforestation (~80%) are going to be divided into quartiles</p><pre>def_acc_not_zero = df_countie[df_countie[&#39;def_acc&#39;] != 0]<br><br>def_acc_not_zero[&#39;def_acc_quartile&#39;] = 0</pre><pre>def_acc_not_zero[&#39;def_acc_quartile&#39;] = pd.qcut(def_acc_not_zero[&#39;def_acc&#39;], q=4, duplicates=&#39;drop&#39;)</pre><p>Therefore, the data is divided into quintiles: <strong>high-high</strong>, <strong>high-low</strong>, <strong>low-high</strong>, <strong>low-low</strong> and <strong>zero</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*wIHNuK3GcQ55gB8Hui2xDQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*JjpxKxibNDu2Oo96lnDWgg.png" /></figure><p>However, the <strong>goal is to train the model to predict only the <em>high-high</em> class</strong>, so it is going to be <strong>set to True (or 1)</strong> and <strong>all the other classes will be set to False (or 0)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*YFmXtTik22Iy7flWnGpSdQ.png" /></figure><p><strong>Predictive features</strong></p><p>Now it’s time to gather other sources of data that potentially have impact on</p><p>deforestation. Three categories are going to be considered:</p><ul><li><strong>Rural Industry</strong>: the Agriculture (acres cultivated) and Cattle farming (bovine head) per county</li><li><strong>Social &amp; Economic</strong>: estimated GDP per county and Human Development Index metrics — HDI, Income HDI, Education HDI, Longevity HDI</li><li><strong>Legal protected areas</strong>: spatial data with indigenous areas to show if the deforestation is happening there. The counties will have a True or False classification that demonstrates if any proportion of deforestation of that particular county is happening in protected reserves</li></ul><p>In harmony with the cumulative deforestation target, the Agriculture, Cattle and GDP data throughout the years of 2008 to 2019 area also going to be cumulative of all period considered. Only the Human Development Indexes of counties are going to be constant</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*y_RqeRiwMizq9Wfr6u49aQ.jpeg" /></figure><h3><strong>Exploratory data analysis</strong></h3><p>The EDA of the study is divided into two parts: i) a quick univariate and multivariate descriptive analysis and ii) hypothesis driven analysis. Only the highlights are going to be shared here since it was an extensive investigation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*GZbNa8_EgosrGgIErqz9Kg.png" /><figcaption>Amazon rainforest — Dataset mindmap</figcaption></figure><p><strong>Pearson correlation</strong></p><p>The correlation analysis is important to get a feeling about which features are later going to be considered relevant by the algorithms</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*54ta2KBvHWPNzcwjOo9X7g.png" /></figure><p><strong>cattle_acc</strong>: cumulative cattle demonstrated an impressive positive correlation of 0.57 with cumulative deforestation while the agriculture cumulative data indicated only 0.015 correlation; this relevance will be further confirmed by the Machine Learning algorithms</p><p><strong>area_countie</strong>: has a positive correlation of 0.52. It makes sense that big areas have bigger cumulative deforestation since there are more area to deforest; once we are aiming to predict external and not intrinsic characteristics, this feature will not be in the model. However, it is interesting that cumulative cattle has a correlation bigger even than the correlation with the area of the counties which is naturally high</p><p><strong>HDI_educacao</strong>: it is also intriguing that Education Human Development Index demonstrated a negative correlation with cumulative deforestation of -0.14. This relevance will also be confirmed with the Machine Learning Modelling</p><h4>Hypothesis driven analysis</h4><p>In harmony with the target variable classification, the framework of this analysis is also based on quintiles. The goal is to find out if the top 20% of others sources of data coincided with the top 20% cumulative deforestation counties (target). Here it’s a summary of all the hypothesis considered. However, in this article only the highlight findings will be detailed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*kn04ML-VEuwO07g44w22nQ.png" /><figcaption>Hypothesis driven EDA — summary</figcaption></figure><p><strong>Rural Industry: agriculture x cattle</strong></p><p>In line with the correlation analysis, the top quintile of cumulative deforestation and cumulative cattle share ~52% of counties. It is worth seeing if the Machine Learning algorithms will also consider Cattle farming a great predictor for cumulative deforestation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*0HyN9ZdSzi7jKn7b_-WZyg.png" /></figure><p>On the other hand, the top quintile of agriculture and cumulative deforestation share ~38% of counties</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*Hqejy6kumPJosCMeR-5OgQ.png" /></figure><p><strong>Social &amp; Economic: GDP and Education HDI</strong></p><p>Counties in the top quintile of cumulative Gross Domestic Product (GDP) share ~40% of counties with the top cumulative deforestation quintile</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*9KDVu5uR-W7u-VHOw45RPw.png" /></figure><p>Since the correlation analysis reveled a negative correlation, the lowest quintile of Education Human Development Index (HDI) and the top quintile of cumulative deforestation share nearly ~1/3 of counties</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*QUFFe5t30eQtBSAK8B2qiQ.png" /></figure><h3>Machine Learning modelling overview</h3><p>The type of Machine Learning algorithm used here is Classification since this is a prediction of the high-high cumulative deforestation class. Specifically, this four algorithms will be trained on the dataset:</p><p><strong>Random Forest</strong>: it is a tree based model built with multiple ensemble decision trees created with the bagging method. Then, all the classifiers take a weighted vote on their predictions. Since the algorithm goal is not trying to find a linear function to describe the event, it works for problems with more complex behaviour</p><p><strong>Extremely Randomized Trees</strong>: it works on the same logic of Random Forest, but instead of using multiple ensemble bootstrap replicas, it uses the original sample. The randomization is added on the cut point to splitting the tree nodes, while the previous algorithm chooses the best optimum split, the Extremely Randomized Trees chooses it randomly</p><p><strong>XGBoost</strong>: it is also a tree based model but they are built in a different way. While Random Forests builds each tree independently, XGBoost builds one tree at the time learning with its predecessor. Therefore, this algorithm doesn’t combine results at the end of the process by taking majority votes, it combines the results along the way</p><p><strong>CatBoost</strong>: this model share the same logic of XGBoost, however the focus is in optimizing the decision trees for categorical variables. The goal is to work better with features with classes that have relation with one another like, for example, different colors</p><p><strong>Performance comparison</strong></p><p>In the Class Prediction Error report we can see that the algorithms performed almost the same, but CatBoost behaved slightly worse in this dataset</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0WpfJSoazUKu4WXP69qB1Q.png" /></figure><p>Comparing the ROC AUC curve and the Precision-Recall curve they performed virtually the same</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tBxV5Ukx6RL_fq7kTVf_uQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*28aVCj1QOWJ-ZBgBSxg7bg.png" /></figure><p>However, the mean Cross Validation score of CatBoost was not as good as the others</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cYBV1xYekaGVuFE053aEjQ.png" /></figure><p>With all this in mind, here I’ll consider that all algorithms performed virtually the same except CatBoost that had a lower efficiency. Therefore, CatBoost is not going to be part of the feature importance analysis</p><p><strong>Feature importance analysis</strong></p><p>For this study, <strong>this is the most meaningful analysis </strong>since the goal is to find out which features the Machine Learning algorithms are considering more important for predicting the high-high cumulative deforestation class. Features with ‘<em>_acc’ </em>endings are the cumulative variables and ‘<em>_class</em>’ are variables with the quintile classification from 0 to 4</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*pfFTdvg4i_o0HCGDbJbogg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*de4k2OhG1b0ayWU8-3dogw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*kEfYMNhh6G0CpCiLr6MPnA.png" /></figure><h3><strong>Conclusion</strong></h3><p>In conformity with the previous Exploratory Data Analysis, <strong>Cattle farming is, overall, the most predicting feature for cumulative deforestation in this period of time</strong>.</p><p>It is important to emphasize that the study found a <strong>great correlation </strong>between cattle farming and deforestation, <strong>which does not <em>necessarily</em> imply causation</strong>. However, we can draw three hypothesis:</p><ol><li>The first hypothesis is that the <strong>deforestation is being caused with the only goal</strong> to <strong>use the land for cattle farming</strong>;</li><li>The second hypothesis is that the forest is being deforested <strong>with another purpose such as traffic of wood</strong>, which is very common in these regions, and later <strong>people that was not responsible for the deforestation use those areas for cattle farming</strong>;</li><li>The third hypothesis is that the <strong>same people that was responsible for the deforestation for other reasons</strong> are the <strong>same ones that later use it for cattle farming</strong>;</li></ol><p>Deforested areas are great to raise cattle because only grass or low maintenance vegetation is needed for the animals to eat and, in some cases, not even that is necessary because cattle may not go outdoors and just the area is needed.</p><p>The same cannot be said about agriculture, because when the soil of a forest such as Amazon is deforested it is not good for growing new things without an intensive treatment. Therefore, usually <strong>farming</strong> <strong>cattle in deforested areas is much more convenient than growing agriculture</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UBVfKNHilVkLPSDVOmS5MQ.jpeg" /></figure><p><strong>GDP</strong> of the counties is the s<strong>econd factor that the algorithms considered relevant</strong> for predicting high-high deforestation class</p><p>In third place, <strong>Education Human Development Index </strong>reveled an interesting <strong>negative correlation with counties that had the biggest deforestation</strong> areas during this time</p><p>The <strong>fourth place is Agriculture</strong> that also exhibited a positive correlation with counties with greater deforestation; <strong>however, this relationship is not as significant as the Cattle farming</strong></p><p>It is also worth mentioning that even though it’s not as relevant for prediction, <strong>counties that have deforestation in indigenous areas</strong>, classification equals to True or 1,<strong> </strong>demonstrated a<strong> positive correlation with high-high deforestation</strong></p><h3>Sources</h3><p>The data is <strong>public available</strong>:</p><p><strong>INPE</strong> — Instituto Nacional de Pesquisas Espaciais:</p><p><strong>deforestation</strong>: <a href="http://terrabrasilis.dpi.inpe.br/geonetwork/srv/eng/catalog.search#/metadata/a5220c18-f7fa-4e3e-b39b-feeb3ccc4830">http://terrabrasilis.dpi.inpe.br/geonetwork/srv/eng/catalog.search#/metadata/a5220c18-f7fa-4e3e-b39b-feeb3ccc4830</a></p><p><strong>legal amazon counties map</strong>: <a href="http://terrabrasilis.dpi.inpe.br/geonetwork/srv/eng/catalog.search#/metadata/5d16e199-e534-44ca-bcf3-e59964e47b5f">http://terrabrasilis.dpi.inpe.br/geonetwork/srv/eng/catalog.search#/metadata/5d16e199-e534-44ca-bcf3-e59964e47b5f</a></p><p><strong>indigenous areas</strong>: <a href="http://terrabrasilis.dpi.inpe.br/geonetwork/srv/eng/catalog.search#/metadata/5d16e199-e534-44ca-bcf3-e59964e47b5f">http://terrabrasilis.dpi.inpe.br/geonetwork/srv/eng/catalog.search#/metadata/5d16e199-e534-44ca-bcf3-e59964e47b5f</a></p><p><strong>IBGE</strong> — Instituto Brasileiro de Geografia e Estatística</p><p><strong>official county’s code</strong>: <a href="https://www.ibge.gov.br/explica/codigos-dos-municipios.php">https://www.ibge.gov.br/explica/codigos-dos-municipios.php</a></p><p><strong>official county’s area</strong>: <a href="https://www.ibge.gov.br/geociencias/organizacao-do-territorio/estrutura-territorial/15761-areas-dos-municipios.html?=&amp;t=downloads">https://www.ibge.gov.br/geociencias/organizacao-do-territorio/estrutura-territorial/15761-areas-dos-municipios.html?=&amp;t=downloads</a></p><p><strong>official county’s demography</strong>: <a href="https://www.ibge.gov.br/estatisticas/sociais/saude/9662-censo-demografico-2010.html?=&amp;t=downloads">https://www.ibge.gov.br/estatisticas/sociais/saude/9662-censo-demografico-2010.html?=&amp;t=downloads</a></p><p><strong>official legal amazon county’s</strong>: <a href="https://www.ibge.gov.br/geociencias/informacoes-ambientais/geologia/15819-amazonia-legal.html?=&amp;t=downloads">https://www.ibge.gov.br/geociencias/informacoes-ambientais/geologia/15819-amazonia-legal.html?=&amp;t=downloads</a></p><p><strong>estimated county’s GDP</strong>: <a href="https://sidra.ibge.gov.br/tabela/5938">https://sidra.ibge.gov.br/tabela/5938</a></p><p><strong>county’s agriculture production</strong>: <a href="https://sidra.ibge.gov.br/Tabela/1612">https://sidra.ibge.gov.br/Tabela/1612</a></p><p><strong>county’s cattle farming</strong>: <a href="https://sidra.ibge.gov.br/Tabela/73">https://sidra.ibge.gov.br/Tabela/73</a></p><p><strong>ATLAS</strong> — Atlas do Desenvolvimento Humano no Brasil</p><p><strong>county’s HDI</strong>: <a href="http://www.atlasbrasil.org.br/ranking">http://www.atlasbrasil.org.br/ranking</a></p><p>See more projects at: <a href="https://marifontenele.github.io/portfolio/">https://marifontenele.github.io/portfolio/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1216be9f7ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>