Skip to contents

This function augments a dataset with predictions and error metrics obtained from a nonlinear dimension reduction (NLDR) model.

Usage

augment(
  df_bin_centroids,
  df_bin,
  training_data,
  newdata = NULL,
  type_NLDR,
  col_start = "x"
)

Arguments

df_bin_centroids

Centroid coordinates of hexagonal bins in 2D space.

df_bin

Centroid coordinates of hexagonal bins in high dimensions.

training_data

Training data used to fit the model.

newdata

Data to be augmented with predictions and error metrics. If NULL, the training data is used (default is NULL).

type_NLDR

The type of non-linear dimensionality reduction (NLDR) used.

col_start

The text that begin the column name of the high-dimensional data.

Value

A tibble containing the augmented data with predictions, error metrics, and absolute error metrics.

Examples

r2 <- diff(range(s_curve_noise_umap$UMAP2))/diff(range(s_curve_noise_umap$UMAP1))
model <- fit_highd_model(training_data = s_curve_noise_training,
emb_df = s_curve_noise_umap_scaled, bin1 = 4, r2 = r2, col_start_highd = "x")
df_bin_centroids <- model$df_bin_centroids
df_bin <- model$df_bin
augment(df_bin_centroids = df_bin_centroids, df_bin = df_bin,
training_data = s_curve_noise_training, newdata = NULL, type_NLDR = "UMAP",
col_start = "x")
#> # A tibble: 75 × 32
#>       ID      x1     x2        x3       x4       x5       x6       x7 pred_hb_id
#>    <int>   <dbl>  <dbl>     <dbl>    <dbl>    <dbl>    <dbl>    <dbl>      <int>
#>  1     1 -0.120  0.114  -1.99     -0.00246 -1.78e-2 -0.0181  -3.17e-3          9
#>  2     2 -0.0492 0.822   0.00121   0.0161   9.68e-3 -0.0834   2.30e-3         19
#>  3     3 -0.774  0.243   0.367    -0.0198   4.08e-3 -0.0349  -9.11e-3         19
#>  4     4 -0.606  1.96   -1.80      0.0132  -4.79e-4 -0.00478 -8.43e-3          5
#>  5     6  0.818  0.0388 -1.58      0.00253  1.67e-3  0.0781  -7.71e-3         10
#>  6     7  0.910  1.55    1.42      0.0124   1.60e-2 -0.00248 -8.32e-3         31
#>  7     8 -0.0691 0.978   0.00239   0.0115   3.50e-3  0.0898   3.59e-3         19
#>  8     9  0.859  1.55   -0.488    -0.00753 -1.23e-2  0.0336  -6.65e-3         14
#>  9    11 -0.0400 0.286   0.000801  0.0123   6.13e-3 -0.0121  -3.47e-4         19
#> 10    12  0.765  0.898   1.64     -0.0178   1.51e-2 -0.0710  -6.24e-3         28
#> # ℹ 65 more rows
#> # ℹ 23 more variables: model_high_d_x1 <dbl>, model_high_d_x2 <dbl>,
#> #   model_high_d_x3 <dbl>, model_high_d_x4 <dbl>, model_high_d_x5 <dbl>,
#> #   model_high_d_x6 <dbl>, model_high_d_x7 <dbl>, error_square_x1 <dbl>,
#> #   error_square_x2 <dbl>, error_square_x3 <dbl>, error_square_x4 <dbl>,
#> #   error_square_x5 <dbl>, error_square_x6 <dbl>, error_square_x7 <dbl>,
#> #   row_wise_total_error <dbl>, abs_error_x1 <dbl>, abs_error_x2 <dbl>, …