Use case:

  • Features have been added (or have already been calculated).
  • We want to edit a feature function.

Click here on how to use the R6 class Xtractor.

All features have been calculated:

##      Species mean_sepal_length sd_sepal_length mean_petal_length
## 1     setosa             5.006       0.3524897             1.462
## 2 versicolor             5.936       0.5161711             4.260
## 3  virginica             6.588       0.6358796             5.552
##   sd_petal_length
## 1       0.1736640
## 2       0.4699110
## 3       0.5518947

Write Updated Feature Functions

Let’s say we want to edit our features to use the robust measures median() and mad().

First we need to write the functions:

fun1_robust = function(data) {
  c(median_sepal_length = median(data$Sepal.Length),
    mad_sepal_length = mad(data$Sepal.Length))
}

fun2_robust = function(data) {
  c(median_petal_length = median(data$Petal.Length),
    mad_petal_length = mad(data$Petal.Length))
}

Delete Old Feature Functions

This deletes all calculated features corresponding to fun1.

It’s also possible to pass a character string:

Add New Feature Functions

All there is left to do is to add the new feature functions and to execute the calculation process:

##      Species median_sepal_length mad_sepal_length median_petal_length
## 1     setosa                 5.0          0.29652                1.50
## 2 versicolor                 5.9          0.51891                4.35
## 3  virginica                 6.5          0.59304                5.55
##   mad_petal_length
## 1          0.14826
## 2          0.51891
## 3          0.66717