Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ S3method(summary,warped_model)
S3method(unwarp,data.frame)
S3method(unwarp,formula)
S3method(unwarp,warped_df)
S3method(warp,"function")
S3method(warp,data.frame)
S3method(warp,formula)
S3method(warp,warped_df)
Expand All @@ -26,6 +25,7 @@ export(strucpca_warper)
export(unwarp)
export(warp)
export(warp_fitted_model)
export(warp_function)
importFrom(MASS,lda)
importFrom(magrittr,"%>%")
importFrom(purrr,flatten)
Expand Down
21 changes: 5 additions & 16 deletions R/warp-unwarp.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,19 @@
#' representation of the data, if a [pca_warper] is used.
#'
#' @param x The object to be transformed, normally a data frame.
#' @param ... Additional arguments to be passed to the `warp` method.
#' @param warper A `warper` object as, for example, created by [pca_warper()] for principal components transformations.
#' @param ... Additional arguments to be passed to the \code{warp} method.
#' @describeIn warp.data.frame Does nothing - `warped_df` has already been transformed
#' @return A data frame with features in the transformed (e.g., PCA) space.
#' @seealso [unwarp()] for the inverse transformation, and
#' [pca_warper()] for an example of a simple warper function based
#' on the principal component transformation.
#' @export
warp <- function(x, ...) {
UseMethod("warp", x)
UseMethod("warp")
}

#' Transform data from feature space into a transformed space
#'
#' `warp` methods apply the transformation \eqn{T} to data
#' in feature space - the result is, for example, the principal components
#' representation of the data, if a [pca_warper] is used.
#'
#' @param x The object to be transformed, normally a data frame.
#' @param warper A `warper` object as, for example, created by [pca_warper()] for principal components transformations.
#' @param ... Additional arguments to be passed to the \code{warp} method.
#' @return A data frame with features in the transformed (e.g., PCA) space.
#' @seealso [unwarp()] for the inverse transformation, and
#' [pca_warper()] for an example of a simple warper function based
#' on the principal component transformation.
#' @export
warp.data.frame <- function(x, warper, ...) {
chkDots(...)
Expand All @@ -36,7 +26,6 @@ warp.data.frame <- function(x, warper, ...) {
x
}

#' @describeIn warp.data.frame Does nothing - `warped_df` has already been transformed
#' @export
warp.warped_df <- function(x, warper, ...) {
chkDots(...)
Expand Down Expand Up @@ -118,7 +107,7 @@ unwarp.data.frame <- function(x, warper = NULL, force_unwarp = FALSE, ...) {
#' what happens with `sperrorest`.
#'
#' @export
warp.function <- function (x, warper, ...)
warp_function <- function(x, warper, ...)
{
function(formula, data, ...) {
data <- unwarp(data, warper = warper)
Expand Down
32 changes: 32 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,35 @@ url: https://alexanderbrenning.github.io/wiml
template:
bootstrap: 5

authors:
Alexander Brenning:
href: https://geods.netlify.app/

reference:
- title: Warp
description: Transform data from feature space into a transformed space
contents:
- starts_with("warp")
- ends_with("warp")
- contains("warped")
- title: Unwarp
description: Backtransform from transformed ('warped') to original feature space
contents:
- contains("unwarp")
- title: Inbound/Outbound
contents:
- starts_with("inbound")
- starts_with("outbound")
- title: Principal components transformation of feature space
contents:
- contains("pca")
- title: Partial least squares transformation of feature space
contents:
- contains("pls")
- title: Datasets
contents:
- gabor
- maipofields
- title: Package metadata
contents:
- wiml
26 changes: 0 additions & 26 deletions man/warp.Rd

This file was deleted.

16 changes: 8 additions & 8 deletions man/warp.data.frame.Rd

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

6 changes: 3 additions & 3 deletions man/warp.function.Rd → man/warp_function.Rd

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

6 changes: 2 additions & 4 deletions vignettes/gabor_rf.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ subtitle: "A Remote-Sensing Case Study Using the Random Forest Classifier"
author: Alexander Brenning
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{"The wiml Package: Transforming Feature Space to Interpret Machine Learning Models"}
%\VignetteIndexEntry{The `wiml` Package: Transforming Feature Space to Interpret Machine Learning Models}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
keywords:
Expand Down Expand Up @@ -268,8 +268,6 @@ As you can see, our small sample of four points actually consisted of PC data (f

This means that we're ready to fool *any* model-agnostic interpretation tool - just don't tell'em that 'wfit' is not a real model!

### Permutation variable importance

We'll start with the permutation variable importance:

```{r strucpcaimp, cache = TRUE, cach.extra = do_cache()}
Expand Down Expand Up @@ -349,7 +347,7 @@ plot(weffs_2d_pdp)



### References
## References

<div id="refs"></div>

Expand Down