s2Data {s2net} | R Documentation |
Data wrapper for s2net
.
Description
This function preprocess the data to fit a semi-supervised linear joint trained model.
Usage
s2Data(xL, yL, xU = NULL, preprocess = T)
Arguments
xL |
The labeled data. Could be a |
yL |
The labels associated with |
xU |
The unlabeled data (optional). Could be a |
preprocess |
Should the input data be pre-processed? Possible values are:
Another object of class |
Value
Returns an object of S3 class s2Data
with fields
xL |
Transformed labeled data |
yL |
Transformed labels. If |
xU |
Tranformed unlabeled data |
type |
Type of task. This one is inferred from the response labels. |
base |
Base category for classification |
In addition the following attributes are stored.
pr:rm_cols |
logical vector of removed columns |
pr:center |
column center |
pr:scale |
column scale |
pr:ycenter |
yL center. Regression |
pr:yscale |
yL scale. Regression |
Author(s)
Juan C. Laria
See Also
Examples
data("auto_mpg")
train = s2Data( xL = auto_mpg$P1$xL,
yL = auto_mpg$P1$yL,
xU = auto_mpg$P1$xU,
preprocess = TRUE )
show(train)
# Notice how ordered factor variable $cylinders is handled
# .L (linear) .Q (quadratic) .C (cubic) and .^4
head(train$xL)
#if you want to do validation with the unlabeled data
idx = sample(length(auto_mpg$P1$yU), 200)
train = s2Data(xL = auto_mpg$P1$xL, yL = auto_mpg$P1$yL, xU = auto_mpg$P1$xU[idx, ])
valid = s2Data(xL = auto_mpg$P1$xU[-idx, ], yL = auto_mpg$P1$yU[-idx], preprocess = train)
test = s2Data(xL = auto_mpg$P1$xU[idx, ], yL = auto_mpg$P1$yU[idx], preprocess = train)
train
valid
test