Function allows users to update data an y of any explainer in a unified way. It doesn't require knowledge about structre of an explainer.

update_data(explainer, data, y = NULL, verbose = TRUE)

Arguments

explainer

- explainer object that is supposed to be updated.

data

- new data, is going to be passed to an explainer

y

- new y, is going to be passed to an explainer

verbose

- logical, indicates if information about update should be printed

Value

updated explainer object

Examples

aps_lm_model4 <- lm(m2.price ~., data = apartments)
aps_lm_explainer4 <- explain(aps_lm_model4, data = apartments, label = "model_4v")
#> Preparation of a new explainer is initiated
#>   -> model label       :  model_4v 
#>   -> data              :  1000  rows  6  cols 
#>   -> target variable   :  not specified! (  WARNING  )
#>   -> predict function  :  yhat.lm  will be used (  default  )
#>   -> predicted values  :  No value for predict function target column. (  default  )
#>   -> model_info        :  package stats , ver. 4.2.3 , task regression (  default  ) 
#>   -> model_info        :  Model info detected regression task but 'y' is a NULL .  (  WARNING  )
#>   -> model_info        :  By deafult regressions tasks supports only numercical 'y' parameter. 
#>   -> model_info        :  Consider changing to numerical vector.
#>   -> model_info        :  Otherwise I will not be able to calculate residuals or loss function.
#>   -> predicted values  :  numerical, min =  1781.848 , mean =  3487.019 , max =  6176.032  
#>   -> residual function :  difference between y and yhat (  default  )
#>   A new explainer has been created!  
explainer <- update_data(aps_lm_explainer4, data = apartmentsTest, y = apartmentsTest$m2.price)
#>   -> data              :  9000  rows  6  cols 
#>   -> target variable   :  9000  values 
#>   An explainer has been updated!