from_ped_to_tensor: Transform PED data to an array / tensor

Description Usage Arguments Value Author(s)

View source: R/preproc.R

Description

This function transforms PED data (from pammtools) to an array or tensor for further usage in tensorflow. The array is constructed from the PED so that the first dimension has same length as there are unique IDs in the PED. The second dimension reflects all distinct intervals per ID and the third dimension features all model features effectively used by the PAM(M). The third axis features the offset ([, , 1]) all linear covariates and all spline covariates in a already transformed manner using mgcv::gam for the transformation. The transformation is based on the formula argument.

Usage

1
2
3
4
5
6
7
from_ped_to_tensor(
  ped,
  formula = ped_status ~ s(tend, k = 9L, bs = "cr"),
  training = TRUE,
  training_data = NULL,
  id = "id"
)

Arguments

ped

a PED (see pammtools) data frame.

formula

a formula for a PAM(M) (see pammtools/mgcv)

training

a boolean indicating if a training or test set is to be constructed.

training_data

only relevant if training == TRUE. The training PED that has been used to fit the model is to be tested.

id

a string indicating the name of the ID variable.

Value

A list of class ped_tensor and length 2. [[1]] is the associated input (X) and [[2]] the associated target (y).

Author(s)

Philipp Kopper


pkopper/deeppam documentation built on Jan. 19, 2021, 12:39 a.m.