as_classifier: Indicate model type to lime

View source: R/models.R

as_classifierR Documentation

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).


as_classifier(x, labels = NULL)




The model object


An optional character vector giving labels for each class


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

lime documentation built on Aug. 19, 2022, 9:07 a.m.