predict.DecisionTreeClassifier.Rd
Similar to other predict methods, this function predicts fitted values from a fitted "DecisionTreeClassifier" object.
# S3 method for DecisionTreeClassifier
predict(model, data, key, features = NULL, verbose = NULL, thread.ratio = NULL)
S3
methods
R6Class object
A "DecisionTreeClassifier" object for prediction.
DataFrame
DataFrame containting the data.
character
Name of the ID column.
character of list of characters, optional
Name of feature columns for prediction.
If not provided, it defaults to all non-key columns of data.
logical , optional
Defaults to FALSE. Valid only for Classification.
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.
Dataframe
Predicted values, structured as follows.
ID column, with same name and type as data's ID column.
SCORE, type NVARCHAR(100), predicted classes.
CONFIDENCE, type DOUBLE. Representing the confidence of a class
Input DataFrame data2:
> data2$Collect()
ID OUTLOOK HUMIDITY TEMP WINDY
1 0 Overcast 75.0 70 Yes
2 1 Rain 78.0 70 Yes
3 2 Sunny 66.0 70 Yes
4 3 Sunny 69.0 70 Yes
5 4 Rain NA 70 Yes
6 5 <NA> 70.0 70 Yes
7 6 *** 70.0 70 Yes
Call the function and obtain the result:
> result = predict(dtc, data2, verbose=FALSE)
ID SCORE CONFIDENCE
1 0 Play 1.000000
2 1 Do not Play 1.000000
3 2 Play 1.000000
4 3 Play 1.000000
5 4 Do not Play 1.000000
6 5 Play 0.692308
7 6 Play 0.692308