Similar to other predict methods, this function predicts fitted values from a fitted "HGBTRegressor" object.

# S3 method for HGBTRegressor
predict(
  model,
  data,
  key,
  features = NULL,
  thread.ratio = NULL,
  missing.replacement = NULL,
  ...
)

Format

S3 methods

Arguments

model

R6Class object
An "HGBTRegressor" object for prediction.

data

DataFrame
DataFrame containting the data.

key

character
Name of the ID column.

features

character of list of characters, optional
Name of feature columns for prediction.
If not provided, it defaults to all non-key columns of data.

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 the range from 0 to 1 are ignored, and the actual number of threads used is then be heuristically determined.
Defaults to -1.

missing.replacement

character, optional
The missing replacement strategy:

  • "feature.marginalized"- marginalise each missing feature out independently.

  • "instance.marginalized" marginalise all missing features in an instance as a whole corr

...

Reserved parameter.

Value

DataFrame
DataFrame containing the prediction result, structured as follows:

  • ID, INTEGER - ID column, with the same name and type as df's ID column

  • SCORE, NVARCHAR - representing the predicted values.

  • CONFIDENCE, DOUBLE - representing the confidence of a class label assignment.

Examples

Input DataFrame df:


 > df.predict$Collect()
    ID   ATT1     ATT2    ATT3    ATT4
 1   1  19.76   6235.0  100.00  100.00
 2   2  17.85  46230.0   43.67   84.53
 3   3  19.96   7360.0   65.51   81.57
 4   4  16.80  28715.0   45.16   93.33
 5   5  18.20  21934.0   49.20   83.07
 6   6  16.71   1337.0   74.84   94.99
 7   7  18.81  17881.0   70.66   92.34
 8   8  20.74   2319.0   63.93   95.08
 9   9  16.56  18040.0   14.45   61.24
 10 10  18.55   1147.0   68.58   97.90

Call the function and predict with a "HGBTRegressor" object hgr:


 > result <- predict(hgr, df.predict, key = "ID")
 > result$Collect()
    ID               SCORE   CONFIDENCE
 1   1   23.79109147050638           NA
 2   2   19.09572889593064           NA
 3   3   21.56501359501561           NA
 4   4  18.622664075787082           NA
 5   5   19.05159916592106           NA
 6   6  18.815530665858763           NA
 7   7  19.761714911364443           NA
 8   8   23.79109147050638           NA
 9   9   17.84416828725911           NA
 10 10  19.915574945518465           NA