R6 Class Xtractor - How to Update a Feature"

Use case:


All features have been calculated:

xtractor$results

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

xtractor$remove_feature(fun1)

This deletes all calculated features corresponding to fun1.

It's also possible to pass a character string:

xtractor$remove_feature("fun2")

Add New Feature Functions

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

xtractor$add_feature(fun1_robust)
xtractor$add_feature(fun2_robust)
xtractor$calc_features()
xtractor$results
unlink("fxtract_files", recursive = TRUE)


Try the fxtract package in your browser

Any scripts or data that you put into this service are public.

fxtract documentation built on July 8, 2020, 5:43 p.m.