ModelPredictedLabelConfig | R Documentation |
Config object to extract a predicted label from the model output.
label
Predicted label of the same type as the label in the dataset
probability
Optional index or JSONPath location in the model
probability_threshold
An optional value for binary prediction task
predictor_config
Predictor dictionary of the analysis config.
new()
Initializes a model output config to extract the predicted label. The following examples show different parameter configurations depending on the endpoint:
Regression Task: The model returns the score, e.g. 1.2. we don't need to specify
anything. For json output, e.g. list('score'=1.2)
we can set ''label='score”'
Binary classification:
The model returns a single probability and we would like to classify as 'yes' those with a probability exceeding 0.2. We can set ''probability_threshold=0.2, label_headers='yes”'.
The model returns list('probability'=0.3)
, for which we would like to apply a
threshold of 0.5 to obtain a predicted label in list(0, 1)
. In this case we can set
''label='probability”'.
The model returns a tuple of the predicted label and the probability. In this case we can set ''label=0''.
Multiclass classification:
The model returns
list('labels'= c('cat', 'dog', 'fish'), 'probabilities'=c(0.35, 0.25, 0.4))
.
In this case we would set the ''probability='probabilities”' and
''label='labels”‘ and infer the predicted label to be '’fish.''
The model returns list('predicted_label'='fish', 'probabilities'=c(0.35, 0.25, 0.4]))
.
In this case we would set the ''label='predicted_label”'.
The model returns c(0.35, 0.25, 0.4)
. In this case, we can set
''label_headers=['cat','dog','fish']'‘ and infer the predicted label to be '’fish.''
ModelPredictedLabelConfig$new( label = NULL, probability = NULL, probability_threshold = NULL, label_headers = NULL )
label
(str or [integer] or list[integer]): Optional index or JSONPath location in the model output for the prediction. In case, this is a predicted label of the same type as the label in the dataset no further arguments need to be specified.
probability
(str or [integer] or list[integer]): Optional index or JSONPath location in the model output for the predicted scores.
probability_threshold
(float): An optional value for binary prediction tasks in which the model returns a probability, to indicate the threshold to convert the prediction to a boolean value. Default is 0.5.
label_headers
(list): List of label values - one for each score of the “probability“.
get_predictor_config()
Returns probability_threshold, predictor config.
ModelPredictedLabelConfig$get_predictor_config()
format()
format class
ModelPredictedLabelConfig$format()
clone()
The objects of this class are cloneable with this method.
ModelPredictedLabelConfig$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.