NASA ARSET Building Evaluating and Interpreting a SDM
The Story
Welcome to this highly analytical and ecologically vital episode of the NASA Live Video Podcast: "NASA ARSET: Building, Evaluating, and Interpreting a SDM."In this episode, we bridge the gap between spaceborne observations and biodiversity conservation to explore the end-to-end workflow of Species Distribution Modeling (SDM). As climate change and habitat loss accelerate global ecosystem shifts, knowing where vulnerable or invasive species are likely to survive is critical. Satellite remote sensing gives us the environmental layers needed to predict these ecological footprints across space and time.
Through the framework of NASA’s Applied Remote Sensing Training (ARSET) program, we break down the rigorous scientific steps required to build, evaluate, and interpret a robust SDM. We discuss how to prepare occurrence data, integrate NASA Earth observations—such as MODIS, Landsat, and GEDI terrain layers—as environmental predictors, and run predictive algorithms. Going beyond model creation, we dive deep into evaluation metrics like AUC and True Skill Statistic (TSS), and discuss how to accurately interpret the final probability maps to guide real-world wildlife management and policy decisions.
Whether you are an ecologist, a conservation biologist, a GIS developer, or a space enthusiast eager to see how satellite data maps the living world, this episode offers comprehensive, practical insights. Subscribe to the NASA Live Video Podcast to stay connected with the absolute frontier of space exploration, ecological modeling, and cutting-edge earth science!
Speaker 1: Hello. It is my pleasure to welcome you back to
Speaker 1: part two of our r set training on species distribution
Speaker 1: modeling with Google Earth Engine. Today's session is focused on building, evaluating,
Speaker 1: and interpreting species distribution models on Google Earth Engine. This
Speaker 1: training is brought to you in collaboration with the Smithsonians
Speaker 1: National Zoo and Conservation Biology Institute. My name is Sativa
Speaker 1: Cruz and I'm your host for this session. I'm an
Speaker 1: applied scientist with a Bay Area environmental Research Institute at
Speaker 1: NASA Ames Research Center. You heard from my colleague Justin
Speaker 1: Fein in part one, and pictured here is our full
Speaker 1: ecological conservation team. I'm grateful to them and the entire
Speaker 1: arset team not pictured here, who make these trainings possible.
Speaker 1: Your guest instructors are the same for this session, Ramiro Crego,
Speaker 1: Grant Connett, and Jared Stabach. Again, this is part two
Speaker 1: in our series, taking place on July fourteenth of twenty
Speaker 1: twenty six. Please note that there will be a homework
Speaker 1: assignment posted to the training page which needs to be
Speaker 1: completed in order to receive a certificate of completion. In
Speaker 1: the first session, Foundations of Species Distribution Modeling with Google
Speaker 1: Earth Engine our instructors provided an introduction to species distribution models,
Speaker 1: including an overview of core concepts, applications and considerations. Session
Speaker 1: two will focus on what it takes to build a
Speaker 1: machine learning model, providing a Google Earth Engine based workflow.
Speaker 1: Our instructors will take us through initial steps of species
Speaker 1: data uploads and pre processing, two model predictions, and all
Speaker 1: the steps that are in between. Our intention is that
Speaker 1: by the end of this training you will have achieved
Speaker 1: the learning objectives listed here and that we're reviewed in
Speaker 1: Part one. In addition to attending the first session, we
Speaker 1: encourage you to view Part two of the Land Cover
Speaker 1: Land Use Change with NASA Satellite Imagery training as a
Speaker 1: prerequisite to set yourself up for success. We also assume
Speaker 1: prior knowledge of GIS and some coding experience to participate fully.
Speaker 1: So as a reminder about how to ask questions, please
Speaker 1: put your questions in the questions box and we will
Speaker 1: address them at the end of the webinar. You can
Speaker 1: enter your questions as we go and we will try
Speaker 1: to get all through all of the questions during our
Speaker 1: Q and A session. All remaining questions will be answered
Speaker 1: in a document which will be posted to the training website.
Speaker 1: About a week after the training. Now passing the mic
Speaker 1: back to our instructors for part two.
Speaker 2: Welcome back everyone, and the idea for today is to
Speaker 2: finally get to feed a special instituition model is using
Speaker 2: Google Earth's engine. Now that we are all familiar with
Speaker 2: the basics of JavaScript and were hopefully used to the
Speaker 2: JavaScript code, we can start to try to understand this workflow.
Speaker 2: So later the idea and I show you the basics
Speaker 2: a very simple model, and then you can take it
Speaker 2: from there and start building your own models using your
Speaker 2: own data. So there are many things you can do,
Speaker 2: as we will see with this with this framework, we're
Speaker 2: presenting the idea here again is to show you the
Speaker 2: basic framework so from where you can build. So for
Speaker 2: the purpose of this class, now we're going to see
Speaker 2: how we upload our data. Remember last time we cover
Speaker 2: how you download it for example of fro GVF, I
Speaker 2: show you the predictles, what you got to do, examples
Speaker 2: exactly what we're going to use today. We're going to
Speaker 2: do some of those best practices preprocessing of the data,
Speaker 2: how we handle predictor variables, the important part of present
Speaker 2: and absence, so how we create cello absences or background points,
Speaker 2: and today we'll focus on present some solo absence we're
Speaker 2: going to fit. Finally, the models. Remember we're using machine learnings.
Speaker 2: We're going to use random forest in this particular case.
Speaker 2: And then the important aspect of how we evaluate how
Speaker 2: good our model is making predictions and visualizing those predictions.
Speaker 2: So let's start with the first step. We're getting our
Speaker 2: data into Google Earth Engine. The way we do that
Speaker 2: is uploading our data as an asset. Remember we downloaded
Speaker 2: CSB file from g Yeah, yes, you may have a
Speaker 2: SHAVE file or you may have your own data save
Speaker 2: as CSB filing. The important thing have you been you
Speaker 2: have your coordinates in geographic projection. So in W eighty
Speaker 2: four we're going to I give you here the steps.
Speaker 2: So for in this case, you will go to assets.
Speaker 2: You create a new asset, You get a CSB file.
Speaker 2: Then you creick select and select your file. You give
Speaker 2: a name and where your asset is going to be saved.
Speaker 2: And then make sure your the names of the lat
Speaker 2: longitude and latitude match the columns you have your CSB file,
Speaker 2: and also that you match the geographical coordinator system the
Speaker 2: geographical coordinate system. Then you click upload and now we'll
Speaker 2: go into your asset. So for example, seeing it from
Speaker 2: here here, we go to new we choose a CSB file,
Speaker 2: we select and I'm going to do it right now,
Speaker 2: but you can select and then you're choosing which project
Speaker 2: you want to save it. Again, make sure you have
Speaker 2: your longitude and latitude correctly named. By default, they are
Speaker 2: called longitude and latitude. It's not common to switch them
Speaker 2: around have them in the wrong place. So then your
Speaker 2: entire shifts and make sure you have your correct project
Speaker 2: Coordina reference system. Then you upload and that will become
Speaker 2: will go in one of your assets said here. Remember
Speaker 2: this taking space from your free quota of data your
Speaker 2: in Google, so be mindful of that. So this is
Speaker 2: the one we're going to be using. If you want
Speaker 2: this to be accessible by people, you have to make
Speaker 2: it publicly available. By clicking here, one can read, so
Speaker 2: any one of you can read this asset and replicate
Speaker 2: the stadium doing right now. One quick way to know
Speaker 2: the data has been uploaded correctly is that it shows
Speaker 2: here the points and it's where you are expecting it
Speaker 2: to be. So now that we are in the co
Speaker 2: editor here, I have the entire workflow that you can
Speaker 2: access through your links or through the paper link, and
Speaker 2: what I'm going to be doing is commenting out some parts.
Speaker 2: One of the things I really don't really like contrast
Speaker 2: critic is that you are running the entire codel once,
Speaker 2: not line by line like in another programs like software.
Speaker 2: But I'm going to do is go part by part.
Speaker 2: So here, if I run this code, I'm going to
Speaker 2: be reading our the data is the future collection. I'm
Speaker 2: going to get the size and printed on the console,
Speaker 2: so we know how many points we have, and I'm
Speaker 2: going to add it here to the map as with
Speaker 2: the map a liar. So if I run this, we
Speaker 2: know we have five hundred and seventy one points and
Speaker 2: these are our data. Remember I already clean this to
Speaker 2: remove wrong points and points on our cities with things
Speaker 2: we discuss in the previous lecture the previous week. So
Speaker 2: here you can have a quick look at how that
Speaker 2: looks like. Fantastic. So now we can move to the
Speaker 2: next step. That is also very important, and it's defining
Speaker 2: the spatial resolution of your analysis. What's that pixel size
Speaker 2: that you want to work with. Be careful with the
Speaker 2: ruler tangine when you are displaying imagery because on the
Speaker 2: what we call the on the fly display when you
Speaker 2: plot things here on the rasters weekly on on the
Speaker 2: on the viewer, on the map, depending the zon level
Speaker 2: you are is the pixel side you're going to be seen.
Speaker 2: But what we want to do for an analysis when
Speaker 2: we explore the raster or when we extra calculate pixel
Speaker 2: values is to define that pixel size. In our case,
Speaker 2: now we're going to use one thousand meters one kilometer resolution.
Speaker 2: Of course, the smaller that grain size, the more memory
Speaker 2: more data you're working with. So depending also who were
Speaker 2: see now at the extent and your goals, your objectives,
Speaker 2: your reserve question, a lot will depend on what kind
Speaker 2: of grainchise you're using and what type of predictor valuables
Speaker 2: you're using. Our grain size here, what I mean with
Speaker 2: this is like if we define in one thousand meters
Speaker 2: and one thousand meters every time we extract a pixel value.
Speaker 2: For example, here I have I displayed a modis MDBI
Speaker 2: with the two hundred and fifty pixel resolute. We have
Speaker 2: sixteen pixels to which we are going to get an
Speaker 2: average number for that site for that location. For this,
Speaker 2: let's say this is our presence data that will be
Speaker 2: a pixel size the same for our cell absence data,
Speaker 2: So that's the value we are extracting for analysis, so
Speaker 2: keep in mind that, and then we are going to
Speaker 2: use the same grain size for the entire workflow and
Speaker 2: when we export our final map, so we can save
Speaker 2: it as arrested and use it to display it or
Speaker 2: create maps in with another soware. The next step when
Speaker 2: we talk about some of the best practices is to
Speaker 2: kind of ratify that presence data so you're not using
Speaker 2: multiple points on the same pixel. So now we define
Speaker 2: our pixel size one square kilometer. Now we want to
Speaker 2: make sure that we don't have multiple presence points. This
Speaker 2: is very money if you're using citizen science data like
Speaker 2: in this case, without a load of these data from GVF. Again,
Speaker 2: so you may have multiple locations reported in certain areas,
Speaker 2: not necessarily because there are more animals there, but maybe
Speaker 2: because more people are reporting in that area. Now, if
Speaker 2: you use the full data set like this and you
Speaker 2: have ten presence points in the same pixel, then you
Speaker 2: are given them all the ten same values pixel values
Speaker 2: and kind of over emphasizing that pixel over other pixels.
Speaker 2: So avoid that problem, you can thin your data set.
Speaker 2: So then what we do. The solution I found when
Speaker 2: I was coding this workflow was to create a random
Speaker 2: raster with random values. So each pixel has a random
Speaker 2: value that is unique and distinct from any other pixel.
Speaker 2: So then we can extract that random value on that
Speaker 2: pixel for each point and then we just keep with
Speaker 2: this distinct function one random value, so we are ensuring
Speaker 2: we only have one final point per pixel. So that's
Speaker 2: why we kind of ratify our data set. So you
Speaker 2: can see that we go from five hundred and seventy
Speaker 2: one original points to three hundred and twenty three. So
Speaker 2: this will be what is next line of code and
Speaker 2: going to comment out with this forward slash double forward slash,
Speaker 2: So we have the grain size. This is the function
Speaker 2: to remove duplicate and we apply that functions our data
Speaker 2: and our final data that size is going to be
Speaker 2: exactly what's so there three hundred twenty three. Grant is
Speaker 2: going to talk to you about new developments and new
Speaker 2: ideas on whether this is the correct methodology or the
Speaker 2: correct thing to do with your data. You are losing
Speaker 2: data that is totally valid by removing those kind of
Speaker 2: duplicated pixel values, so some people consider that actually you're
Speaker 2: reducing data for no reason. Grant is going to explain
Speaker 2: that later on some new developments on STMs. Also, keep
Speaker 2: in mind and read the literature because a lot of
Speaker 2: these methods are different. People propose a lot of different things,
Speaker 2: so it's always good to keep in mind what is
Speaker 2: going to work best for you. But this is what
Speaker 2: we consider the time the best practice, and that's what
Speaker 2: we have implemented. You could completely ignore this function and
Speaker 2: use the entire data set if you want to. So
Speaker 2: that's the magic of having the ROW code. You can't
Speaker 2: really adapt it easily. Once you clearly, of course, understand
Speaker 2: what's going on, and that's the goal of this. We
Speaker 2: understand what's going on. The next very important thing to
Speaker 2: do is define your area of interest. So what's the
Speaker 2: area you're going to be working with. Remember we have
Speaker 2: we're working with presence only data, so we only know
Speaker 2: where the species are. We don't know where the species
Speaker 2: not or those absences we talked last week. So the
Speaker 2: idea now we have to define this of interest to
Speaker 2: work with which we will learn to create the random
Speaker 2: points to extract this background information or this creative seale
Speaker 2: to absence, to extract information environmental from environmental valuables to
Speaker 2: inform them model the algorithm where things are not present.
Speaker 2: There are many ways you could do this in ular engine,
Speaker 2: but you really have to think about this. It makes
Speaker 2: no sense if you are working with species and distributes
Speaker 2: maybe in Colombia or in the mountains, to use the
Speaker 2: entire planet to create all absences. That would be ridiculous.
Speaker 2: It makes no sense to include the ocean. If you're
Speaker 2: working with interrestrial species or vice versa, use the terrestrial
Speaker 2: ecosystems environmental environmental valuables from terrestrial ecosystems. You're trying to
Speaker 2: model species that live in the sea, So that would
Speaker 2: be a very grotesque example. Very that's very obvious example.
Speaker 2: But ideas, we want to compare what the species are
Speaker 2: where they can potentially be, so we can disentangle those
Speaker 2: areas that are the species preferred or more suitable for
Speaker 2: the for the species to exist to a cure. So
Speaker 2: that's what we're going to do, is create this area
Speaker 2: of interest geometry. You could use a lot of data
Speaker 2: cells already available in earthgia like countries, so you can get,
Speaker 2: for example, the countries Columbia with this first line of
Speaker 2: code here, or you can get the entire continent in
Speaker 2: South America. That's your goal for the workflow. We are
Speaker 2: using this where is a more simple way that is
Speaker 2: to generate the bounding box around your data set, meaning
Speaker 2: that this is where the data has been observed. So
Speaker 2: we are trying to restrain our model to areas enclosed
Speaker 2: by that bounding box. But we provide the buffer to that.
Speaker 2: In this case, we're not giving fifty kilometer buffer around
Speaker 2: in the most extreme presence locations in north south west east.
Speaker 2: So we create an outline. We can plot it, so
Speaker 2: we visualize it. So let me show you here in
Speaker 2: the call how that looks like. And when we created
Speaker 2: this workflow, the idea was to generate quickly accessed and
Speaker 2: generate these models and be able to visualize the outputs
Speaker 2: the predictions. And because we're going to have two predictions
Speaker 2: and we see later one is habitats with ability or
Speaker 2: the probability that a species is present at any pixel
Speaker 2: any sight. But also we can't have this binary maps
Speaker 2: is potential distribution. What is the potential distribution of the species.
Speaker 2: So we divided the map the map here in two
Speaker 2: by doing this little code here. So if I run
Speaker 2: this now, you will wish. You will see I haven't
Speaker 2: centered yet. You will first see plotting the data in
Speaker 2: both maps and then defining the study area here, generating
Speaker 2: the outline and plotting it in both maps as well.
Speaker 2: So now we have the points with the outline that's
Speaker 2: going to be our area of interest. Now that we
Speaker 2: are we have created right and left map, so instead
Speaker 2: of calling maps a layer where you're seeing right and
Speaker 2: left every time we want to plot something, and we're
Speaker 2: centering the map towards our area of interest. This number
Speaker 2: controls the zoom level, so you can experiment changing those
Speaker 2: things to visualize. But you can also change the zoom
Speaker 2: of course right here in the map with your mouse
Speaker 2: or with these two buttons. Fantastic. So at this point
Speaker 2: we now have our presence locations, we have, we have
Speaker 2: ratified those, we define our area of interest, and we
Speaker 2: define our pixel size that we want to work with.
Speaker 2: The next step is probably the one. As I mentioned before,
Speaker 2: we are making things in Earth Engine makes the most sense,
Speaker 2: and it is loading our and selecting our predictor valuables
Speaker 2: so we can take advantage of this massive catalog of
Speaker 2: craster imagery available in Cooler Engine, so you can inspect
Speaker 2: the catalog, and remember you go to the search and
Speaker 2: you can look for NDBI and normalize different vegetation index
Speaker 2: and you will have a lot of different ones. For example,
Speaker 2: the mode is sixteen day one kilometer research a composite
Speaker 2: could make sense to include it in our model as
Speaker 2: this would be surrogate for vegetation productivity that could inform
Speaker 2: habitat for this lot. As I mentioned before, I always
Speaker 2: highly recommend you looking into the Cooler Engine community catalog
Speaker 2: where there is a lot of more information available. Highly
Speaker 2: recommend you to go play. You always have a description
Speaker 2: of the data set, the paper where it was published,
Speaker 2: how you cited, if you use it, and generally you
Speaker 2: will have a sample code you can open or sometimes
Speaker 2: you even get the good at engine Eye to explore it.
Speaker 2: Not show you the data set that I have been
Speaker 2: using quite a bit lately. That this high resolution one
Speaker 2: meter global cannot be high from tolenal and I click
Speaker 2: on the I have it already run here, but it's
Speaker 2: quite amazing to have this kind of level of information,
Speaker 2: detailed information on forest cover you can swim in and see.
Speaker 2: Compare the high resolution imagery with cannot behave or if
Speaker 2: you transform that into keeping only pixels with more than
Speaker 2: one meter, you can get this kind of cannot pick
Speaker 2: cover one meter resolution, what is crazy? Just to give
Speaker 2: you an idea of the amount of really high resolution
Speaker 2: and and things that maybe your computer may not be
Speaker 2: able to handle. If you want to download stuff like
Speaker 2: this again, which break the variable you use will depend
Speaker 2: a lot on the type of question you're asking. But
Speaker 2: I just wanted to show you so you you know
Speaker 2: that these things exist and showcasing why Goular engine can
Speaker 2: be so powerful. I want you close this too now.
Speaker 2: And another thing I mentioned before is where I think
Speaker 2: Googler tension can also be very powerful is using the
Speaker 2: roads at data's predictor variable. So here I show you
Speaker 2: this before this paper these few papers I mentioned, but
Speaker 2: using the raw lands automatic mappers as predictors what makes sense.
Speaker 2: So instead of using a classification and carrying on all
Speaker 2: that error is already into that classification for different type
Speaker 2: of land uses, you just use a road satellite data
Speaker 2: to inform the model of this suitable habitat. We actually
Speaker 2: did this recently and this paper let's called validating Habitats
Speaker 2: with a bit accessment with potranslocation movement data. So suitable
Speaker 2: habit maps can be very valuable for translocation species, but
Speaker 2: it's very hard to get data to actually validated after
Speaker 2: the introduction happened the re introduction. So in this case
Speaker 2: we train them all that one hundred meters resolution you
Speaker 2: see landsat and other valuables. I will show you know
Speaker 2: the code you seeing data from giraffe in Namibia, and
Speaker 2: then we created a model of potential suitability in Angola
Speaker 2: in ur National Park where fourteen animals were re introduced.
Speaker 2: Actually it's brought back then called giraffe into Angola. Level
Speaker 2: was really extraordinary, but look at the predictions and where
Speaker 2: the giraffe moved a year after they were reintroduced, was
Speaker 2: quite quite incredible to see the capacity of the model
Speaker 2: to predict that. I'm going to talk more about these
Speaker 2: papers later on, but if if now this is this
Speaker 2: section of the workflow, what we bring our predicted variables.
Speaker 2: In our case, coming back to the radius, I'm loading
Speaker 2: the bioplematic variables. Then I'm loading a digital elevation model
Speaker 2: and get in the terrain algorithm just calculate also slope.
Speaker 2: I'm also bringing here a modest product on the estimated
Speaker 2: annual tree cover for each pixel as understanding that the
Speaker 2: lot is a special that requires trees, so that would
Speaker 2: be a good predictor for Habita suitability. And we are
Speaker 2: this is an annual product. So we retain all the
Speaker 2: images from two thousand and three twenty twenty two match
Speaker 2: presence located data, we select recover, and we estimate the
Speaker 2: median to finally have go from an image collection into
Speaker 2: one image. We combine all those different images as bands
Speaker 2: into one single variable called predictors. So now I can
Speaker 2: plot the print is and what you will see in
Speaker 2: this imag So first it is an image and not
Speaker 2: an image collection anymore. And now that we have all
Speaker 2: these bands here, so these are all our potential predictor
Speaker 2: variables that we're going to use that we could use
Speaker 2: now to predict to feed the machine learning model. There
Speaker 2: is a few more steps we want to do and
Speaker 2: we want to remove water. So one thing we want
Speaker 2: some of the If I plot some of these maps,
Speaker 2: some of these rafters, they may have in formation on
Speaker 2: the sea that we don't want to have. So we
Speaker 2: want to create a water mask. So we can use
Speaker 2: very simple get the terrain and select everything is above
Speaker 2: sea level, So then we will have a mask that
Speaker 2: is the only terrestrial have a lots of land on
Speaker 2: the continent. We get our predictor images and update that
Speaker 2: mask with a water mask we clip for our area
Speaker 2: of interest and we can plot that so we can visualize.
Speaker 2: Always a good idea to visualize. So here we have
Speaker 2: our elevation data, so now you see this doesn't have
Speaker 2: any data outside the land. We can also visualize the
Speaker 2: personality or annual precipitation across our area of interest. But
Speaker 2: if you look here, you have all these rivers, and
Speaker 2: we know that these are not going to be suitable
Speaker 2: habitats for slots. So what we're going to do is
Speaker 2: what we can do is get a little bit more
Speaker 2: fancy and get another product that is called global waters
Speaker 2: global surface water, and we're going to get any pixel
Speaker 2: that we know has has water and use that as
Speaker 2: a second mask. So when I run that, and if
Speaker 2: I assume me now into these areas with a lot
Speaker 2: of water, and I click bring my elevation here, bring
Speaker 2: it out, you see all those water areas having masks
Speaker 2: out and are not going to use in our final prediction.
Speaker 2: So we don't want to predict habit that's with ability
Speaker 2: on top of water. So yeah, let's say another nice
Speaker 2: trick and very easily done with the engine. To show
Speaker 2: you how powerful this can be. If we go back
Speaker 2: to our giraffe case. Now instead of having the biopligmatic
Speaker 2: variables elevation, we can bring an entire collection of lands
Speaker 2: at eight and we can apply our cloud masks et cetera,
Speaker 2: et cetera. Then we generate different vegetation industries and maybe
Speaker 2: good predictors and TBI and savvy. They are soil in dens,
Speaker 2: we can be really very good for giraffe as they
Speaker 2: will avoid that is with completely our soil, and we
Speaker 2: compile that into a composite. We can add things like
Speaker 2: standard deviation across all the image collections, how much variability
Speaker 2: in pixels can affect the suitability of that site. We
Speaker 2: can also elevation surface roughness. We also brought radar image
Speaker 2: what is really good for mapping woody vegetation, which giraffs
Speaker 2: are browsers, so they will prefer with the vegetation. So
Speaker 2: we compile all that as the variables at the resolution
Speaker 2: one hundred meters. So that's where Google Attention can be
Speaker 2: super powerful. So we're showing you here's a very simple
Speaker 2: workflow but just to show you that you can do
Speaker 2: things are more complex and quite powerful. Next, now that
Speaker 2: we have that dictor variable with all our bands, we
Speaker 2: don't want to use everything. We want to be selective hopefully.
Speaker 2: Like the way I like to approach these is what
Speaker 2: are the predict variables that makeological sense? So have an
Speaker 2: idea hypothesis behind why you want to introduce them. For
Speaker 2: this example, where you're seeing temperature seasonality, the maximum temperature
Speaker 2: of the worm, we want the minimum temperature of the
Speaker 2: coldest month, understanding that this extreme value are the ones
Speaker 2: that would restrict a range of species. Here we're going
Speaker 2: to try to get the continental wide habitat suitability model,
Speaker 2: whereas in precipitation, elevation and the person tricover. So now
Speaker 2: from all those predictors, we are going to select only
Speaker 2: these bands. So now we're going to work with the
Speaker 2: final six vans instead of the twenty three we originally have.
Speaker 2: So this is what you can see now here in
Speaker 2: the code. And next week and now that we have
Speaker 2: our predictor variables and our presence location, we move to
Speaker 2: this critical step of creating the severed absences to getting
Speaker 2: that information where the species is not that is required
Speaker 2: for our models we stopped before last week as a
Speaker 2: good practice. At minimum, you need to not create absences
Speaker 2: in the same pixels you have presence. So this is
Speaker 2: what this first mask is going to do. So we
Speaker 2: move now to section four on our workflow, and we
Speaker 2: want to run this first mask that's going to create
Speaker 2: a pixel of our chosen grain size at each present location,
Speaker 2: so that will impede creating cellar absences on the same sites,
Speaker 2: the same pixels where we have presence data. So what
Speaker 2: you will see here is like these are my presences.
Speaker 2: You will see these white spaces are areas where now
Speaker 2: you cannot create absences. So that's our first minimum thing
Speaker 2: we need to do to define this area to create absences.
Speaker 2: When we wrote this paper, this workflow, we provide three
Speaker 2: main methods. Keep in mind you can modify these and
Speaker 2: apply different methods if you want, but these are the
Speaker 2: three you have available. You can choose very quickly. One
Speaker 2: will be to just use the entire area of interest.
Speaker 2: The after, of course, you remove the oceans to generate
Speaker 2: cello absences. This would be a good practice if you
Speaker 2: are creating background points, like if you're trying to run
Speaker 2: maximum mode, but because we're going to be using machine
Speaker 2: learning model, we are going to be creating cell absences,
Speaker 2: so we don't want to just create random points and
Speaker 2: cross the entire region. So then we have two other options.
Speaker 2: This is one, I use a lot that is limiting
Speaker 2: that cell absence area, where the area where you can
Speaker 2: create cell absences to certain buffer from your presence locations
Speaker 2: that buffer. That distance in that buffer can be informed
Speaker 2: by movement that if you're working with animals or dispersal,
Speaker 2: that is known for the species how far they can move.
Speaker 2: So the ideas you are generating absences in areas where
Speaker 2: the species potentially could exist could occur and that will
Speaker 2: inform better your model, so you're not going extremely far
Speaker 2: away to gather that or generate that absence data. Another
Speaker 2: option will be to use this kind of environmental profiling technique,
Speaker 2: and this is actually the option we use in this
Speaker 2: in this case with the press example. So the idea
Speaker 2: is you do select a random amount of points just
Speaker 2: to reduce the amount of memory required, and then you
Speaker 2: generate profile from all those predictor variables to understand with
Speaker 2: habitats are more similar or this similar to your known locations,
Speaker 2: you will end up with two classes two categories. Here
Speaker 2: in pink is more dissimilar, ingred more similar, So then
Speaker 2: you can generate those cell absences in the pink area.
Speaker 2: So your final map or braster what you image to
Speaker 2: use the proper term when you can't generate sell absences
Speaker 2: will be this black area. Here in the code, you
Speaker 2: will see that option one the entire area, option two
Speaker 2: just only the the area buffer, or options three using
Speaker 2: the environmental profile. So let me run up to hear
Speaker 2: the code now and always is a good practice to
Speaker 2: try to visualize that at least I like to visualize
Speaker 2: the those areas, so we're always loaded in them here.
Speaker 2: So our area to create the absence will look like this,
Speaker 2: so we know it's working. We know where we are
Speaker 2: going to be creating seal obstances. Because once we define
Speaker 2: these things and we generate our final model to feed
Speaker 2: the random forest, you're going to be more hard to
Speaker 2: visualize things. So at this point you want to make
Speaker 2: sure everything is working fine. So we have our present data,
Speaker 2: our area of interest, and we have defined out our
Speaker 2: area to create seal absences. Also we have created our
Speaker 2: list of predictor violence. Now is when we get into
Speaker 2: the more complicated stuff and is we need to not
Speaker 2: just predict and create the model, but we somehow we
Speaker 2: need to know how good our model is. And we're
Speaker 2: going to use a special block cross validation technique. That
Speaker 2: means we're going to split our data in a training
Speaker 2: data set including presents and seal absences, and we're going
Speaker 2: to have another put another group of points of president
Speaker 2: absence to test our model. The problem is what you're
Speaker 2: seeing randomly spitting splitting these points, and they are where
Speaker 2: randomly selecting points that are very close to each other.
Speaker 2: The good chance that them is going to be really
Speaker 2: good at predicting a pixel next to where the mole
Speaker 2: got trained. Just natural thing that things are more similar,
Speaker 2: and when they are close by, elevation would be similar.
Speaker 2: Unless you earn a cliff, vegetation is probably similar on
Speaker 2: you and farther away. Certain people argued like roverts are
Speaker 2: like that that inflates your confidence and your moral predictive power.
Speaker 2: So what they proposed is generate blocks that you can
Speaker 2: do so instead of you are in the points, divide
Speaker 2: those blocks into areas for training an area for validation.
Speaker 2: So then if your model can predict different blocks are
Speaker 2: quite distant so now the data is quite distant from
Speaker 2: where the model was trained or the data was extracted
Speaker 2: to train the model. Then the predictive power is you
Speaker 2: can't trust that model. A little more gives you the
Speaker 2: more accurate picture of how good your model is performing.
Speaker 2: So that's what we implemented this kind of spatial block
Speaker 2: cross validation. So the idea is, if you have defined
Speaker 2: this greed, we're going to randomly select seventy percent of
Speaker 2: those blocks, and then we're going to extract if I
Speaker 2: plot everything here, all our presence point on our cell
Speaker 2: to absence points and we generated randomly in blue, so
Speaker 2: the presence in red, cell absence in blue everything that
Speaker 2: overlaps with the dis greed. Where we're randomly selected seventy
Speaker 2: percent of the blocks, that's going to be used for
Speaker 2: model training, and then the model has to be good
Speaker 2: to predict in areas where there is no quite far
Speaker 2: away from the the model was predicted. So that's the idea. Now,
Speaker 2: of course, if how big this block has to be, well,
Speaker 2: that's if you do it too small, then you end
Speaker 2: up in the same situation. That is no difference than
Speaker 2: separating the splitting these points randomly. If you do it
Speaker 2: too big, you run into the risk of randomly splitting
Speaker 2: your data and getting non data for training just by chance.
Speaker 2: So depending also how cluster your data set is, and
Speaker 2: this one is quite cluster towards Central America, you want
Speaker 2: to play with that cell size or block size, so
Speaker 2: not the definite answer, but you don't want to go
Speaker 2: too small, you don't want to go too big. So
Speaker 2: if we go to the code here, now this is
Speaker 2: the function to create agreed and this is why you
Speaker 2: can switch that distance here. We're using two hundred kilometers
Speaker 2: for that block and could always could to print it
Speaker 2: and visualize it. So we can visualize our greed now
Speaker 2: on how it's looking. Different areas maybe get difficult because
Speaker 2: the greed is being created, or we have land. We're
Speaker 2: trying to mask out all the water. But if you
Speaker 2: have little islands that will leave blocks, so that will
Speaker 2: you want to make sure that it's working right for you,
Speaker 2: or you're not having blocks that are not within your
Speaker 2: area of interest. So that's why it always could practice
Speaker 2: to visualize fantastic. So now we have our blocks data
Speaker 2: were ready to feed models. So now we get to
Speaker 2: the part of actually generating our random forest and feeding
Speaker 2: and then bury it in those random forests. How good
Speaker 2: that they are predicting, And this is a good time
Speaker 2: to premand ourselves that we are in good attention. We're
Speaker 2: using machine learning techniques, so in this gus random forest,
Speaker 2: that means we are going to the goal of this
Speaker 2: is to predict, yeah, not to understand what is driving
Speaker 2: the occurrence of any species, but getting really good predictions
Speaker 2: of suitable habitat. So the next thing now is to
Speaker 2: run our model and get our predictions. So this is
Speaker 2: where you visualize why I divided this map in two.
Speaker 2: So here we have our habitat suitability, but we can
Speaker 2: interpret as the probability of a species using that habitat
Speaker 2: from very low in blue to very high in kind
Speaker 2: of this yellow. Now we can have a binary map
Speaker 2: that is our potential distribution, so completely absent for where
Speaker 2: actually the actual species could potentially be present. So let's
Speaker 2: go to the code editor to see how we get there.
Speaker 2: So this is our section fine now fitting our SDM.
Speaker 2: This is a very big function, but if you understand this,
Speaker 2: you will be able to later modify it to twig
Speaker 2: ticks around and extract more information if you need. So
Speaker 2: that's why I want to walk you through this part.
Speaker 2: The first thing we want to do is get a
Speaker 2: seat number. That's going to be how our function runs
Speaker 2: on a set of seat numbers, and how many seat
Speaker 2: numbers we said, is how many iterations we're going to do.
Speaker 2: So instead of range just one model, what we're going
Speaker 2: to do is run several ones every time partition in
Speaker 2: our data for training validation differently, and we want to
Speaker 2: see that our model is always very good at predicting
Speaker 2: regardless of how we partition the data. So if the
Speaker 2: partitioning is if the mollis are always good, that means
Speaker 2: the mode is not depending on those they initial data sets.
Speaker 2: If we always get different results because depending on how
Speaker 2: randomly that data set was split, then we're having certain
Speaker 2: problems and we want to probably per more attention, we
Speaker 2: may need more data, et cetera. So how this function works. First,
Speaker 2: we have our greed. We assign a random number to
Speaker 2: every single of these sales, and we're going to filtered
Speaker 2: by that random number with the number that we split.
Speaker 2: So we're going to provide this parameter later we're going
Speaker 2: to be using here seventy percent zero point seven. That
Speaker 2: means we're going to use seventy percent of the blocks
Speaker 2: for training, lower than the split we're going to use
Speaker 2: it for training and greater than we're going to use
Speaker 2: it for testing, so we get thirty percent for testing
Speaker 2: seventy percent for training. The next thing is to bring
Speaker 2: our data presence data. We need to add a future.
Speaker 2: They are saying that this is a press, so we
Speaker 2: have one, and then we filter this based on whether
Speaker 2: they are within that training greed or within the testing reed,
Speaker 2: resulting in training points, presence point, and testing presence points.
Speaker 2: So far we have now our training presence points, our
Speaker 2: testing presence points. The next section is creating those cellar absences.
Speaker 2: Now we have our area for generated absence, so we
Speaker 2: generated that area to create the absence. We're going to
Speaker 2: use that image to generate to sample random points. We
Speaker 2: need to also provide a region and that region so
Speaker 2: we are limiting those points to the training reeds. So
Speaker 2: random points are going to be extracting through from this
Speaker 2: image only on top of that image. But first we
Speaker 2: want to get the training reed, the grain size we
Speaker 2: have defined, and how many pixels we want. What we
Speaker 2: are going to the best practice when you're using machine
Speaker 2: learning is to have a balanced data set that means
Speaker 2: the same number of presence and absences. So we're going
Speaker 2: to create just an extra three hundred because many times
Speaker 2: those by random chance, those points may randomly fall on
Speaker 2: water or pixels we masked, so we want to create
Speaker 2: some extra one to have a few extra justin case.
Speaker 2: Then we are going to limit all those random points
Speaker 2: to the same amount that we have presence points. The
Speaker 2: more points you are, the more more memory you will need,
Speaker 2: so you don't want to go too big, But then
Speaker 2: you want to ensure you ended up with too few
Speaker 2: points just because most of your points fall in the water.
Speaker 2: If you're working in Central America, big chance or your
Speaker 2: random points befall in the water, so you may want
Speaker 2: to increase the number that we have to do the
Speaker 2: same for our testing. The testing data sell to absense
Speaker 2: points and then we merge them. We merge our presence
Speaker 2: point where are the cells absence points. We have also
Speaker 2: provided zero as a press and absence, So that's how
Speaker 2: were machine learning. No where is an absence where it
Speaker 2: is a presence. We have our training and testing partitions.
Speaker 2: Now that we have the training and testing partition, we
Speaker 2: need to extract the pixel values. So for the training partition.
Speaker 2: We're going to extract that pixel value on all our
Speaker 2: predicted bands from our predictor image, so that we're going
Speaker 2: to keep that This is what this property is doing,
Speaker 2: keeping that present absence column. We're using the grain size
Speaker 2: that we define, so we are getting now all our
Speaker 2: pixel values for all our presence and cell absence locations.
Speaker 2: Once we have these, we're ready to train our classifier.
Speaker 2: We're going to use the E classifier small random forest.
Speaker 2: That is, this is the function in Earth gene to
Speaker 2: feed a random forest. Here are all the parameters that
Speaker 2: you can tweak around, and it may be a good
Speaker 2: practice to not just use the defaults. But in reality,
Speaker 2: when you are not too advanced, and because we don't
Speaker 2: have really easy ways to compare different models in our tention,
Speaker 2: you can do a lot of trader arror, or you
Speaker 2: can use other methodologies more advanced to kind of find
Speaker 2: two in your model, or you can use your validation
Speaker 2: metrics later on to find two in your models. But
Speaker 2: here are we provide those parameters. They are to so
Speaker 2: you can try to modify them and play around. This
Speaker 2: will be your number of trees in the random forests.
Speaker 2: So the larger the number you may more memory you need,
Speaker 2: but better the model will be a great capacity to
Speaker 2: the model. This is the number of variables you will
Speaker 2: get split in each tree. If you say no, will
Speaker 2: use the square root of the number of predictors you have.
Speaker 2: So if if you have nine bands, it will be
Speaker 2: three variables per split. This will be the how many
Speaker 2: points minimum you want in that split. So we set
Speaker 2: to ten to say, well, at least I want to
Speaker 2: have ten pixels to go into the random split in
Speaker 2: our random forest for suitable and suitable. This will give
Speaker 2: avoid the model from choosing very just simple pixels and
Speaker 2: or maybe overfitting. So this will give if you say ten,
Speaker 2: we'll try to find more general patterns in the in
Speaker 2: the distinction between good habitats and bad have it in
Speaker 2: our case the back fraction is the trig gets to
Speaker 2: see fifty percent of your of all the training data
Speaker 2: ta split. We're dividing that randomly at fifty so at
Speaker 2: itach split we're getting fifty percent of the data. What
Speaker 2: is quite a good practice. And then maximum nodes. We
Speaker 2: set it to no. Have here because we just set
Speaker 2: ten points where better split at least then we were
Speaker 2: this is a good good balance, so we are not
Speaker 2: allowing to spleed to to go into too many nodes
Speaker 2: and infinitive to grow to make the model the three.
Speaker 2: Then we have the seed that is the idea that
Speaker 2: we can't replicate and get exactly the same result every
Speaker 2: time we feed the same random forest. Not we all
Speaker 2: you can also comment out the random forest and feed
Speaker 2: the gradient three. I'm sorry, still going and you have
Speaker 2: free ingredient posting tree. At least different classifier that is
Speaker 2: available air tension, not that we are limited to whatever
Speaker 2: classifiers are available. If you want to use maccent MaxEnt
Speaker 2: is also available as a classifier. You can see all
Speaker 2: your classifiers if you go here, so you have accent
Speaker 2: and another ones that are available. But again for this example,
Speaker 2: we're going to use round the forest. Finally, we're going
Speaker 2: to now that we train our classifier, we're going to predict.
Speaker 2: So we train our classifier, we can set the output
Speaker 2: into probability or classification, meaning that what we have here
Speaker 2: the probability that me in that habitats with a probidity
Speaker 2: or binary map. There are different ways we can get
Speaker 2: the binary map, but one way to get and get
Speaker 2: it to plot on Earth Engine easily quickly something that
Speaker 2: we'll talk later is using the classification. So it gives
Speaker 2: you a binary map directly from the random forest. So
Speaker 2: we get two images, the classify image with presence proority
Speaker 2: and a classified binary image with press and absence. And
Speaker 2: then we all pack all that into a list. So
Speaker 2: then we have our classify image to our two images,
Speaker 2: our training partition and our testing partition. Our testing partition.
Speaker 2: We're going to use it later for validation. So that's
Speaker 2: our function right there. When we then can create a
Speaker 2: list of random numbers. You choose these numbers randomly. You
Speaker 2: can generate a random number generator, but we'll take more memory.
Speaker 2: So generally what I do is choose those numbers outside
Speaker 2: Earth Engine and then pasting here, and those amount of
Speaker 2: numbers should match how iterations you want to have. The
Speaker 2: good practice is, if you have more than one thousand
Speaker 2: points to train your your your random forest, you want
Speaker 2: to use five iterations, is okay. If you have less
Speaker 2: than one thousand points in our case, you want to
Speaker 2: use at least ten for the purpose. Now, so it runs,
Speaker 2: I want to run only five. At the end. You
Speaker 2: are going to see I'm going to run the whole
Speaker 2: thing now, and you're going to see you can print
Speaker 2: all those results. It's going to take a little bit
Speaker 2: of time for computing, and we are now printing a
Speaker 2: lot of objects. Here. This is where things can depending
Speaker 2: on the internet. How many people are using a retention
Speaker 2: where this is going to give your results on the
Speaker 2: fly or what This is going to hit the memory
Speaker 2: limit and it may not work. Sometimes by clicking it
Speaker 2: again works. If not, I will give you at the
Speaker 2: end different options. But here you can see our maps
Speaker 2: coming up. So we have our prediction for hav A
Speaker 2: the suitability, and our prediction here for the binary map.
Speaker 2: This is all the outputs we have. So we have
Speaker 2: if we run five iterations and we have five four outputs,
Speaker 2: we're going to end up with twenty elements. So this
Speaker 2: is how we can extract them all our results from
Speaker 2: all this list of objects. Fantastic. So that's how quickly
Speaker 2: in our attention you can get an specially distribution model.
Speaker 2: And I think that's the beauty of this. So there
Speaker 2: it is our special distribution model for radibus.
Speaker 3: You go.
Speaker 2: All right, last section validating our model. How do we
Speaker 2: know if this model is meaningful, if it's good or not.
Speaker 2: So those are the basic questions we need to ask,
Speaker 2: and if you're using maybe a general linar model, you
Speaker 2: may look into the devans explained by the model, or
Speaker 2: receival patterns or the goodness of fit test to see
Speaker 2: if you can trust that model or not. But here
Speaker 2: again we're using machine learning, so we're fitting a random forest.
Speaker 2: And the way we are going to validate our model
Speaker 2: to see how the predictive power of our model is
Speaker 2: using cross validation. So that's why we play that data
Speaker 2: in to training and testing. A few things about validating,
Speaker 2: and I like this definition from Arauco is a really
Speaker 2: good paper to read. And if you want to test,
Speaker 2: we can test the or quantify mode accuracy or the
Speaker 2: interpolation of our models is to test the predictive performance
Speaker 2: of the model within the same region and time frame
Speaker 2: of our training data. So how good is our model
Speaker 2: in predicting these thirty we set aside ever iteration, but
Speaker 2: we can also quantify more generality, and that's just different
Speaker 2: because that will be extrapolation. That means there's the capacity
Speaker 2: of our model to predict in a different region and
Speaker 2: a different time frame. That's what we're doing with the
Speaker 2: GRAF example I show you. So we're predicting a completely
Speaker 2: different region from what our training data is and at
Speaker 2: a different time, because when you're using lands of data,
Speaker 2: you can really select which extract month of the year
Speaker 2: you want to predict, or e or an average across
Speaker 2: an ear. Now, when we balidate our models, we have
Speaker 2: metrics that are threshold dependent, so they require a cut
Speaker 2: off in this zero two one gradient where we say okay,
Speaker 2: below certain value, we consider that an absence and above
Speaker 2: that we consider the presence. So that's what we call
Speaker 2: them threshold dependent. Example of that is the percentage of
Speaker 2: our accuracy sensitivity specificity Kapok statistics. But that can be
Speaker 2: a little bit challenging because it can be quite subjective
Speaker 2: of what threashold you choose completely change those metrics. So
Speaker 2: I'm going to show you in a second there are
Speaker 2: other metrics that threshold independent, and those are the area
Speaker 2: under the curve of the operating characteristic, area under the
Speaker 2: receiver operating correct the curve, and the area under the
Speaker 2: precision recall COURD. So the thresh caold depending ones come
Speaker 2: from these aeror metrics. So here we have our validation
Speaker 2: points where we know things points are positive or negative,
Speaker 2: and the ones that they'm all predictive. When they all
Speaker 2: break the positive or negative, they all can predict correctly
Speaker 2: that positive or can give you a false negative predicting
Speaker 2: negative when it true is positive. It can predict positive
Speaker 2: when in true is negative, that's a false positive or can't.
Speaker 2: What we want is predicted negative when it's true is negative.
Speaker 2: So these are one of the common metrics where you
Speaker 2: will report sensitivity or recall is the proportion of actual
Speaker 2: presence recorded by the model as a presence, so emphasizing
Speaker 2: the prevention of false negatives. So we want to decrease
Speaker 2: the false negative, so that's sensitivity specificity is the same
Speaker 2: but for negative values. So the ideas we are preventing
Speaker 2: false positives, so we want those true those negative absences
Speaker 2: to be actually predicted as absences as specificity and I
Speaker 2: having used in positive negative negative will be an absence positive.
Speaker 2: Is the presence precision. It can be quite useful when
Speaker 2: you're using only present data, when we're created absences when
Speaker 2: in reality we don't really know where the absences are.
Speaker 2: Where we can report precision because only it depends on
Speaker 2: the on those positives. So it's the proportion of predicted
Speaker 2: presence locations that are truly presents out of the total
Speaker 2: predicted presences. So from all the predicted presence of your model,
Speaker 2: how many are actually positive? So how much you really
Speaker 2: can trust those predictions, like your presence predictions, because you
Speaker 2: really don't know where the absences are. So here we
Speaker 2: have the Auero metrics as an example to visualize this
Speaker 2: problem of the threashold. So here, let's say these crosses
Speaker 2: are our known presence locations and then everything else known
Speaker 2: absence locations, and these are our with the mold predicted proyality,
Speaker 2: so that habitats with ability from zero to one. If
Speaker 2: we use a treashold of zero, everything will be predicted
Speaker 2: as a presence, so all the mapp will sound like
Speaker 2: potential habitat. As we increase a threashold, we start to
Speaker 2: decrease the number of pixels that were predicted at presence,
Speaker 2: and that will change of course our false positives and
Speaker 2: false negatives. So all these sensitivity and specifty metrics are
Speaker 2: going to be switching around depending on which threashold you use.
Speaker 2: And then of course if you go to a threshold
Speaker 2: that is too high, you end up with only one
Speaker 2: correctly one pixel predicted as present and everything has absence.
Speaker 2: So this describe give you an idea of how sensitive
Speaker 2: these metrics can be to which threashold you use. Generally
Speaker 2: everyone is using this across all itterations. The threshold that
Speaker 2: maximizes the sum of these two metrics sensitivity and specificity.
Speaker 2: So the thresholder will give you the best balance between
Speaker 2: true presence and true absences. That's why you probably will
Speaker 2: see threshold in the validation metrics being reported. More so,
Speaker 2: those are the area under the curves of these lines.
Speaker 2: So this one is the rock auc where you have
Speaker 2: in the Y access true positive rate and in the
Speaker 2: X access the force positive rate. And we're trying to
Speaker 2: do as you move your threshold across this line, is
Speaker 2: going to start plotting here and then we can calculate
Speaker 2: the area under the curb and this case is zero
Speaker 2: point eighty five and gives you, says, also quite good
Speaker 2: predictive capacity. So the mold. This is the capacity of
Speaker 2: the mould to distinguish between the true absences and the
Speaker 2: true presences. Here is really nice animation. You can actually
Speaker 2: visit the website highly recommended, but so you can be
Speaker 2: sure how it works. The idea what we're trying to
Speaker 2: do to maximize you get this area under the curve
Speaker 2: to one. That means our moral can correctly predict every
Speaker 2: single point so completely separates presence from absence correctly. So
Speaker 2: an AUC of one gives you a perfect discrimination. Now
Speaker 2: an I U S of zero point five is no
Speaker 2: better than random. So if you get the diagonal line here,
Speaker 2: that means this is a very bad model. It can
Speaker 2: really not tell apart presence from absence. It's just a
Speaker 2: random split. If you get something below zero point fund,
Speaker 2: then your mode is worse than random. So you are
Speaker 2: always trying to get something about zero point seven on
Speaker 2: the area and the corb. Now this one, whereas again
Speaker 2: we're using celluar absences, we really don't know where the
Speaker 2: absences are. So some people have proposed using the AUCPR
Speaker 2: because it depends on precision and recall, so it's not
Speaker 2: relying so much on your absences. And the idea is
Speaker 2: the same. It's a different line, but you are trying
Speaker 2: to maximize the area under this corb. As you will see,
Speaker 2: they correlate as you increase auc rock you increase AUCPR. Now,
Speaker 2: the problem is when you have very imbalanced data sets.
Speaker 2: So if you have let's say ten thousand absences and
Speaker 2: fifty presences, because your model will predict very well, at
Speaker 2: least a lot of the absences very well, but your
Speaker 2: fifty presences maybe not too much. Using the IUC rock
Speaker 2: will inflate, will give you a false impression that your
Speaker 2: model is very good at predicting, but actually predicting just
Speaker 2: the absences. You don't know what's happening with the presences.
Speaker 2: So the precision recall is a little bit better in
Speaker 2: giving you a true idea of how good your model
Speaker 2: is predicting your presences. That is what you really know.
Speaker 2: The data is what you really are, what speech are.
Speaker 2: So how you recommend reporting your aucpr in when you're
Speaker 2: reporting your metrics. So this is now we have is
Speaker 2: Here's why you probably don't want to touch too much,
Speaker 2: aside from if you're going to modify the list of
Speaker 2: objects you're extracting, as for example by variance importance, but
Speaker 2: otherwise you should not be changing too much of this
Speaker 2: part of the model. What we are showing here that
Speaker 2: you need to know is that because we run five iterations,
Speaker 2: where getting the average of those five iterations, and here
Speaker 2: because we have a pressing absence output we're getting the
Speaker 2: mode of each pixel. So's what the RUNDO for is
Speaker 2: digiteration predicted the most something you really want to check,
Speaker 2: and that's why we included this thing here. That is
Speaker 2: the number of if we owe to the section seven accuracy.
Speaker 2: So we extract from each list the training data sets.
Speaker 2: So we end up with five training data sets. And
Speaker 2: the first thing we want to know is how many
Speaker 2: points we got present and absence for testing in each iteration.
Speaker 2: Because when you're randomly split things, you and your data
Speaker 2: may be cluster. You may end up with no data
Speaker 2: for testing or training. So you always want to test
Speaker 2: here that you have enough. You have enough points for
Speaker 2: doing that validation. Then all these functions are going to
Speaker 2: be getting all these values for the metrics and we
Speaker 2: you can print them from this workflow and so you
Speaker 2: can see the auc rock for each iteration. This model
Speaker 2: is actually very good and getting that predicting well, the
Speaker 2: first iteration maybe not too good. What you can do
Speaker 2: is change your seeds. If there is something that is
Speaker 2: not giving you the random is split end not having
Speaker 2: enough data for for for validation. You want more points there.
Speaker 2: You can change that seed and see if you can
Speaker 2: get a better random split. This one is very decent.
Speaker 2: Of course, you shouldn't be just tweaking to maximize your
Speaker 2: thing that you want to these idea is how dependent
Speaker 2: the model output is from that initial set of values
Speaker 2: random split of values, and we can see here we
Speaker 2: are very good. Again we should be doing ten, not
Speaker 2: just five for these small amount of points. But it's
Speaker 2: a very decent output. Here we're getting the average of
Speaker 2: that of those values. This is our prs. So now
Speaker 2: we can see this one is still when you get
Speaker 2: the UCPR above eighty percent is generally considered very good.
Speaker 2: So this is again a very good prediction. We can
Speaker 2: report that in our purports of prepares. We also provide
Speaker 2: citivity in a specificity here on the fly, so the
Speaker 2: correctly predicted presences correctly predicted absences. Again aside from the
Speaker 2: first model, the first iteration is doing very well. And
Speaker 2: here is our threshold. We can use this threshold. So
Speaker 2: this is the average threshold that maximizes the sum of
Speaker 2: the sensitivity and specificity. So zero point forty five. So
Speaker 2: anything above forty zero point forty five in the suitability
Speaker 2: will be considered a presence or potential distribution. Everything below
Speaker 2: because of the an absence. So instead of getting this
Speaker 2: output from the random forest, you can export this map
Speaker 2: and transform in QGIS and another software are this map
Speaker 2: into binary by setting using this threshold, that will be
Speaker 2: the best practice than using just the output from the
Speaker 2: random forest, using the classification output instead of the predictive
Speaker 2: output in the species tribution functions so here. But if
Speaker 2: you try to do that on the fly, you generally
Speaker 2: are going to hit memory limits. So that's why to
Speaker 2: get a good first visualization and for many people that
Speaker 2: they will exactly what you want to do, this can
Speaker 2: be a good solution. So those are the metrics you
Speaker 2: get printed on the console and that's pretty much the end.
Speaker 2: So we can now talk a little bit about the
Speaker 2: importance of independent but having independent data for validation, true
Speaker 2: independent data for validation. It's not very often that you
Speaker 2: see papers reporting independent validations for species situation models, but
Speaker 2: I found it it's critical to have because it's quite
Speaker 2: hard to validate the model based to just the same
Speaker 2: data you are training. Even if you are doing these partitions,
Speaker 2: you're still using the same data you train them model
Speaker 2: to validate the model. Now, if you have a complete
Speaker 2: independent validation set of points to validated model. Now will
Speaker 2: give you a better, more honest idea of how good
Speaker 2: your model is. And this is what we did with
Speaker 2: the giraffe. I was showing you the capacity of these
Speaker 2: molesules differentiate the giff locations so they have ability where
Speaker 2: the graf actually use the place at one ndimeter solution
Speaker 2: compared to generating random points across this entire park. So
Speaker 2: that will leave you really a good metric. This independent
Speaker 2: data is important to prevent overfitting. Random forests can be
Speaker 2: problematic for overfitting, so always good to have this kind
Speaker 2: of complete independent data set to test how good your
Speaker 2: model is. Ensure this transfer transferability of your model, how
Speaker 2: good your model can be predicting outside a different region
Speaker 2: or a different time period, and yeah, access your true accuracy,
Speaker 2: not have like a false impression that your model is
Speaker 2: good when actually it's maybe just being very good at
Speaker 2: predicting the data you provide to fit that model, but
Speaker 2: actually then it's not really good at predicting outside that.
Speaker 2: The final thing I want to talk about is batch mode. So,
Speaker 2: as I mentioned before, if you increase the number of
Speaker 2: of iterations, if you have ten thousand points instead of
Speaker 2: three hundred, it's highly likely and as more people are
Speaker 2: using earth Engine and we have to share that memory
Speaker 2: capacity across everyone in the community, that Coogler is going
Speaker 2: to give you here a memory limited error. You requested
Speaker 2: more memory and allowed and you cannot visualize your outputs
Speaker 2: on the fly. The solution for that is using batch mode,
Speaker 2: and batch mode is basically import exporting exporting the model's
Speaker 2: outputs to your rule drive. So what you do is
Speaker 2: use the export image to drive to import export your
Speaker 2: male average. You can export every single run if you
Speaker 2: want to. You can export the distribution maps or I
Speaker 2: already build the function here to transform the mall average
Speaker 2: into a binary map using the mean threshold we calculated,
Speaker 2: so that will give you a different approach, a different
Speaker 2: way of getting that potential distribution map, so you can
Speaker 2: export that one as well. You can also export all
Speaker 2: your metrics using the export table to drive. So this
Speaker 2: is going to be exported to your whole drive. So
Speaker 2: if you go to tasks here, I run it. I
Speaker 2: run it before today and this is how long it
Speaker 2: took ten minutes to explore that. But every time you
Speaker 2: click run, it's going to give you this option. So
Speaker 2: if I want to export the metrics I can run this.
Speaker 2: I can special if I a folder where I want
Speaker 2: to save it, and then click run. That's going to
Speaker 2: take a little bit of time, depending again how much
Speaker 2: memory you need, and then you can go to your
Speaker 2: rule right and access that he have my habitat suitability raster.
Speaker 2: It's like fifty megabytes my metrics, so I can open
Speaker 2: and inspect my false negative, force positive, the face positive
Speaker 2: rate precision that's some species in sensitively specificity, the true negative,
Speaker 2: true negative rate, true positives through positive rates, the cut
Speaker 2: off that is a threshold. And this is why I'm
Speaker 2: showing you, to show you that how different that threshold
Speaker 2: can be at each specific run, and how like arbitrary
Speaker 2: that threashold can feel sometimes. And so I always prefer
Speaker 2: to provide habitats with ability output, not the binary maps,
Speaker 2: but of course that's always a personal choice. And if
Speaker 2: you to calculate potential how it's available, you always need
Speaker 2: the binary map. But the same here for your UCPR.
Speaker 2: So then you can build nice tables for your your
Speaker 2: paper reports, and this one you can download it and
Speaker 2: use your favorites offtware to create maps. Always be mindful
Speaker 2: that if you are doing a model that thirty meter resolution.
Speaker 2: It may be two gavites and that's taken away from
Speaker 2: your fifteen gaites allocated for free. So always to be
Speaker 2: mindful that if I do that now, I will hit
Speaker 2: my quote and then I will have to start paying.
Speaker 2: So always be mindful of those objects you create with
Speaker 2: that I will pass it to Grant. That's going to
Speaker 2: explain other parts of the of how to tweak this
Speaker 2: model further to get extra information and some of the
Speaker 2: most recent discussions on the best practices for species vision models.
Speaker 2: So thank you.
Speaker 4: All right, So, Ramiro has just led us through this
Speaker 4: SDM function that goes through the steps of partitioning your
Speaker 4: occurrence data into these training and testing data sets. Has
Speaker 4: shown us how to fit those species distribution models recover
Speaker 4: some accuracy metrics on the back end. And I think
Speaker 4: one of the concepts that we alluded to early on
Speaker 4: is that often with these machine learning approaches to species
Speaker 4: distribution modeling, we are often striving for high predictive power,
Speaker 4: the ability to interpolate between places where you have known
Speaker 4: presence data for your species. But these machine learning models
Speaker 4: often don't excel at understanding these causal relationships between underlying
Speaker 4: variables and your species occurrence. So one thing that we
Speaker 4: want to just introduce here is the concept of variable
Speaker 4: importance and how that can work with a random forest
Speaker 4: classifier in Google Earth Engine. So the idea with extracting
Speaker 4: variable importance with a random forest model is that we're
Speaker 4: really trying to figure out how effectively different environmental layerst
Speaker 4: presence points from absence points within our classifier. And so
Speaker 4: the goal here is not necessarily to understand causal relationships,
Speaker 4: but really to understand for that specific model, which predictor
Speaker 4: variables had the most influence in thwarting presence and absence points.
Speaker 5: And so the.
Speaker 4: Code for obtaining these variable importance scores within Google Earth
Speaker 4: Engine is fairly straightforward if you just have a single classifier.
Speaker 4: So in this example, we are creating a new variable
Speaker 4: that we call variable importance. We have a trained classifier
Speaker 4: which is our SDM model, So that's this classifier PR,
Speaker 4: and then the explain function is extracting some information from
Speaker 4: that fitted model in Google Earth Engine. And one of
Speaker 4: those pieces of information that's distracted by the explain function
Speaker 4: is the variable importance. And so this is really letting
Speaker 4: you see which variables were the most influential in sorting
Speaker 4: your presence and your absence points. So we can actually
Speaker 4: print this output from that classifier, and we can see
Speaker 4: down below that we have these different environmental variables that
Speaker 4: went into our SDM model. So we had DVII, a
Speaker 4: couple different bioclimatic variables, we had elevation, and just looking
Speaker 4: through this list of variables, we can see that these
Speaker 4: variables with the higher importance scores are the ones that
Speaker 4: had the most influence in that particular model run. And
Speaker 4: so here we can see that elevation as well as
Speaker 4: these bio five and bio six variables were the most influential,
Speaker 4: so those had the highest important scores. This gets a
Speaker 4: little tricky when we go to this framework that Ramiro
Speaker 4: has introduced where we have an SDM function and we're
Speaker 4: doing this spatial block cross validation approach where we are
Speaker 4: taking different spatial subsets of our training and validation data
Speaker 4: and refitting the model. And so when we create this
Speaker 4: SDM function, we're than running this model multiple times on
Speaker 4: different spatial blocks of training data. And so to modify
Speaker 4: the function that Ramiro has introduced previously, we just have
Speaker 4: to add a couple of lines here where within that
Speaker 4: SDM function. We're going to introduce this variable importance as
Speaker 4: a new object, and so later we're actually going to
Speaker 4: want to work with this variable importance from across all
Speaker 4: our different model runs. And so this starts to look
Speaker 4: a little bit complicated, but what we're going to do
Speaker 4: is take that same importance score that I show you
Speaker 4: how to extract in the previous slide. We're going to
Speaker 4: turn that into a We're going to define that as
Speaker 4: a dictionary and convert that into a feature, and that
Speaker 4: feature just has a null geometry. So the idea is
Speaker 4: that later we want to just take an average across
Speaker 4: importance scores for each variable across these different model runs.
Speaker 4: And to do that, we're going to basically package this
Speaker 4: importance score as a feature within this SDM function. And
Speaker 4: so we're also going to modify the list of objects
Speaker 4: that are returned by this SDM function at the end
Speaker 4: of the loop. So we still are going to have
Speaker 4: our probability image that comes from the classifier, our binary image.
Speaker 4: We can export our training and testing partitions as we
Speaker 4: did previously, but we're also going to add this variable importance,
Speaker 4: which is going to be that list we just looked
Speaker 4: at for each variable what was the importance score for
Speaker 4: that variable. So then when we're doing this spatial block
Speaker 4: cross validation, we're here, we're doing a fivefold repeat. We're
Speaker 4: basically taking a list of different seeds, so these are
Speaker 4: different random seeds, and we're going to map this SDM function,
Speaker 4: or we're going to basically rerun this SDM function, but
Speaker 4: just taking different random partitions of our original presence absence
Speaker 4: data set. And so the result of this is going
Speaker 4: to be a fairly complex list of lists. So we're
Speaker 4: going to have a single list, and within that list,
Speaker 4: we're going to have all five outputs for each of
Speaker 4: our five different model runs that we just executed above.
Speaker 4: And so when we flatten that list of lists, we
Speaker 4: just get a single long list with lots of different
Speaker 4: these different data objects. So we'll get these two images
Speaker 4: are two training and testing partitions and the variable importance
Speaker 4: for model one. Then we'll have it for model two,
Speaker 4: model three, four, and five. We repeat this run five times,
Speaker 4: and so this next step looks a little complicated, but
Speaker 4: the basic ideas that we need to extract from this
Speaker 4: list of lists the index positions of that variable importance
Speaker 4: that list of variable importance values, and so every fifth
Speaker 4: item in this flattened list is going to be our
Speaker 4: variable importance. As we discuss previously, index positions in Google
Speaker 4: Earth Engine begin with the index zero, So the first
Speaker 4: object in a list always gets assigned the index position zero.
Speaker 4: And so what we want to do is it stract
Speaker 4: index position four, and then we want to skip out
Speaker 4: to model run two and it'stracted index position nine and
Speaker 4: so on. So this looks a little complicated, but the
Speaker 4: basic ideas that from each model run, we're trying to
Speaker 4: pull out just that very importance, and we're extracting that
Speaker 4: by looking at the index positions of those variable importance scores.
Speaker 4: Once we've extracted that list of variable importance scores from
Speaker 4: each run, we can convert that into a feature collection,
Speaker 4: and then we can use the reduced columns function to
Speaker 4: basically get a mean important score for each band or
Speaker 4: each variable in our classifier, and then we can print
Speaker 4: those results. And so then here what we'll be seeing
Speaker 4: is just an average importance score for each of the
Speaker 4: variables in our model, averaged across the five model runs
Speaker 4: that we're fit with different training and testing partitions. So
Speaker 4: I know this is a little complicated. Some of the
Speaker 4: challenge in this is just understanding.
Speaker 5: The way that these.
Speaker 4: Lists of outputs are getting packaged by our SDM function
Speaker 4: and then making sure that we're extracting the variable importance
Speaker 4: by referencing the correct index positions. One important thing to
Speaker 4: keep in mind when you're looking at these random forest
Speaker 4: variable important scores is that these are these genie importance scores,
Speaker 4: and those values are really specific to that particular model run.
Speaker 4: So it's going to depend on the size of your
Speaker 4: study area, the strategy that you used for creating pseudo
Speaker 4: absence data, if you have a present pseudo absence model,
Speaker 4: and so those methodological decisions can actually flip flop those
Speaker 4: variable important scores. So, to give an example, if you
Speaker 4: had a massive study area where just a small portion
Speaker 4: of that represents the suitable occupied range of your species,
Speaker 4: you're likely going to see that at those broad scales,
Speaker 4: some of these regional climate variables, sometimes just simple predictors
Speaker 4: like forest non forest can look massively important because they're
Speaker 4: doing a lot of the heavy lifting of saying, well,
Speaker 4: a lot of these present these pseudo absence points are
Speaker 4: not suitable because they fall in these different climate spaces.
Speaker 4: But if you clip that same model down to just
Speaker 4: a small area, for instance, around a single national park,
Speaker 4: a single watershed, the climate variables become really uniform across
Speaker 4: those presence and pseudo absence points, and so those variables
Speaker 4: become less important to the model. They're less valuable for
Speaker 4: sorting your presence and absence points from each other. And
Speaker 4: so then you might start to see that these localized
Speaker 4: variables slope aspect, canopy structure, forest understory structures, so different
Speaker 4: things that are more small scale variables, those might then
Speaker 4: rise to the top of your importance ranking. So when
Speaker 4: you're looking at these variable importance values that you get
Speaker 4: from from a random forest, you really need to be thinking.
Speaker 5: Interpretation is key.
Speaker 4: So an appropriate interpretation would be to say something like,
Speaker 4: across this specific study area, and with our given presence
Speaker 4: absence data set, precipitation was the most effective tool for
Speaker 4: distinguishing presence locations from absence locations. So that is, you know,
Speaker 4: a lot of nuance, a lot of qualifiers, but that's
Speaker 4: really all you can say with these variable importance scores
Speaker 4: on an SDM model. You shouldn't jump to the conclusion
Speaker 4: that because of these importance scores you found that precipitation
Speaker 4: is the most important niche requirement for this species, or
Speaker 4: it's more important than this other variable, because those rankings
Speaker 4: are all going to depend on, or to a large extent,
Speaker 4: will depend on these different methodological decisions. So one of
Speaker 4: these additional considerations that I think is really important for
Speaker 4: us to bring up here is that we've illustrated this
Speaker 4: workflow for a spatial block cross validation. The ideas that
Speaker 4: you're really providing your classifier with a challenge. You're saying,
Speaker 4: I'm going to give you some portion of the spatial
Speaker 4: data to fit the model and ask you to predict
Speaker 4: for these left out spatial blocks. So that's an extrapolation challenge.
Speaker 4: And so there's actually a study that came out that
Speaker 4: was really a massive wake up call for a lot
Speaker 4: of the ecological mapping community. This Ploton at All paper
Speaker 4: demonstrated that if you just use a random cross validation
Speaker 4: where you're just leaving out individual presence and absence points,
Speaker 4: you have really strong auto correlation between your left out
Speaker 4: data points and nearby neighboring or adjacent points that were
Speaker 4: included in the model fitting. And so Ploton at All
Speaker 4: basically found that you could have a model that looks
Speaker 4: incredibly powerful on paper, so you can have a fairly
Speaker 4: high R squared value, But when you do spatial block
Speaker 4: cross validation, you find that your model accuracy is basically zero.
Speaker 4: So the model hasn't learned ecological relationships. It's not able
Speaker 4: to extrapolate and say the likelihood of presence for a
Speaker 4: species in this particular part of the map compared to
Speaker 4: another part of the map, so it basically just memorized
Speaker 4: a geographic pattern rather than learned important underlying relationships. However,
Speaker 4: there's also this counterpoint that wadeau at All then had
Speaker 4: a response where they argue that spatial cross validation really
Speaker 4: punishes the model for poor extrapolation rather than just measuring
Speaker 4: how good the underlying map is. And you're also sacrificing
Speaker 4: data when you do a training testing partition and you
Speaker 4: basically take out some of your data. You're trying to
Speaker 4: fit the model with say seventy percent of the data,
Speaker 4: and you're omitting key geographic regions. So I think a
Speaker 4: good analogy is that you could just think of this
Speaker 4: as a debate over what exam you're giving your model.
Speaker 4: So Ploton at All are worried that you're the model
Speaker 4: is cheating because it's looking at its neighbors test paper.
Speaker 4: So you have this spatial auto correlation, and that really
Speaker 4: can be a problem if your model is overfit to
Speaker 4: a species current distribution, and if your goal is to
Speaker 4: be able to do something like predict future ranges under
Speaker 4: different climate scenarios, or extrapolate two different geographies to understand
Speaker 4: invasive potential of a species, for instance. But Wado would
Speaker 4: all argue that requiring spatial block cross validation is like
Speaker 4: forcing a student who studied Virginia ecology in the US
Speaker 4: to take an exam on the ecology of the Sahara
Speaker 4: Desert and then claiming they're a bad student because they failed.
Speaker 4: So they're basically being asked to take a test that
Speaker 4: they hadn't trained for. And on top of that, you're
Speaker 4: assigning an open book test where you don't even allow
Speaker 4: them to reference certain pages in the book. So you're
Speaker 4: penalizing your model by sacrificing in fortion.
Speaker 5: And you have this.
Speaker 4: Problem where you're trying to test how well the model
Speaker 4: can extrapolate rather than just how good is that model
Speaker 4: or how good is that map. So I think the
Speaker 4: key conclusion there is just that you really want to
Speaker 4: think about what your objectives are when you're considering your
Speaker 4: model validation strategy. Another concept that you'll see a lot
Speaker 4: in the species distribution modeling literature is this idea of
Speaker 4: ensembling species distribution models, and so the ideas that there
Speaker 4: are all these different algorithms out there.
Speaker 5: You can even do what we've shown.
Speaker 4: Of having these ensembles of different random forests fit with
Speaker 4: different subsets.
Speaker 5: Of your data.
Speaker 4: And some of the benefits of ensembling or that you
Speaker 4: can smooth over prediction. So an individual model might over
Speaker 4: fit to the data set in a particular way, and
Speaker 4: if you average multiple models, you can actually get a
Speaker 4: result that is maybe more robust. You're smoothing out some
Speaker 4: of that variance among model runs, and you may have
Speaker 4: a better ability to predict or at strapolate those models.
Speaker 4: And so this is a cool example of some work
Speaker 4: we did in ME and MAR where we tried fitting
Speaker 4: three different models a random forest, a generalized boosted model,
Speaker 4: and a maxim model. And each of those models has
Speaker 4: particular areas where they performed well and performed poorly, and
Speaker 4: if you just look at the consensus region among those
Speaker 4: three models, you actually get a distribution model that looks
Speaker 4: really good for this particular species. Some of the criticisms
Speaker 4: that you see of ensembling are that you're inherently averaging
Speaker 4: out what we'd call peak performance. So you have a
Speaker 4: couple models that perform really well, other models perform poorly,
Speaker 4: and you average them, and you're basically diluting the strength
Speaker 4: of your best models by combining their predictions with those
Speaker 4: from your worst models. So there are studies out there
Speaker 4: that show that ensembles rarely beat the best single model
Speaker 4: for a specific landscape, but they can in certain cases
Speaker 4: be better at smoothing out these issues of overfitting and
Speaker 4: lead to more generalizable results. So that's also kind of
Speaker 4: an open debate in the species distribution modeling literature. And
Speaker 4: so finally, I just want to wrap up with a
Speaker 4: short summary of some key pitfalls and best practices. So
Speaker 4: I think one is just this principle garbage in, garbage out.
Speaker 4: So you want to avoid relying on cases where you
Speaker 4: really don't have robust representative spatial data for your species.
Speaker 4: So if you have heavily clustered, crowdsourced data, or if
Speaker 4: you're just blindly throwing environmental variables into the model, you're
Speaker 4: not likely to get a result that actually represents the
Speaker 4: distribution or the habitat suitability of that species. Another key
Speaker 4: point is just to think critically about what ecological predictor
Speaker 4: variables you're including in a model. If you have a
Speaker 4: species where it's distribution is really defined by a variable
Speaker 4: like soil type, if it's a species that requires sandy soils,
Speaker 4: for instance, then you're only going to get so far
Speaker 4: and your model is only going to be so good
Speaker 4: when you're trying to model the distribution of that species
Speaker 4: using only bioclimatic variables, for instance. So think critically about
Speaker 4: which variables are likely informative for mapping the distribution of
Speaker 4: your species. And it's also good practice to drop highly
Speaker 4: colinear variables. So sometimes you can have max temperature of
Speaker 4: the warmest month, max temperature of the warmest quarter, those
Speaker 4: two variables might be super correlated. Just pick one that
Speaker 4: you think makes the most biological sense there. Another key
Speaker 4: point is just being intentional about your background point selection.
Speaker 4: So if you have true absence data, then use it.
Speaker 4: I think this is really something that I hate to
Speaker 4: see is when there's a study where they basically collected
Speaker 4: presence absence data and then they fit a maccent model
Speaker 4: or a presence only distribution model that basically ignores the
Speaker 4: fact that they had absence data in the first place.
Speaker 4: That absence data is really useful for helping define and
Speaker 4: what your overall likelihood of a species occurring in a
Speaker 4: certain location is. And also going back to some of
Speaker 4: our background information, it's really important to remember these distinctions
Speaker 4: between true absence data pseudo absences, which are supposed to
Speaker 4: represent places where we don't have hard data but we
Speaker 4: expect the species is unlikely to occur. And then those
Speaker 4: background points, which are supposed to be a representative sample
Speaker 4: of your geographic and environmental space, also define those pseudo
Speaker 4: absences strategically, so you really want to think about areas
Speaker 4: that are potentially reachable by your study species. I mentioned
Speaker 4: earlier about these conflicting approaches for validation strategies, but really
Speaker 4: think about trying to match your validation strategy to your goal.
Speaker 4: So you can just use simple random sampling. Ideally you'd
Speaker 4: have independent random points that you're going to use to
Speaker 4: validate your map accuracy if you're interested in just simply
Speaker 4: how good is this map at representing the current distribution
Speaker 4: of this species? But if you really want to be
Speaker 4: thinking about regional transferability. So the giraffe example that Ramiro
Speaker 4: shared earlier, where you're taking spatial data from a subset
Speaker 4: of animals and you're trying to extrapolate to where else
Speaker 4: on the landscape you might have suitable habitat those are
Speaker 4: cases where you should probably consider a spatial block cross validation,
Speaker 4: where you're really testing the generalizability or extrapolation ability of
Speaker 4: your model. A few additional best practices are just to
Speaker 4: think about this one humble based prediction in cases where
Speaker 4: that might be really useful. So you likely want to
Speaker 4: avoid relying on just a single best cross validation fold
Speaker 4: So in our example, we did five different training testing
Speaker 4: data splits fit the model five times. We don't want
Speaker 4: to just rely on the best model rather than trying
Speaker 4: to generalize across those different data splits. And I think
Speaker 4: the same applies to algorithms, where sometimes by combining outputs
Speaker 4: from multiple algorithms, you can average out some of the
Speaker 4: variability among them and some of the overfitting and get
Speaker 4: a more robust result, even if the best model might
Speaker 4: still be a single individual algorithm. One thing that you'll
Speaker 4: see a lot, especially with climate forecasting, is that many
Speaker 4: of these algorithms, especially some of these machine learning approaches,
Speaker 4: aren't great at extrapolating outside their training range. So you
Speaker 4: can run what's called a multivariate environmental similarity surface analysis.
Speaker 4: And the idea here is that you want to look
Speaker 4: at the range of environmental conditions that you actually had
Speaker 4: data for in order to see whether some of your
Speaker 4: prediction space represent environmental conditions that are completely novel where
Speaker 4: you don't have any data that speaks to whether the
Speaker 4: species should occur in those types of places or not.
Speaker 4: So that's really important if your goal is to project
Speaker 4: into new geographic areas or future climate conditions, so that
Speaker 4: you can basically flag where your predictions may be unreliable.
Speaker 4: I think another key point here is just that you
Speaker 4: often see species distribution modeling where at the end you
Speaker 4: have this binary map which is presence and absence, and
Speaker 4: that really smooths over a lot of the meaningful ecological
Speaker 4: nuance that when you fit these sdms and you have
Speaker 4: a probability surface, that variation is meaningful. So having low
Speaker 4: suitability doesn't mean necessarily that the species isn't there. So
Speaker 4: I think it's really best practice to share these continuous
Speaker 4: probability surfaces and not just those binary maps. And finally,
Speaker 4: I want to go back to this point that we
Speaker 4: mentioned earlier about how habitat suitability doesn't necessarily equal presence.
Speaker 4: So when we're doing this environmental niche modeling or we're
Speaker 4: fitting these species distribution models, we are generating these suitability predictions.
Speaker 4: But you can have any number of reasons that a
Speaker 4: species might not occur in a place that is predicted
Speaker 4: to be suitable. So we mentioned several of these, but
Speaker 4: they could have been extre paid by humans. There could
Speaker 4: be some biogeographic variable that has prevented the species from
Speaker 4: reaching certain portions of their suitable habitat. So just remembering
Speaker 4: at the end of the day that this is predicted
Speaker 4: suitability based on a model, it doesn't necessarily equate to
Speaker 4: species presence. And finally, I just wanted to mention that
Speaker 4: there are a lot of these points we've gone through
Speaker 4: that you know, there's a lot of nuance to your
Speaker 4: model fitting options and workflows, So we wanted to give
Speaker 4: these examples. In Google Earth Engine, where you can see
Speaker 4: how to modify a basic workflow fit species distribution models.
Speaker 4: We show a few of these tweaks like how you
Speaker 4: incorporate that spatial block cross validation, how you quantify uncertainty.
Speaker 4: But I think a really good reference is this od
Speaker 4: MAP protocol, which is basically a published paper showing some
Speaker 4: of the key steps in a species distribution modeling pipeline.
Speaker 4: And so I think this is a really good reference
Speaker 4: for being able to go to the next level with
Speaker 4: your modeling. So thinking about how do I adapt these
Speaker 4: basic workflows and ensure that I'm following these best practices
Speaker 4: for distribution modeling, And so finally I just wanted to
Speaker 4: share these couple of resources. So we have the original
Speaker 4: manuscript that Ramiro had referenced where we published some of
Speaker 4: these workflows and several case study examples for implementing distribution
Speaker 4: modeling in Google earth Engine. And we also wanted to
Speaker 4: mention that the Earth Engine code and data for this
Speaker 4: workshop are also freely available, so we'll make that make
Speaker 4: those scripts available at this repository.
Speaker 5: And so the goal is.
Speaker 4: That you'd be able to take those use them, adapt them,
Speaker 4: and also be thinking about how you incorporate some.
Speaker 5: Of these best practices that.
Speaker 4: We've covered in this training and that you might find
Speaker 4: in other references, like in that od map pipeline.
Speaker 5: So thank you very much.
Speaker 1: Thank you Ramido, Jared and Grant for sharing your expertise
Speaker 1: with us over these past two sessions. We are sincerely
Speaker 1: grateful for your collaboration. So a lot was covered in
Speaker 1: today's session. In summary, this training introduced and demonstrated a
Speaker 1: workflow for building a machine learning model in Google Earth Engine.
Speaker 1: They highlighted the data preparation and spatial optimization processes, allowing
Speaker 1: us to review initial steps for uploading ag existing species data,
Speaker 1: essential preprocessing steps, spatial thinning techniques for presence data, and
Speaker 1: methods to define areas of interest. Our presenters discussed predictor
Speaker 1: variable selection and access data from the Google Earth Engine catalog.
Speaker 1: They reviewed an absence strategy, introducing us to concepts of
Speaker 1: true presence and absence, providing techniques to generate pseudo absence points.
Speaker 1: They contrasted model validation methods and illustrated variable importance of
Speaker 1: environmental layers. A key message I took away was how
Speaker 1: crucial it is to align model evaluation strategies directly with
Speaker 1: overarching project objectives. And lastly, they provided details about common
Speaker 1: pitfalls and best practices. As I mentioned, there will be
Speaker 1: one homework assignment which following this training that you can
Speaker 1: access on our web page. You must have attended both
Speaker 1: webinars and complete the homework assignment by the deadline in
Speaker 1: order to get this certificate. Here is our contact information.
Speaker 1: Should you have any additional questions, feel free to visit
Speaker 1: our website to browse past training sign up for new ones.
Speaker 1: Our YouTube channel is also linked here. We also encourage
Speaker 1: you to join our mailing list. All right, so we
Speaker 1: definitely want to hear your thoughts. Within a day or two,
Speaker 1: we will send you an invitation to complete a short
Speaker 1: online survey this information that we get the feedback is
Speaker 1: super important and helps us improve our our set program.
Speaker 1: Your participation is optional and your responses are confidential, so
Speaker 1: please keep an eye out. This is not spam. So
Speaker 1: with that, we thank you again for joining us, and
Speaker 1: we are going to move into the Q and A shortly.
Speaker 1: We had so many questions during this training, so many
Speaker 1: questions that we were able to take track of while
Speaker 1: you all were putting everything in the chat. So currently
Speaker 1: we are looking at about thirty three questions that the
Speaker 1: team has been watching very closely and doing their best
Speaker 1: to feel and responses as we went so in order
Speaker 1: to just spend some time and put some voice to
Speaker 1: those questions. We are gonna go ahead and show the
Speaker 1: document that contains all of the questions that will be
Speaker 1: posted to the website. So question one when you download
Speaker 1: data from JBEF, what is the analysis area extent? Can
Speaker 1: I do it for a location radius ten kilometers for instance?
Speaker 1: Can I analyze a much larger area? Also? Does it
Speaker 1: work in the whole world? So you can set the
Speaker 1: extent in GIEBEF, for instance, restrict the data to a
Speaker 1: bounding box or a specific country, and you can certainly
Speaker 1: download the data for the entire world too. You can
Speaker 1: also select points in Google Earth Engine with a filter.
Speaker 1: There's a lot of flexibility in getting the data set
Speaker 1: you actually need in your modeling exercise. Another question we
Speaker 1: had when uploading data where is it safe? Is it
Speaker 1: connected to my Google account or is the Earth Engine
Speaker 1: account separate? Thinking about safety for coordinates that should be
Speaker 1: kept secret for protected species and such. So the data
Speaker 1: that is saved as an asset and it takes storage
Speaker 1: from your Google account. It is all connected with your
Speaker 1: Google cloud. You can see all of your assets in
Speaker 1: the Assets tap. In terms of sharing, the data will
Speaker 1: be accessible only to you, unless you specify either specific
Speaker 1: person that you want to allow to access or by
Speaker 1: making the data publicly available. You can check again in
Speaker 1: the recording where it was shown that there was a
Speaker 1: place to make the data public. Question three. When defining
Speaker 1: spatial resolution, does Google earth Engine automatically upscale or downscale
Speaker 1: the collected data or must a custom script be written
Speaker 1: to process such dataset manually. Google earth Engine by default
Speaker 1: operates on a pool basis where it resamples your data
Speaker 1: and any other data you're working with from the catalog
Speaker 1: awesome Google earth Engine community data sets, etc. Only at
Speaker 1: the point that you request an output at a certain resolution.
Speaker 1: So it may be only at the export step that
Speaker 1: you define a specific spatial resolution for example thirty meters,
Speaker 1: and Google earth Engine will handle the resampling and reprojection
Speaker 1: automatically during the export process. You don't need to be
Speaker 1: constantly upscaling and downscaling or resampling every time you bring
Speaker 1: in a new data set into your st One thing
Speaker 1: to note is that when you add outputs to the
Speaker 1: map viewer the map viewer window, the resolution of the
Speaker 1: output will depend on your zoom level. You can force
Speaker 1: Google earth Engine to resample to just a given resolution
Speaker 1: or grid, but typically you would use the map viewer
Speaker 1: just to explore or problem solve, and then export your
Speaker 1: final outputs at your desired resolution as your last step.
Speaker 1: Another important note is that it is good to familiarize
Speaker 1: yourself with how Google Earth Engine handles this on the
Speaker 1: fly or final resampling. For instance, the default is that
Speaker 1: Google Earth Engine uses the nearest neighbor resampling, and this
Speaker 1: may not be what you want. All right, everyone, So
Speaker 1: that was us just getting through the first three questions,
Speaker 1: and I know we have been online for a long time,
Speaker 1: so I want to invite our guests who are here
Speaker 1: with us, Grant, Jared if Ramito, if any of you
Speaker 1: would like to share for some of the next few questions,
Speaker 1: I'm happy to read them. But you all have that
Speaker 1: expertise and want to give the credit for the hard
Speaker 1: work you put into answering all of these. And again,
Speaker 1: we have over thirty at this point.
Speaker 2: I'm happy to answer Annie or maybe select if you
Speaker 2: are super interesting.
Speaker 1: Okay, yeah, me too.
Speaker 5: We're all here, happy to help.
Speaker 2: And yeah, also take the opportunity to thank everyone for
Speaker 2: showing up and super good to see such a response.
Speaker 1: What if you each choose one that you want to
Speaker 1: share speak some life into and then that might be
Speaker 1: a good time to close out following so that way
Speaker 1: we can get people some time back.
Speaker 2: Okay, I can go with one question thirteen. Someone asks ultimately,
Speaker 2: especially tribution models will not be realistic with that accounting
Speaker 2: for human behavior data. Do you have some snippets that
Speaker 2: account for the daytawn human behaviors such as hunting, cattle grazing,
Speaker 2: and infrastructure such as roads. And this is a very
Speaker 2: important point, and this is what rule the engine is
Speaker 2: so good at. A common use product that's exactly for
Speaker 2: this is called these human modification index that actually incorporates
Speaker 2: rose line, infrastructure, different landcover types, so if you have
Speaker 2: a farm, it has more impact than in park livestock.
Speaker 2: A lot of that data is integrated and create this
Speaker 2: kind of index that there is a link there to
Speaker 2: that as that image that you can incorporate into your model.
Speaker 2: It's actually broadly use in special descution models. There are
Speaker 2: other other ones like people used, like the light pollution,
Speaker 2: so from satellites at night, you can use light pollution
Speaker 2: to use that as a coveriable continue with this answer
Speaker 2: basics looked through the data catalog or the awesome Googler
Speaker 2: tengient community data set to the term which layers are
Speaker 2: currently available. For instance, you can use road data Googler
Speaker 2: tangent from the Tiger Roads data for the US, or
Speaker 2: the Relower Road Inventory project data set from the asome
Speaker 2: Goglar community data set to calculate road density, or even
Speaker 2: import your own data sets into Googler Engine to meet
Speaker 2: their own project objectives. I passed to when a few
Speaker 2: runt or.
Speaker 6: Yeah, one second, just trying to get my camera to
Speaker 6: be working here. Yeah, I'll just do number twelve because
Speaker 6: it relates to collinearity, which is a common question I think,
Speaker 6: and I think it came up quite a few times.
Speaker 5: In the chat.
Speaker 6: So the question number twelve is could you run some
Speaker 6: sort of collinearity study, like a variance inflation factor to
Speaker 6: eliminate highly collinear variables in JavaScript before modeling. So yes, certainly,
Speaker 6: some SDM models are fairly robust to collinearity, like the
Speaker 6: models that we showed here that Maria on Graham were
Speaker 6: walking through the random forest, while others are not, like
Speaker 6: logistic aggression. So it's often a good idea to check
Speaker 6: for highly correlated covariates as a preliminary step. And it's
Speaker 6: worth noting that variable inform importance metrics can be influenced
Speaker 6: by culinary since having a bunch of correlated variables in
Speaker 6: a model tends to reduce important statistics for these variables.
Speaker 6: And the original code that we published in our manuscript,
Speaker 6: there is code that checks for corelinary correlation between predicted variables,
Speaker 6: so that is also included. So I would just refer
Speaker 6: you to that original manuscript that has all the code
Speaker 6: that was put together to run all the models that
Speaker 6: are published in that publication.
Speaker 4: Okay, thanks, and I was thinking I'll jump down to
Speaker 4: question number twenty. So yeah, there are a lot of
Speaker 4: great questions that people put in the Q and A
Speaker 4: and really appreciate the engagement that you all have shown
Speaker 4: with this. It's been a lot of action in the chat,
Speaker 4: so I know these Q and A documents will be
Speaker 4: sent out. So if you asked a question, that should
Speaker 4: be answered. But question twenty, I think is something that
Speaker 4: just is a good wrap up. I think, so the
Speaker 4: question was GEE facilitates large scale analysis, but its workflows
Speaker 4: often rely on temporal composites, collapsing pixel phonology into summary
Speaker 4: statistics like the median given the time first space later
Speaker 4: paradigm in the sites are package. How could incorporating pixel
Speaker 4: phonology improve species distribution models? Moreover, are the methods presented
Speaker 4: in this r set compatible with using full time series
Speaker 4: information predictors or do they inherently require temporally aggregated variables?
Speaker 4: So I just wanted to talk through what this the
Speaker 4: goal of this example workflow was. It's really we wanted
Speaker 4: to show you a workflow that you can take and
Speaker 4: modify for your own purposes, so it doesn't inherently require
Speaker 4: certain types of predictor variables. So you basically need three things.
Speaker 4: You need a current data, you need predictor variables that
Speaker 4: are raster data sets, and you need a model or
Speaker 4: algorithm like random forest for relating those two. So your
Speaker 4: predictors can really be anything that you feel is biologically
Speaker 4: meaningful and that you can represent as a raster data set.
Speaker 4: So you could do something like write some Google Earth
Speaker 4: Engine code that calculates the standard deviation in a vegetation
Speaker 4: metric like in DVII over time. Then you can use
Speaker 4: those pixel values as a measure of variability and phonology,
Speaker 4: So there are a lot of published studies and examples
Speaker 4: and code where people extract phenological metrics in Google Earth Engine.
Speaker 4: Any of those could really be used as predictors if
Speaker 4: you can basically specify them in raster format.
Speaker 5: So I think the goal is that we.
Speaker 4: Really want you to unleash your inner model or think
Speaker 4: about what really matters for your species, and then if
Speaker 4: you can find existing data sets where you can use
Speaker 4: those as predictors, or others where you can modify some
Speaker 4: existing code and get what you feel is important for
Speaker 4: your species to incorporate in the model, then that's really
Speaker 4: the goal, is that you'd be able to do that.
Speaker 1: Wonderful. Well, thank you so much. We're spending all this
Speaker 1: time with us for getting this entire series put together
Speaker 1: so that we could share with our our set community.
Speaker 1: We hope everyone has a beautiful rest of their day.
Speaker 1: And if you weren't in this session, there is is
Speaker 1: a duplicate session that will begin later this afternoon, So
Speaker 1: with that we will say goodbye.
Speaker 3: So everybody, thanks so much, and anyone who is still
Speaker 3: on and listening.
Speaker 1: There are optional exercises on the training page
Podbean