diff --git a/DESCRIPTION b/DESCRIPTION index 58e8759..7c975a9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -56,6 +56,7 @@ LazyData: true RoxygenNote: 5.0.1 Collate: 'class-crossValidation.R' + 'class-twdtwAccuracy.R' 'class-twdtwTimeSeries.R' 'class-twdtwMatches.R' 'class-twdtwRaster.R' @@ -86,6 +87,8 @@ Collate: 'subset.R' 'twdtw.R' 'twdtwApply.R' + 'twdtwAssessment.R' 'twdtwClassify.R' + 'twdtwCrossValidation.R' 'zzz.R' VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index 8d21d36..3272e0d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -60,6 +60,7 @@ exportMethods(show) exportMethods(subset) exportMethods(summary) exportMethods(twdtwApply) +exportMethods(twdtwAssessment) exportMethods(twdtwClassify) exportMethods(twdtwCrossValidation) exportMethods(twdtwMatches) diff --git a/R/class-crossValidation.R b/R/class-crossValidation.R index aacdb81..ba9aaf2 100644 --- a/R/class-crossValidation.R +++ b/R/class-crossValidation.R @@ -80,87 +80,3 @@ setMethod("initialize", } ) -setGeneric("twdtwCrossValidation", - def = function(object, ...) standardGeneric("twdtwCrossValidation") -) - -#' @inheritParams twdtwCrossValidation-class -#' @aliases twdtwCrossValidation-create -#' -#' @describeIn twdtwCrossValidation Splits the set of time -#' series into training and validation. The function uses stratified -#' sampling and a simple random sampling for each stratum. For each data partition -#' this function performs a TWDTW analysis and returns the Overall Accuracy, -#' User's Accuracy, Produce's Accuracy, error matrix (confusion matrix), and a -#' \code{\link[base]{data.frame}} with the classification (Predicted), the -#' reference classes (Reference), and some TWDTW information. -#' -#' @examples -#' \dontrun{ -#' # Data folder -#' data_folder = system.file("lucc_MT/data", package = "dtwSat") -#' -#' # Read dates -#' dates = scan(paste(data_folder,"timeline", sep = "/"), what = "dates") -#' -#' # Read raster time series -#' evi = brick(paste(data_folder,"evi.tif", sep = "/")) -#' raster_timeseries = twdtwRaster(evi, timeline = dates) -#' -#' # Read field samples -#' field_samples = read.csv(paste(data_folder,"samples.csv", sep = "/")) -#' table(field_samples[["label"]]) -#' -#' # Read field samples projection -#' proj_str = scan(paste(data_folder,"samples_projection", sep = "/"), -#' what = "character") -#' -#' # Get sample time series from raster time series -#' field_samples_ts = getTimeSeries(raster_timeseries, -#' y = field_samples, proj4string = proj_str) -#' field_samples_ts -#' -#' # Run cross validation -#' set.seed(1) -#' # Define TWDTW weight function -#' log_fun = logisticWeight(alpha=-0.1, beta=50) -#' cross_validation = twdtwCrossValidation(field_samples_ts, times=3, p=0.1, -#' freq = 8, formula = y ~ s(x, bs="cc"), weight.fun = log_fun) -#' cross_validation -#' -#' summary(cross_validation) -#' -#' } -#' @export -setMethod(f = "twdtwCrossValidation", - definition = function(object, times, p, ...) twdtwCrossValidation.twdtwTimeSeries(object, times, p, ...)) - -twdtwCrossValidation.twdtwTimeSeries = function(object, times, p, ...){ - - partitions = createDataPartition(y = labels(object), times, p, list = TRUE) - - res = lapply(partitions, function(I){ - training_ts = subset(object, I) - validation_ts = subset(object, -I) - patt = createPatterns(training_ts, ...) - twdtw_res = twdtwApply(x = validation_ts, y = patt, n=1, ...) - df = do.call("rbind", lapply(twdtw_res[], function(xx) xx[which.min(xx$distance),]) ) - ref = labels(twdtw_res)$timeseries - pred = df$label - data = data.frame(.adjustFactores(ref, pred, levels=NULL, labels=NULL), df[,!names(df)%in%"labels"]) - error.matrix = table(Predicted=data$Predicted, Reference=data$Reference) - UA = diag(error.matrix) / rowSums(error.matrix) - PA = diag(error.matrix) / colSums(error.matrix) - O = sum(diag(error.matrix)) / sum(rowSums(error.matrix)) - list(OverallAccuracy=O, UsersAccuracy=UA, ProducersAccuracy=PA, ErrorMatrix=error.matrix, data=data) - }) - - new("twdtwCrossValidation", partitions=partitions, accuracy=res) - -} - - - - - - diff --git a/R/class-twdtwAccuracy.R b/R/class-twdtwAccuracy.R new file mode 100644 index 0000000..e779122 --- /dev/null +++ b/R/class-twdtwAccuracy.R @@ -0,0 +1,87 @@ +############################################################### +# # +# (c) Victor Maus # +# Institute for Geoinformatics (IFGI) # +# University of Muenster (WWU), Germany # +# # +# Earth System Science Center (CCST) # +# National Institute for Space Research (INPE), Brazil # +# # +# # +# R Package dtwSat - 2017-01-18 # +# # +############################################################### + + +#' @title class "twdtwAssessment" +#' @name twdtwAssessment-class +#' @aliases twdtwAssessment +#' @author Victor Maus, \email{vwmaus1@@gmail.com} +#' +#' @description This class stores the map assessment. +#' +#' @param object an object of class \code{\link[dtwSat]{twdtwRaster}} resulting from +#' the classification, i.e. \code{\link[dtwSat]{twdtwClassify}}. +#' +#' @param y a \code{\link[base]{data.frame}} whose attributes are: longitude, +#' latitude, the start ''from'' and the end ''to'' of the time interval +#' for each sample. This can also be a \code{\link[sp]{SpatialPointsDataFrame}} +#' whose attributes are the start ''from'' and the end ''to'' of the time interval. +#' If missing ''from'' and/or ''to'', they are set to the time range of the +#' \code{object}. +#' +#' @param id.labels a numeric or character with an column name from \code{y} to +#' be used as samples labels. Optional. +#' +#' @param proj4string projection string, see \code{\link[sp]{CRS-class}}. Used +#' if \code{y} is a \code{\link[base]{data.frame}}. +#' +#' @param conf.int specifies the confidence level. +#' +#' @seealso +#' \code{\link[dtwSat]{twdtwRaster-class}}, and +#' \code{\link[dtwSat]{twdtwClassify}}. +#' +#' @section Slots : +#' \describe{ +#' \item{\code{accuracy}:}{A list with the accuracy for each classified time period.} +#' \item{\code{data}:}{A \code{\link[base]{data.frame}} with reference labels, predicted labels, +#' and other TWDTW information.} +#' } +#' +#' @examples +#' \dontrun{ +#' +#' } +NULL +setClass( + Class = "twdtwAssessment", + slots = c(accuracy = "list", data = "list"), + validity = function(object){ + if(!is(object@partitions, "list")){ + stop("[twdtwTimeSeries: validation] Invalid partitions, class different from list.") + }else{} + if(!is(object@accuracy, "list")){ + stop("[twdtwTimeSeries: validation] Invalid accuracy, class different from list.") + }else{} + return(TRUE) + } +) + +setMethod("initialize", + signature = "twdtwAssessment", + definition = + function(.Object, partitions, accuracy){ + .Object@partitions = list(Resample1=NULL) + .Object@accuracy = list(OverallAccuracy=NULL, UsersAccuracy=NULL, ProducersAccuracy=NULL, + error.matrix=table(NULL), data=data.frame(NULL)) + if(!missing(partitions)) + .Object@partitions = partitions + if(!missing(accuracy)) + .Object@accuracy = accuracy + validObject(.Object) + return(.Object) + } +) + + diff --git a/R/twdtwAssessment.R b/R/twdtwAssessment.R new file mode 100644 index 0000000..26a6023 --- /dev/null +++ b/R/twdtwAssessment.R @@ -0,0 +1,215 @@ + +setGeneric("twdtwAssessment", + def = function(object, ...) standardGeneric("twdtwAssessment") +) + +#' @inheritParams twdtwAssessment-class +#' @aliases twdtwAssessment +#' +#' @describeIn twdtwAssessment this function performs an accuracy assessment +#' of the classified maps. The function returns Overall Accuracy, +#' User's Accuracy, Produce's Accuracy, and error matrix (confusion matrix) for +#' each time interval and a summary considering all classified intervals. +#' +#' @examples +#' \dontrun{ +#' +#' # Create raster time series +#' +#' evi = brick(system.file("lucc_MT/data/evi.tif", package="dtwSat")) +#' ndvi = brick(system.file("lucc_MT/data/ndvi.tif", package="dtwSat")) +#' red = brick(system.file("lucc_MT/data/red.tif", package="dtwSat")) +#' blue = brick(system.file("lucc_MT/data/blue.tif", package="dtwSat")) +#' nir = brick(system.file("lucc_MT/data/nir.tif", package="dtwSat")) +#' mir = brick(system.file("lucc_MT/data/mir.tif", package="dtwSat")) +#' doy = brick(system.file("lucc_MT/data/doy.tif", package="dtwSat")) +#' timeline = scan(system.file("lucc_MT/data/timeline", package="dtwSat"), what="date") +#' +#' rts = twdtwRaster(evi, ndvi, red, blue, nir, mir, timeline = timeline, doy = doy) +#' field_samples = read.csv(system.file("lucc_MT/data/samples.csv", package="dtwSat")) +#' proj_str = scan(system.file("lucc_MT/data/samples_projection", +#' package="dtwSat"), what = "character") +#' field_samples_ts = getTimeSeries(rts, y = field_samples, proj4string = proj_str) +#' temporal_patterns = createPatterns(field_samples_ts, freq = 8, formula = y ~ s(x)) +#' log_fun = weight.fun=logisticWeight(-0.1,50) +#' +#' # Run TWDTW analysis for raster time series +#' +#' r_twdtw = twdtwApply(x=rts, y=temporal_patterns, weight.fun=log_fun, format="GTiff", +#' overwrite=TRUE, chunk.size=1000) +#' +#' r_lucc = twdtwClassify(r_twdtw, format="GTiff", overwrite=TRUE) +#' +#' log_fun = weight.fun=logisticWeight(-0.1,50) +#' time_interval = seq(from=as.Date("2007-09-01"), to=as.Date("2013-09-01"), +#' by="12 month") +#' r_twdtw = twdtwApply(x=rts, y=patt, weight.fun=log_fun, breaks=time_interval, +#' filepath="~/test_twdtw", overwrite=TRUE, format="GTiff") +#' +#' r_lucc = twdtwClassify(r_twdtw, format="GTiff", overwrite=TRUE) +#' +#' plotMaps(r_lucc) +#' +#' # Map assessment +#' +#' +#' +#' } +#' @export +setMethod(f = "twdtwAssessment", + definition = function(object, y, id.labels, proj4string, conf.int) + twdtwAssessment.twdtwRaster(object, y, id.labels, proj4string, conf.int)) + +twdtwAssessment.twdtwRaster = function(object, y, id.labels, proj4string, conf.int){ + + # Get classified raster + x = object@timeseries$Class + + # Get time intervals + timeline = index(object) + timeline = c(timeline[1] - diff(timeline[1:2]) - 1, timeline) + r_intervals = data.frame(from=timeline[-length(timeline)], to=timeline[-1]) + + # Get land use/cover classes + rnames = labels(object) + rlevels = levels(object) + + # Compute area of each class by classification interval + a_by_interval = lapply(1:nlayers(x), FUN = .area_by_class, x, rlevels, rnames) + + # Compute total area by class + area_by_class = do.call("rbind", a_by_interval) + area_by_class = colSums(area_by_class) + + # Get classified and predicted land cover/use classes for each control point + pred_classes = extract(x, y) + samples_by_year = lapply(1:nrow(r_intervals), FUN = .get_pre_ref_classes, r_intervals, pred_classes, y, rlevels, rnames) + samples_all = do.call("rbind", samples_by_year) + + # Compute error matrix + error_matrix_by_year = lapply(samples_by_year, table) + error_matrix_summary = table(samples_all) + + # Compute accuracy assessment + accuracy_by_year = lapply(seq_along(error_matrix_by_year), function(i) .twdtwAssessment(x = error_matrix_by_year[[i]], a_by_interval[[i]], conf.int)) + accuracy_summary = .twdtwAssessment(error_matrix_summary, area_by_class, conf.int=1.96) + + # new("twdtwCrossValidation", partitions=partitions, accuracy=res) + + list(accuracy_summary, accuracy_by_year) + +} + +.get_pre_ref_classes = function(i, r_intervals, pred, y, rlevels, rnames){ + I = which((r_intervals$to[i] - as.Date(y$from) > 30) & (as.Date(y$to) - r_intervals$from[i] > 30) ) + if(length(I)<1) + return(NULL) + J = match(pred[I,i], rlevels) + Predicted = factor(as.character(rnames[J]), levels = rnames, labels = rnames) + Reference = factor(as.character(y$label[I]), levels = rnames, labels = rnames) + data.frame(Predicted, Reference) +} + +.area_by_class = function(l, r, rlevels, rnames){ + r = raster(r, layer = l) + a = zonal(r, r, 'count') + I = match(a[,'zone'], rlevels) + out = rep(0, length(rnames)) + names(out) = rnames + out[I] = a[,'count'] * prod(res(r)) + names(out) = rnames + out +} + +.twdtwAssessment = function(x, area, conf.int){ + + cnames = names(area) + # cnames = paste0("aux_classname_",seq_along(cnames)) + x = data.frame(cbind(x), row.names = cnames) + # names(x) = cnames + cnames = names(x) + rownames(x) = cnames + names(area) = cnames + + total_map = rowSums(x) + total_ref = colSums(x) + total_area = sum(area) + total_samples = sum(total_ref) + + # Weight + w = area / total_area + + # Error matrix + + error_matrix = data.frame(cbind(x, Total=total_map, A=area, w=w)) + error_matrix["Total",] = colSums(error_matrix) + + # Proportions + y = t(apply(error_matrix[!rownames(error_matrix)%in%"Total",], 1, function(x) (x[cnames] / x["Total"]) * x["w"])) + y[total_map==0,] = 0 + total_prop_map = rowSums(y, na.rm = TRUE) + total_prop_ref = colSums(y, na.rm = TRUE) + + # Proportions matrix + prop_matrix = data.frame(y, Total = total_prop_map, A = area, w = w) + prop_matrix["Total",] = colSums(prop_matrix, na.rm = TRUE) + + # Accuracy + UA = as.numeric(diag(as.matrix(prop_matrix[cnames,cnames])) / prop_matrix[cnames,"Total"]) + UA[total_map==0] = 1 + names(UA) = cnames + + PA = as.numeric(diag(as.matrix(prop_matrix[cnames,cnames])) / prop_matrix["Total",cnames]) + PA[total_ref==0] = 1 + names(PA) = cnames + OA = sum(diag(as.matrix(prop_matrix[cnames,cnames])), na.rm = TRUE) + + #a_pixel = as.numeric(prop_matrix["Total",cnames] * prop_matrix["Total","A"]) + #names(a_pixel) = cnames + #a_ha = a_pixel*res^2/100^2 + conf.int = 1.96 + temp = w^2*UA*(1-UA)/(total_map-1) + + VO = sum(temp, na.rm = TRUE) + SO = sqrt(VO) + OCI = SO * conf.int + + VU = UA*(1-UA)/(total_map-1) + SU = sqrt(VU) + UCI = SU * conf.int + + fun1 = function(x, xt, A){ + sum(A*x/xt, na.rm = TRUE) + } + + fun2 = function(i, x, xt, A, PA){ + x = as.numeric(x[,i]) + x = x[-i] + xt = xt[-i] + A = A[-i] + PA = PA[i] + PA^2*sum(A^2*x/xt*(1-x/xt)/(xt-1), na.rm = TRUE) + } + + Nj = apply(x, 2, fun1, total_map, area) + expr1 = area^2*(1-PA)^2*UA*(1-UA)/(total_map-1) + expr2 = sapply(1:nrow(x), fun2, x=x, xt=total_map, A=area, PA=PA) + # VP = (1/Nj^2)*(expr1+expr2) + VP = (1/sapply(Nj, function(x) ifelse(x==0, 1, x))^2)*(expr1+expr2) + SP = sapply(VP, function(x) ifelse(x==0, 0, sqrt(x))) + PCI = SP * 1.96 + + res = list(OverallAccuracy = c(Accuracy=OA, Var=VO, sd=SO, ci95=OCI), + UsersAccuracy = cbind(Accuracy=UA, Var=VU, sd=SU, ci95=UCI), + ProducersAccuracy = cbind(Accuracy=PA, Var=VP, sd=SP, ci95=PCI), + ErrorMatrix = error_matrix + ) + + res + +} + + + + + diff --git a/R/twdtwCrossValidation.R b/R/twdtwCrossValidation.R new file mode 100644 index 0000000..51baa61 --- /dev/null +++ b/R/twdtwCrossValidation.R @@ -0,0 +1,85 @@ + +setGeneric("twdtwCrossValidation", + def = function(object, ...) standardGeneric("twdtwCrossValidation") +) + +#' @inheritParams twdtwCrossValidation-class +#' @aliases twdtwCrossValidation +#' +#' @describeIn twdtwCrossValidation Splits the set of time +#' series into training and validation. The function uses stratified +#' sampling and a simple random sampling for each stratum. For each data partition +#' this function performs a TWDTW analysis and returns the Overall Accuracy, +#' User's Accuracy, Produce's Accuracy, error matrix (confusion matrix), and a +#' \code{\link[base]{data.frame}} with the classification (Predicted), the +#' reference classes (Reference), and some TWDTW information. +#' +#' @examples +#' \dontrun{ +#' # Data folder +#' data_folder = system.file("lucc_MT/data", package = "dtwSat") +#' +#' # Read dates +#' dates = scan(paste(data_folder,"timeline", sep = "/"), what = "dates") +#' +#' # Read raster time series +#' evi = brick(paste(data_folder,"evi.tif", sep = "/")) +#' raster_timeseries = twdtwRaster(evi, timeline = dates) +#' +#' # Read field samples +#' field_samples = read.csv(paste(data_folder,"samples.csv", sep = "/")) +#' table(field_samples[["label"]]) +#' +#' # Read field samples projection +#' proj_str = scan(paste(data_folder,"samples_projection", sep = "/"), +#' what = "character") +#' +#' # Get sample time series from raster time series +#' field_samples_ts = getTimeSeries(raster_timeseries, +#' y = field_samples, proj4string = proj_str) +#' field_samples_ts +#' +#' # Run cross validation +#' set.seed(1) +#' # Define TWDTW weight function +#' log_fun = logisticWeight(alpha=-0.1, beta=50) +#' cross_validation = twdtwCrossValidation(field_samples_ts, times=3, p=0.1, +#' freq = 8, formula = y ~ s(x, bs="cc"), weight.fun = log_fun) +#' cross_validation +#' +#' summary(cross_validation) +#' +#' } +#' @export +setMethod(f = "twdtwCrossValidation", + definition = function(object, times, p, ...) twdtwCrossValidation.twdtwTimeSeries(object, times, p, ...)) + +twdtwCrossValidation.twdtwTimeSeries = function(object, times, p, ...){ + + partitions = createDataPartition(y = labels(object), times, p, list = TRUE) + + res = lapply(partitions, function(I){ + training_ts = subset(object, I) + validation_ts = subset(object, -I) + patt = createPatterns(training_ts, ...) + twdtw_res = twdtwApply(x = validation_ts, y = patt, n=1, ...) + df = do.call("rbind", lapply(twdtw_res[], function(xx) xx[which.min(xx$distance),]) ) + ref = labels(twdtw_res)$timeseries + pred = df$label + data = data.frame(.adjustFactores(ref, pred, levels=NULL, labels=NULL), df[,!names(df)%in%"labels"]) + error.matrix = table(Predicted=data$Predicted, Reference=data$Reference) + UA = diag(error.matrix) / rowSums(error.matrix) + PA = diag(error.matrix) / colSums(error.matrix) + O = sum(diag(error.matrix)) / sum(rowSums(error.matrix)) + list(OverallAccuracy=O, UsersAccuracy=UA, ProducersAccuracy=PA, ErrorMatrix=error.matrix, data=data) + }) + + new("twdtwCrossValidation", partitions=partitions, accuracy=res) + +} + + + + + + diff --git a/man/twdtwAssessment-class.Rd b/man/twdtwAssessment-class.Rd new file mode 100644 index 0000000..7ec06a6 --- /dev/null +++ b/man/twdtwAssessment-class.Rd @@ -0,0 +1,104 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/class-twdtwAccuracy.R, R/twdtwAssessment.R +\docType{methods} +\name{twdtwAssessment-class} +\alias{twdtwAssessment} +\alias{twdtwAssessment,ANY-method} +\alias{twdtwAssessment-class} +\title{class "twdtwAssessment"} +\usage{ +\S4method{twdtwAssessment}{ANY}(object, y, id.labels, proj4string, conf.int) +} +\arguments{ +\item{object}{an object of class \code{\link[dtwSat]{twdtwRaster}} resulting from +the classification, i.e. \code{\link[dtwSat]{twdtwClassify}}.} + +\item{y}{a \code{\link[base]{data.frame}} whose attributes are: longitude, +latitude, the start ''from'' and the end ''to'' of the time interval +for each sample. This can also be a \code{\link[sp]{SpatialPointsDataFrame}} +whose attributes are the start ''from'' and the end ''to'' of the time interval. +If missing ''from'' and/or ''to'', they are set to the time range of the +\code{object}.} + +\item{id.labels}{a numeric or character with an column name from \code{y} to +be used as samples labels. Optional.} + +\item{proj4string}{projection string, see \code{\link[sp]{CRS-class}}. Used +if \code{y} is a \code{\link[base]{data.frame}}.} + +\item{conf.int}{specifies the confidence level.} +} +\description{ +This class stores the map assessment. +} +\section{Methods (by generic)}{ +\itemize{ +\item \code{twdtwAssessment}: this function performs an accuracy assessment +of the classified maps. The function returns Overall Accuracy, +User's Accuracy, Produce's Accuracy, and error matrix (confusion matrix) for +each time interval and a summary considering all classified intervals. +}} +\section{Slots }{ + +\describe{ + \item{\code{accuracy}:}{A list with the accuracy for each classified time period.} + \item{\code{data}:}{A \code{\link[base]{data.frame}} with reference labels, predicted labels, + and other TWDTW information.} +} +} +\examples{ +\dontrun{ + +} +\dontrun{ + +# Create raster time series + +evi = brick(system.file("lucc_MT/data/evi.tif", package="dtwSat")) +ndvi = brick(system.file("lucc_MT/data/ndvi.tif", package="dtwSat")) +red = brick(system.file("lucc_MT/data/red.tif", package="dtwSat")) +blue = brick(system.file("lucc_MT/data/blue.tif", package="dtwSat")) +nir = brick(system.file("lucc_MT/data/nir.tif", package="dtwSat")) +mir = brick(system.file("lucc_MT/data/mir.tif", package="dtwSat")) +doy = brick(system.file("lucc_MT/data/doy.tif", package="dtwSat")) +timeline = scan(system.file("lucc_MT/data/timeline", package="dtwSat"), what="date") + +rts = twdtwRaster(evi, ndvi, red, blue, nir, mir, timeline = timeline, doy = doy) +field_samples = read.csv(system.file("lucc_MT/data/samples.csv", package="dtwSat")) +proj_str = scan(system.file("lucc_MT/data/samples_projection", + package="dtwSat"), what = "character") +field_samples_ts = getTimeSeries(rts, y = field_samples, proj4string = proj_str) +temporal_patterns = createPatterns(field_samples_ts, freq = 8, formula = y ~ s(x)) +log_fun = weight.fun=logisticWeight(-0.1,50) + +# Run TWDTW analysis for raster time series + +r_twdtw = twdtwApply(x=rts, y=temporal_patterns, weight.fun=log_fun, format="GTiff", + overwrite=TRUE, chunk.size=1000) + +r_lucc = twdtwClassify(r_twdtw, format="GTiff", overwrite=TRUE) + +log_fun = weight.fun=logisticWeight(-0.1,50) +time_interval = seq(from=as.Date("2007-09-01"), to=as.Date("2013-09-01"), + by="12 month") +r_twdtw = twdtwApply(x=rts, y=patt, weight.fun=log_fun, breaks=time_interval, + filepath="~/test_twdtw", overwrite=TRUE, format="GTiff") + +r_lucc = twdtwClassify(r_twdtw, format="GTiff", overwrite=TRUE) + +plotMaps(r_lucc) + +# Map assessment + + + +} +} +\author{ +Victor Maus, \email{vwmaus1@gmail.com} +} +\seealso{ +\code{\link[dtwSat]{twdtwRaster-class}}, and +\code{\link[dtwSat]{twdtwClassify}}. +} + diff --git a/man/twdtwCrossValidation-class.Rd b/man/twdtwCrossValidation-class.Rd index 62aff18..8ea19e0 100644 --- a/man/twdtwCrossValidation-class.Rd +++ b/man/twdtwCrossValidation-class.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/class-crossValidation.R, R/methods.R +% Please edit documentation in R/class-crossValidation.R, R/methods.R, R/twdtwCrossValidation.R \docType{methods} \name{twdtwCrossValidation-class} \alias{show,twdtwCrossValidation-method} @@ -7,28 +7,27 @@ \alias{twdtwCrossValidation} \alias{twdtwCrossValidation,ANY-method} \alias{twdtwCrossValidation-class} -\alias{twdtwCrossValidation-create} \title{class "twdtwCrossValidation"} \usage{ -\S4method{twdtwCrossValidation}{ANY}(object, times, p, ...) - \S4method{show}{twdtwCrossValidation}(object) \S4method{summary}{twdtwCrossValidation}(object, conf.int = 0.95, ...) + +\S4method{twdtwCrossValidation}{ANY}(object, times, p, ...) } \arguments{ \item{object}{an object of class \code{\link[dtwSat]{twdtwTimeSeries}}.} -\item{times}{Number of partitions to create.} - -\item{p}{the percentage of data that goes to training. -See \code{\link[caret]{createDataPartition}} for details.} +\item{conf.int}{specifies the confidence level (0-1) for interval estimation of the +population mean. For more details see \code{\link[ggplot2]{mean_cl_boot}}.} \item{...}{Other arguments to be passed to \code{\link[dtwSat]{createPatterns}} and to \code{\link[dtwSat]{twdtwApply}}.} -\item{conf.int}{specifies the confidence level (0-1) for interval estimation of the -population mean. For more details see \code{\link[ggplot2]{mean_cl_boot}}.} +\item{times}{Number of partitions to create.} + +\item{p}{the percentage of data that goes to training. +See \code{\link[caret]{createDataPartition}} for details.} } \description{ This class stores the cross-validation.