Replies: 5 comments 6 replies
-
Thanks, we'll take a look -- @pat-s |
Beta Was this translation helpful? Give feedback.
-
@be-marc added the dataset, he can probably say more or extend the documentation.
You need to bring your own point and raster data, similar as you would bring your own CSV data.
I am not sure what you mean here, {mlr3spatial} does not aim to cover FS. See {mlr3fselect} for FS in mlr3. |
Beta Was this translation helpful? Give feedback.
-
Yes, I created a .tif file from the copernicus open access format (.jp2 and auxiliary files). But that's something you don't do with mlr3spatial. mlr3spatial handles raster objects from the packages terra, raster, and stars. Maybe take a look at these packages. They load spatial data into R. Point vector data is loaded with the sf package.
This works library(mlr3spatial)
library(mlr3fselect)
instance = fselect(
method = "random_search",
task = tsk("leipzig"),
learner = lrn("classif.rpart"),
resampling = rsmp("holdout"),
measure = msr("classif.ce"),
term_evals = 10,
batch_size = 5
) |
Beta Was this translation helpful? Give feedback.
-
The features are the spectral bands (b02, b03, ...) of the Sentinel-2 image for each point. I also calculated the NDVI from them.
No, the xy coordinates are not passed to the model. tsk("leipzig")
<TaskClassifST:leipzig> (97 x 9)
* Target: land_cover
* Properties: multiclass
* Features (8):
- dbl (8): b02, b03, b04, b06, b07, b08, b11, ndvi
* Coordinates:
X Y
1: 732480.1 5693957
2: 732217.4 5692769
3: 732737.2 5692469
4: 733169.3 5692777
5: 732202.2 5692644
---
93: 733018.7 5692342
94: 732551.4 5692887
95: 732520.4 5692589
96: 732542.2 5692204
97: 732437.8 5692300 The model is only fitted with the 8 features. The coordinates are usually used for spatial resampling.
No. Feature selection is not used to determine important areas. The unsupervised task is used to predict a map with the previously fitted model. |
Beta Was this translation helpful? Give feedback.
-
@be-marc: Oh yes this is fantastic! I suggest adding this to the book. @pat-s: You are right I meant to write "task" there not "learner." Sorry about that. |
Beta Was this translation helpful? Give feedback.
-
The mlr3spatial package requires loading in sample points: https://github.com/mlr-org/mlr3spatial/blob/main/README.md
It says the data is from the built-in toy task Leipzig which comes from the Copernicus Open Access hub. But the hub doesn't download .tif files. (You can download a variety of mapping files.)
Chapter 8.3.6.2 Spatial prediction explains how to use the raster image for prediction, but there's no explanation of how to get point vector data and raster images of the area you want to map.
And there's no other way to do feature selection with the spatial task.
Beta Was this translation helpful? Give feedback.
All reactions