Skip to content

Commit

Permalink
more prep for CRAN submission
Browse files Browse the repository at this point in the history
  • Loading branch information
goodekat committed Jan 15, 2025
1 parent 3e34fdf commit 25e9254
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 29 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Description: Implements the VEESA pipeline for explainable machine learning
inputs to elastic shape analysis principal components that account for
vertial and/or horizontal variability. Computes feature importance to
identify important principal components and visualizes variability captured
by functional principal components. See Goode et al (2025) arXiv
by functional principal components. See Goode et al (2025) <arXiv:2501.07602>
for technical details about the methodology.
License: MIT + file LICENSE
Encoding: UTF-8
Expand Down
4 changes: 2 additions & 2 deletions R/compute_pfi.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#' select(data, group, id) |>
#' distinct() |>
#' group_by(data, group) |>
#' slice(1:5) |>
#' slice(1:4) |>
#' ungroup()
#'
#' # Create a smaller version of shifted data
Expand Down Expand Up @@ -95,7 +95,7 @@
#' x = model_data |> select(-group),
#' y = model_data$group,
#' f = rf,
#' K = 5,
#' K = 1,
#' metric = "accuracy"
#' )

Expand Down
2 changes: 1 addition & 1 deletion R/prep_training_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
#' select(data, group, id) |>
#' distinct() |>
#' group_by(data, group) |>
#' slice(1:5) |>
#' slice(1:3) |>
#' ungroup()
#'
#' # Create a smaller version of shifted data
Expand Down
15 changes: 6 additions & 9 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,18 @@ always_allow_html: yes
knitr::opts_chunk$set(echo = TRUE, message = FALSE, dpi = 300)
```

`veesa` is an R package for implementing the VEESA pipeline for an explainable approach to training machine learning models with functional data inputs. (Paper appearing on arXiv soon!) The approach makes use of the [elastic shape analysis (ESA) framework](https://doi.org/10.1016/j.csda.2012.12.001) for functional data.

We hope to have `veesa` available on CRAN soon! For now, install `veesa` from GitHub using the commands below.
`veesa` is an R package for implementing the VEESA pipeline for an explainable approach to training machine learning models with functional data inputs. See a preprint manuscript describing the approach on [arXiv](https://arxiv.org/abs/2501.07602). We hope to have `veesa` available on CRAN soon! For now, install `veesa` from GitHub using the commands below.

```{r}
#| eval: false
remotes::install_github("sandialabs/veesa")
```

Keep reading for an example training a random forest model using `veesa` with simulated functional data.
Keep reading for an example using `veesa` to implement the VEESA pipeline.

## Demonstration

### Set Up and Data Generation
#### Set Up and Data Generation

```{r}
#| message: false
Expand Down Expand Up @@ -109,7 +107,7 @@ Create a vector of times:
times = sim_data$t %>% unique()
```

### Alignment and fPCA
#### Alignment and fPCA

Prepare train data

Expand Down Expand Up @@ -196,7 +194,7 @@ bind_rows(train_plot_df_jfpca, test_plot_df_jfpca) %>%
theme_bw()
```

### Models
#### Models

Create response variable:

Expand Down Expand Up @@ -226,7 +224,7 @@ set.seed(20211130)
rf_jfpca = randomForest(x1 ~ ., data = rf_jfpca_df)
```

### PFI
#### PFI

Compute PFI:

Expand Down Expand Up @@ -305,7 +303,6 @@ Principal directions of top PC for each jfPCA method:
#| out-width: "60%"
#| fig-align: "center"
#| echo: false
plot_pc_directions(
fpcs = top_pc_jfpca,
fdasrvf = train_transformed_jfpca$fpca_res,
Expand Down
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,21 @@ coverage](https://codecov.io/gh/sandialabs/veesa/graph/badge.svg)](https://app.c

`veesa` is an R package for implementing the VEESA pipeline for an
explainable approach to training machine learning models with functional
data inputs. (Paper appearing on arXiv soon!) The approach makes use of
the [elastic shape analysis (ESA)
framework](https://doi.org/10.1016/j.csda.2012.12.001) for functional
data.

We hope to have `veesa` available on CRAN soon! For now, install `veesa`
from GitHub using the commands below.
data inputs. See a preprint manuscript describing the approach on
[arXiv](https://arxiv.org/abs/2501.07602). We hope to have `veesa`
available on CRAN soon! For now, install `veesa` from GitHub using the
commands below.

``` r
remotes::install_github("sandialabs/veesa")
```

Keep reading for an example training a random forest model using `veesa`
with simulated functional data.
Keep reading for an example using `veesa` to implement the VEESA
pipeline.

## Demonstration

### Set Up and Data Generation
#### Set Up and Data Generation

``` r
# Load R packages
Expand Down Expand Up @@ -95,7 +92,7 @@ Create a vector of times:
times = sim_data$t %>% unique()
```

### Alignment and fPCA
#### Alignment and fPCA

Prepare train data

Expand Down Expand Up @@ -129,7 +126,7 @@ Compare jfPCA coefficients from train and test data:

<img src="README_files/figure-gfm/unnamed-chunk-11-1.png" width="75%" style="display: block; margin: auto;" />

### Models
#### Models

Create response variable:

Expand Down Expand Up @@ -159,7 +156,7 @@ set.seed(20211130)
rf_jfpca = randomForest(x1 ~ ., data = rf_jfpca_df)
```

### PFI
#### PFI

Compute PFI:

Expand Down
Binary file modified README_files/figure-gfm/unnamed-chunk-10-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified README_files/figure-gfm/unnamed-chunk-11-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified README_files/figure-gfm/unnamed-chunk-16-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified README_files/figure-gfm/unnamed-chunk-17-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified README_files/figure-gfm/unnamed-chunk-19-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified README_files/figure-gfm/unnamed-chunk-5-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions man/compute_pfi.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/prep_training_data.Rd

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

0 comments on commit 25e9254

Please sign in to comment.