Similar to other transform methods, this function transforms fitted values from a fitted "Imputer" object.

# S3 method for Imputer
transform(model, data, key = NULL, thread.ratio = NULL)

Arguments

model

R6Class object
An "Imputer" object for transformation.

data

DataFrame
DataFrame containting the data.

key

character, optional
Name of the ID column. If not provided, the data is assumed to have no ID column.
No default value.

thread.ratio

double, optional
Controls the proportion of available threads that can be used by this function.
The value range is from 0 to 1, where 0 indicates a single thread, and 1 indicates all available threads.
Values between 0 and 1 will use up to that percentage of available threads.Values outside this range are ignored.
Defaults to 0.

Value

transformed values are returned as a list of two DataFrame, structured as follows.

  • DataFrame 1:
    Result DataFrame. The same column structure (number of columns, column names, and column types) with the table with which the model is trained.

  • DataFrame 2:
    Statistics DataFrame.

Examples

Perform the transform on DataFrame data2 using "imputer" object ip:


> data2$Collect()
  ID V0   V1   V2    V3    V4    V5
1  0 20    1    B    NA   1.5  21.7
2  1 40    1 <NA>   0.6   1.2  24.3
3  2 NA    0    D    NA   1.8  22.6
4  3 50   NA    C   0.7   1.1    NA
5  4 20    1    A   0.3    NA  20.6

Call the function:


> result <- transform(ip, data2)

Output:


> result[[1]]$Collect()
  ID V0 V1 V2        V3       V4       V5
1  0 20  1  B 0.5076923 1.500000 21.70000
2  1 40  1  A 0.6000000 1.200000 24.30000
3  2 24  0  D 0.5076923 1.800000 22.60000
4  3 50  0  C 0.7000000 1.100000 20.64615
5  4 20  1  A 0.3000000 1.469231 20.60000

See also