df_to_tensor: Prepare data for tensorsem model

View source: R/prepare_data.R

df_to_tensorR Documentation

Prepare data for tensorsem model

Description

This function prepares a dataframe for a tensorsem model. It first converts the variables to a design matrix, then centers it, and lastly converts it to a torch_tensor

Usage

df_to_tensor(df, dtype = NULL, device = NULL)

Arguments

df

data frame

dtype

data type of the resulting tensor

device

device to store the resulting tensor on

Value

Torch tensor of scaled and processed data

See Also

torch::torch_tensor(), stats::model.matrix()


vankesteren/tensorsem documentation built on Aug. 22, 2023, 7:41 a.m.