Description Usage Arguments Value See Also Examples
Some model types and packages, when asked to predict new values, return the probability that a given class will occur. This function converts this format into a vector of classes (type factor).
1 | prob2class(prob, classes = colnames(prob), threshold = 0)
|
prob |
a matrix of probabilities with each column representing a different class. |
classes |
(optional) the classes represented by |
threshold |
(optional) if the probability is less than this value, output 0 for that point as we don't have confidence in the result. |
A factor variable containing the most probable class indicated by the probability table. Note that if this function is passed a matrix with only one column or a vector of values, it will return a vector of the values. Care should be taken as this function does not always return the same type.
isCat
, isCont
, and factorValue
for help in handling the result.
1 2 3 4 5 6 7 8 9 | data ('siteData')
modelRun <- generateModels (data = siteData,
modelTypes = suppModels,
x = c('brtns','grnns','wetns','dem','slp','asp','hsd'),
y = 'ecoType',
grouping = ecoGroup[['domSpecies','transform']])
m <- modelRun$gbm
p <- buildPredict(m)(m, getData(m))
prob2class(p)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.