Description Usage Arguments Details Value Examples
View source: R/decision-boundary.R
Plot decision boundary for a classifier with 2 predictors
1 2 3 4 5 6 7 8 9 10 11 | decision_boundary(
fitted_model,
y,
x1,
x2,
predict_type = NULL,
predict_fun = NULL,
resolution = 100,
showgrid = TRUE,
...
)
|
fitted_model |
a fitted classifier object, for example the result of |
y |
the original observed classes |
x1 |
original first predictor |
x2 |
original second predictor |
predict_type |
default is |
predict_fun |
if your classifier is different than one of the standard methods (see below) you can pass a custom function which accepts a single argument g (a new data dataframe with columns) and produces a vector of classes |
resolution |
number of points along the two dimensions to produce classes |
showgrid |
do we plot a grid of predictions |
... |
additional arguments passed to |
This function should work with only the mandatory arguments if the
classifier is produced via glm()
, MASS::lda()
, MASS::qda()
or from either
multinom()
or nnet()
in the {nnet}
package. Other classifiers likely
require additional instructions. If the predict
method produces integer
or factor labels as output, it should just "work".
If assigned to an object, returns the matrix of predicted classes
1 2 3 4 5 6 7 8 9 10 11 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.