as_classifier: Indicate model type to anchors

Description Usage Arguments Value

View source: R/models.R

Description

'anchors' 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 anchors 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 anchors 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

1
2
3

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.


viadee/anchorsOnR documentation built on Nov. 22, 2019, 5:24 p.m.