tidy_feature_matrix: Tidy feature matrix

Description Usage Arguments Value Examples

View source: R/tidy_feature_matrix.R

Description

Used for tidying up ('R-ify') the feature matrix after deep feature synthethis (dfs).

Usage

1
2
tidy_feature_matrix(.data, remove_nzv = FALSE, nan_is_na = FALSE,
  clean_names = FALSE)

Arguments

.data

The featuretools-object returned from dfs.

remove_nzv

Remove near zero variance variables created from dfs.

nan_is_na

Turn all 'NaN' into 'NA'.

clean_names

Make variable names R-friendly (snake case).

Value

A tidy data.frame.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(magrittr)
set_1 <- data.frame(key = 1:100, value = sample(letters, 100, TRUE), stringsAsFactors = TRUE)
set_2 <- data.frame(key = 1:100, value = sample(LETTERS, 100, TRUE), stringsAsFactors = TRUE)
# Common variable: `key`

as_entityset(set_1, index = "key", entity_id = "set_1", id = "demo") %>%
  add_entity(entity_id = "set_2", df = set_2, index = "key") %>%
  add_relationship(
    parent_set = "set_1",
    child_set = "set_2",
    parent_idx = "key",
    child_idx = "key"
  ) %>%
  dfs(target_entity = "set_1", trans_primitives = c("and")) %>%
  tidy_feature_matrix(remove_nzv = TRUE, nan_is_na = TRUE)

featuretoolsR documentation built on April 25, 2020, 5:05 p.m.