as_classifier

0th

Percentile

Indicate model type to lime

lime requires knowledge about the type of model it is dealing with, more specifically whether the model is a regressor or a classifier. If the model class has a model_type() method defined lime can figure it out on its own but if not, you can wrap your model in either of these functions to indicate what type of model lime is dealing with. This can also be used to overwrite the output from model_type() if the implementation uses some heuristic that doesn't work for your particular model (e.g. keras models types are found by checking if the activation in the last layer is linear or not - this is rather crude). In addition as_classifier can be used to overwrite the returned class labels - this is handy if the model does not store the labels (again, keras springs to mind).

Usage
as_classifier(x, labels = NULL)

as_regressor(x)

Arguments
x

The model object

labels

An optional character vector giving labels for each class

Value

A model augmented with information about the model type and (potentially) the class labels.

Aliases
  • as_classifier
  • as_regressor
Documentation reproduced from package lime, version 0.5.1, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.