PreProcessing: Preprocess the input to a classification function

View source: R/HelperFunctions.R

PreProcessingR Documentation

Preprocess the input to a classification function

Description

The following actions are carried out: 1. data.frames are converted to matrix form and labels converted to an indicator matrix 2. An intercept column is added if requested 3. centering and scaling is applied if requested.

Usage

PreProcessing(X, y, X_u = NULL, scale = FALSE, intercept = FALSE,
  x_center = FALSE, use_Xu_for_scaling = TRUE)

Arguments

X

Design matrix, intercept term is added within the function

y

Vector or factor with class assignments

X_u

Design matrix of the unlabeled observations

scale

If TRUE, apply a z-transform to the design matrix X

intercept

Whether to include an intercept in the design matrices

x_center

logical (default: TRUE); Whether the feature vectors should be centered

use_Xu_for_scaling

logical (default: TRUE); Should the unlabeled data be used to determine scaling?

Value

list object with the following objects:

X

design matrix of the labeled data

y

integer vector indicating the labels of the labeled data

X_u

design matrix of the unlabeled data

classnames

names of the classes corresponding to the integers in y

scaling

a scaling object used to scale the test observations in the same way as the training set

modelform

a formula object containing the used model


RSSL documentation built on March 31, 2023, 7:27 p.m.