Skip to content

Commit

Permalink
ready to merge VII
Browse files Browse the repository at this point in the history
  • Loading branch information
fab-scm committed Jan 24, 2024
1 parent 575bf8e commit 8478288
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ importFrom(stats,predict)
importFrom(stats,quantile)
importFrom(stats,sd)
importFrom(utils,combn)
importFrom(utils,setTxtProgressBar)
importFrom(utils,txtProgressBar)
2 changes: 1 addition & 1 deletion R/CAST-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#'
#' @import caret
#' @importFrom stats sd dist na.omit lm predict quantile na.exclude complete.cases
#' @importFrom utils combn txtProgressBar
#' @importFrom utils combn txtProgressBar setTxtProgressBar
#' @importFrom grDevices rainbow
#' @importFrom graphics axis plot segments
#' @keywords package
Expand Down
1 change: 1 addition & 0 deletions R/DItoErrormetric.R
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ multiCV <- function(model, length.out, method, useWeight, what,...){
#' Get Preds all
#' @param model, a model
#' @param trainDI, a trainDI
#' @param what Character. Which measure to use for the error metric. "DI" or "LPD"
#'

get_preds_all <- function(model, trainDI, what){
Expand Down
2 changes: 1 addition & 1 deletion R/aoa.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#' @param method Character. Method used for distance calculation. Currently euclidean distance (L2) and Mahalanobis distance (MD) are implemented but only L2 is tested. Note that MD takes considerably longer.
#' @param useWeight Logical. Only if a model is given. Weight variables according to importance in the model?
#' @param LPD Logical. Indicates wheather the LPD should be calculated or not.
#' @param maxLPD numeric or integer. Only if \code{LPD = TRUE}. Number of nearest neighbors to be considered for the calculation of the LPD. Either define a number between 0 and 1 to use a percentage of the number of training samples for the LPD calculation or a whole number larger than 1 and smaller than the number of training samples. CAUTION! If not all training samples are considered, a fitted relationship between LPD and error metric will not make sense (@seealso \code{\link{LPDtoErrormetri}})
#' @param maxLPD numeric or integer. Only if \code{LPD = TRUE}. Number of nearest neighbors to be considered for the calculation of the LPD. Either define a number between 0 and 1 to use a percentage of the number of training samples for the LPD calculation or a whole number larger than 1 and smaller than the number of training samples. CAUTION! If not all training samples are considered, a fitted relationship between LPD and error metric will not make sense (@seealso \code{\link{DItoErrormetric}})
#' @details The Dissimilarity Index (DI), the Local Data Point Density (LPD) and the corresponding Area of Applicability (AOA) are calculated.
#' If variables are factors, dummy variables are created prior to weighting and distance calculation.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ plot.errorModelDI <- function(x, ...){

#' @name plot
#' @description Plot the LPD and errormetric from Cross-Validation with the modelled relationship
#' @param x errorModelLPD, see \code{\link{LPDtoErrormetric}}
#' @param x errorModelLPD, see \code{\link{DItoErrormetric}}
#' @param ... other params
#' @export
#' @return a ggplot
Expand Down
3 changes: 2 additions & 1 deletion inst/examples/ex_DItoErrormetric.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
plot(expected_error_DI)

# mask AOA based on new threshold from multiCV
mask_aoa = terra::mask(expected_error_DI, AOA$DI > attr(errormodel_DI, 'AOA_threshold'), maskvalues = 1)
mask_aoa = terra::mask(expected_error_DI, AOA$DI > attr(errormodel_DI, 'AOA_threshold'),
maskvalues = 1)
plot(mask_aoa)


Expand Down
3 changes: 2 additions & 1 deletion man/DItoErrormetric.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/aoa.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions man/get_preds_all.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8478288

Please sign in to comment.