Skip to content
Snippets Groups Projects
Commit b9d96035 authored by Raimon Tolosana-Delgado's avatar Raimon Tolosana-Delgado
Browse files

validation bug corrected

parent 11d10355
No related branches found
No related tags found
No related merge requests found
Package: gmGeostats
Version: 0.10-7.9003
Version: 0.10-7.9004
Date: 2020-10-05
Title: Geostatistics for Compositional Analysis
Authors@R: c(person(given = "Raimon",
......
# gmGeostats 0.10.7.9004
* (2021-06-23) bug in validate.NfoldCrossValidation() corrected
# gmGeostats 0.10.7.9003
* (2021-04-08) exported turning bands for direct usage
* (2020-10-01) bug in turning bands spherical variogram corrected
# gmGeostats 0.10.7
# gmGeostats 0.10.7
* (2020-09-27) updated references in generalised diagonalisations; improved/reimplemented `as.logratioVariogram()` and `as.logratioVariogramAnisotropy()` methods; minor edits at `plot.logratioVariogramAnisotropy()` and `variogramModelPlot.logratioVariogram()`
* (2020-09-24) openMP pragmas enclosed, to improve portability
......
......@@ -98,15 +98,18 @@ validate.LeaveOneOut = function(object, strategy, ...){
#' @method validate NfoldCrossValidation
#' @export
validate.NfoldCrossValidation = function(object, strategy, ...){
# manage "gstat" case
if("gstat" %in% class(object)){
warning("validate: object provided is of class 'gstat', attempting 'gstat.cv(..., remove.all=TRUE, all.residuals=TRUE)'")
return(gstat::gstat.cv(object, nfold=strategy$nfolds, remove.all = TRUE, all.residuals = TRUE))
}
# manage "gmSpatialModel" case
object = try(as.gmSpatialModel(object))
if(class(object)=="try-error") stop("validate.NfoldCrossValidation: provided object not interpretable")
# interpret the information about the n-folds provided
n = strategy$nfolds
m = nrow(object@data)
nms = rownames(object)
if(length(n)==1){
nmax = n
n0 = rep(1:n, each=ceiling(m/n))
......@@ -115,21 +118,27 @@ validate.NfoldCrossValidation = function(object, strategy, ...){
nmax = max(n)
}
if(length(n)!=m) stop("validate.NfoldCrossValidation: provided n-fold info not interpretable (should be either an integer, or a grouping factor)")
# one fold validation function
myfun = function(i){
tk = (n==i)
object0 = object
object0@data=object@data[!tk,]
object0@coords=object@coords[!tk,]
rs = predict(object0, newdata = object@coords[tk,])
object0@data=object@data[!tk,, drop=FALSE]
object0@coords=object@coords[!tk,, drop=FALSE]
rs = predict(object0,
newdata = sp::SpatialPoints(coords = object@coords[tk,, drop=FALSE],
proj4string = sp::CRS(sp::proj4string(object)),
bbox=sp::bbox(object))
)
}
# apply to each data slice
requireNamespace("foreach", quietly = TRUE)
if(!strategy$doAll) return(myfun(1))
i = 1:nmax
res = foreach(i=i, .combine ="list") %dopar% myfun(i)
res = unsplit(res, f=n)
res = foreach(i=i, .combine ="rbind") %dopar% myfun(i)
# reorder and return
res = res[nms,]
return(res)
}
This diff is collapsed.
## Test environments
## Test environments
* Linux: Ubuntu 18.04.4LTS (local)
- R 3.4.4 (production)
- R devel 2020-07-28 r78930 (test)
- R patched 4.0.2 r78930 (test)
* Windows 7 Enterprise (test)
- R 3.5.1 (test)
* Linux: Ubuntu 18.04.4LTS (local)
- R 3.4.4 (production)
- R devel 2020-07-28 r78930 (test)
- R patched 4.0.2 r78930 (test)
* Windows 7 Enterprise (test)
- R 3.5.1 (test)
- R 4.0.2 (test)
## R CMD check results
## R CMD check results
0 errors | 0 warnings | 0 notes
## This is a resubmission
## This is a resubmission
```
Dear maintainer,
```
Dear maintainer,
Please see the problems shown on
Please see the problems shown on
<https://cran.r-project.org/web/checks/check_results_gmGeostats.html>.
Please correct before 2020-10-03 to safely retain your package on CRAN.
The CRAN Team
```
The CRAN Team
```
... the sympthom being an error while #include <omp.h> in r-release-macos-x86_64, we identified the problem as a lack of appropriate linkage of OpenMP.
... the sympthom being an error while #include <omp.h> in r-release-macos-x86_64, we identified the problem as a lack of appropriate linkage of OpenMP.
Solution:
Solution:
1.- the header inclusion and all usages of #pragma directives were enclosed in conditional structures
#ifdef _OPENMP
#ifdef _OPENMP
...
#endif
#endif
2. `$(SHLIB_OPENMP_CFLAGS)` was added to PKG_CFLAGS and PKG_LIBS fields in Makevars files
2. `$(SHLIB_OPENMP_CFLAGS)` was added to PKG_CFLAGS and PKG_LIBS fields in Makevars files
NOTE: we do not have access to any MacOS machine to test that our solution is effective. Our apologies if this is not working!
\ No newline at end of file
......@@ -341,6 +341,7 @@ void getUnitvec(
unitvec[0] = cos(d1)*d3;
unitvec[1] = sin(d1)*d3;
} else if( dimX==2 ) {
Rprintf("Warning: gmGeostatsC.getUnitvec in 2D is incompatible with spherical variograms");
d1=invBitExp2(ip);
unitvec[0] = cos(d1*M_PI);
unitvec[1] = sin(d1*M_PI);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment