From 71f6691fb9a9d350e9dba2940bd0abf326062028 Mon Sep 17 00:00:00 2001 From: SpatLyu Date: Tue, 18 Jun 2024 10:04:29 +0800 Subject: [PATCH] rebuild RGD vignette --- .../__pycache__/cpd_disc.cpython-39.pyc | Bin 1736 -> 1736 bytes vignettes/RGD.Rmd | 38 +++++++++--------- vignettes/RGD.Rmd.orig | 4 +- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/inst/python/__pycache__/cpd_disc.cpython-39.pyc b/inst/python/__pycache__/cpd_disc.cpython-39.pyc index 7166523b5e1d83d41cd39883067e6fe67f28b692..efc1c9d400dcc87bcc0673e736dae4ee128dae70 100644 GIT binary patch delta 567 zcmYjO%Wl*#6m1+QGt(-Fhmb~<+5(+YB2a~315(ARs>GHJk|h{<#-7L}aiVJn&9I>S z0IU203t-1z^c&2IKjGd)JhC{s_gwp&bLFe-D$8V+ZExXs&DquIkL)$u6-iYqU50UG z?A)0TTJVduYVt^QAK4M&7xwB>@Ux9=LcB6wj2h6&EPY6gbsBs~K-xlw*m(%7Q6gTp zK5!)8<<|pKK17=ktpzI_jL;gXm6*J=s&(h4L_4*bKM{QWUP6c#V(e=0TFn(t3vZzA}+O?&J9TJJmw=FpAKF2?&hu8x_&H_7m4ELx^;Gp}&_jdOF3}M!N<LMS^F&Wh3vKnfffsjZ@UUAaCzn&2#HF^th}=aGlQZe% zImk-G4I*z6+(O95a6ol$l~Z+0@Bl$1%NlnQ6A6Wzm&W-JV?XSY4pI8Me{TQ@j0UY) z_b9#l<|z^wo6~PQBo?1;(%=gIV`I G-Tw{UFOe(& delta 567 zcmYjO%Wl*#6m1+QlPL;f1AR!XK%%N5p{gBPXeGp|RO+@uVg)15*b})VPIT>{nJy?l z&{ckc1!c!y^c!wh6+cqnL_D%Mx%V9V+;iod^d?P3nl3N-@ArE-TmO}QVCxu_l~e^L zr8Z-$FBJ0grmV97+plcP<9Bv;iTrqBY7A%E;h+X3_0(akjaA?<0%3B6p>=?)mKaVO zhuo8&vq#9J!(f5I99eE5@uNL8!{MosjXlwYA17zy5%T#L0T@g$u@yKa#}gb_of}bD zj`6AlIBc3f!dF!X)DOWa54?*6?2WH9KxM(vCE z*~fRD@Uc1lmN7E^=@wlAjB8<}uzkD)n%XsFzD9%N^J-G)NuNLT43JMZ_&*r6KjY1N D^ah>} diff --git a/vignettes/RGD.Rmd b/vignettes/RGD.Rmd index 1489f54e..094aa7c6 100644 --- a/vignettes/RGD.Rmd +++ b/vignettes/RGD.Rmd @@ -28,13 +28,13 @@ library(terra) ``` r library(tidyverse) -## ── Attaching core tidyverse packages ────────────────────────────────── tidyverse 2.0.0 ── +## ── Attaching core tidyverse packages ─────────────────────────────────────── tidyverse 2.0.0 ── ## ✔ dplyr 1.1.4 ✔ readr 2.1.5 ## ✔ forcats 1.0.0 ✔ stringr 1.5.1 ## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1 ## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1 ## ✔ purrr 1.0.2 -## ── Conflicts ──────────────────────────────────────────────────── tidyverse_conflicts() ── +## ── Conflicts ───────────────────────────────────────────────────────── tidyverse_conflicts() ── ## ✖ tidyr::extract() masks terra::extract() ## ✖ dplyr::filter() masks gdverse::filter(), stats::filter() ## ✖ dplyr::lag() masks stats::lag() @@ -63,8 +63,8 @@ fvc ``` r names(fvc) -## [1] "fvc" "premax" "premin" "presum" "tmpmax" "tmpmin" "tmpavg" "pop" "ntl" -## [10] "lulc" "elev" "slope" "aspect" +## [1] "fvc" "premax" "premin" "presum" "tmpmax" "tmpmin" "tmpavg" "pop" "ntl" "lulc" +## [11] "elev" "slope" "aspect" ``` ### Convert data from `SpatRaster` to `tibble` @@ -91,11 +91,10 @@ We can use `robust_disc()` to discretize them based on offline change point dete ``` r -set.seed(12345678) tictoc::tic() new.fvc = robust_disc(fvc ~ .,data = select(fvc,-lulc),discnum = 15,cores = 6) tictoc::toc() -## 2745.55 sec elapsed +## 2595.78 sec elapsed ``` @@ -117,25 +116,25 @@ new.fvc ## # ℹ 5,230 more rows ``` -The `new.fvc` is the discrete result,we can combine it with `fvc` and `lulc` col in `fvc` tibble now. +The `new.fvc` is the discrete result,we can combine it with `fvc` and `lulc` col in `fvc` tibble now. ``` r new.fvc = bind_cols(select(fvc,fvc,lulc),new.fvc) new.fvc ## # A tibble: 5,240 × 13 -## fvc lulc premax premin presum tmpmax tmpmin tmpavg pop ntl elev slope aspect -## -## 1 0.188 10 group10 group1 group1 group8 group4 group5 group7 grou… grou… grou… group4 -## 2 0.162 10 group10 group1 group1 group9 group4 group7 group10 grou… grou… grou… group… -## 3 0.168 10 group11 group1 group1 group8 group4 group5 group8 grou… grou… grou… group… -## 4 0.186 10 group13 group1 group1 group8 group2 group4 group7 grou… grou… grou… group… -## 5 0.189 10 group10 group1 group1 group8 group4 group5 group1 grou… grou… grou… group7 -## 6 0.171 10 group10 group1 group1 group9 group4 group5 group2 grou… grou… grou… group7 -## 7 0.153 10 group10 group1 group1 group9 group4 group7 group8 grou… grou… grou… group4 -## 8 0.163 10 group10 group1 group1 group9 group4 group7 group8 grou… grou… grou… group… -## 9 0.176 10 group10 group1 group1 group8 group4 group5 group10 grou… grou… grou… group… -## 10 0.177 10 group11 group1 group1 group8 group4 group5 group9 grou… grou… grou… group… +## fvc lulc premax premin presum tmpmax tmpmin tmpavg pop ntl elev slope aspect +## +## 1 0.188 10 group10 group1 group1 group8 group4 group5 group7 group14 group13 group… group4 +## 2 0.162 10 group10 group1 group1 group9 group4 group7 group10 group14 group11 group… group… +## 3 0.168 10 group11 group1 group1 group8 group4 group5 group8 group14 group13 group… group… +## 4 0.186 10 group13 group1 group1 group8 group2 group4 group7 group14 group13 group… group… +## 5 0.189 10 group10 group1 group1 group8 group4 group5 group1 group14 group13 group… group7 +## 6 0.171 10 group10 group1 group1 group9 group4 group5 group2 group14 group11 group… group7 +## 7 0.153 10 group10 group1 group1 group9 group4 group7 group8 group14 group9 group6 group4 +## 8 0.163 10 group10 group1 group1 group9 group4 group7 group8 group14 group9 group… group… +## 9 0.176 10 group10 group1 group1 group8 group4 group5 group10 group14 group13 group… group… +## 10 0.177 10 group11 group1 group1 group8 group4 group5 group9 group14 group9 group… group… ## # ℹ 5,230 more rows ``` @@ -332,7 +331,6 @@ gd(fvc ~ .,data = new.fvc,type = 'interaction') ``` r -set.seed(12345678) fvc_rgd = rgd(fvc ~ ., data = fvc, discnum = 15, discvar = names(select(fvc,-c(fvc,lulc))), cores = 6, type = c('factor','interaction')) diff --git a/vignettes/RGD.Rmd.orig b/vignettes/RGD.Rmd.orig index 42e87a57..3560daa6 100644 --- a/vignettes/RGD.Rmd.orig +++ b/vignettes/RGD.Rmd.orig @@ -54,7 +54,6 @@ Only `lulc` is a discrete category variable in the `fvc` data, we need to discre We can use `robust_disc()` to discretize them based on offline change point detection. ```{r} -set.seed(12345678) tictoc::tic() new.fvc = robust_disc(fvc ~ .,data = select(fvc,-lulc),discnum = 15,cores = 6) tictoc::toc() @@ -64,7 +63,7 @@ tictoc::toc() new.fvc ``` -The `new.fvc` is the discrete result,we can combine it with `fvc` and `lulc` col in `fvc` tibble now. +The `new.fvc` is the discrete result,we can combine it with `fvc` and `lulc` col in `fvc` tibble now. ```{r} new.fvc = bind_cols(select(fvc,fvc,lulc),new.fvc) @@ -83,7 +82,6 @@ gd(fvc ~ .,data = new.fvc,type = 'interaction') ### You can also use `rgd()` in one time to get result above. ```{r} -set.seed(12345678) fvc_rgd = rgd(fvc ~ ., data = fvc, discnum = 15, discvar = names(select(fvc,-c(fvc,lulc))), cores = 6, type = c('factor','interaction'))