make_extract_features: Make feature extractor

Description Usage Arguments Examples

View source: R/logistic-reg-featx.R

Description

Creates a feature extractor function

Usage

1
make_extract_features(x, n_comp = 5)

Arguments

x

a base::data.frame() or similar object with only feature variables

n_comp

the number of components to keep

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
library("dplyr")
library("stats")
data("states")

# assume that the input consists entirely of features, and no NAs
train_x <- states %>%
  filter(year < 2010) %>%
  select(-starts_with("dv_"), -gwcode, -year) %>%
  filter(complete.cases(.))

test_x <- states %>%
  filter(year > 2009) %>%
  select(-starts_with("dv_"), -gwcode, -year) %>%
  filter(complete.cases(.))

featx <- make_extract_features(train_x)
featx(train_x)

andybega/demspaces documentation built on April 18, 2021, 11:05 p.m.