## ----setup, include = FALSE--------------------------------------------------- knitr::opts_chunk$set(collapse = TRUE, comment = "#>") library(featR) ## ----------------------------------------------------------------------------- d <- data.frame( spread = c(1, 2, 3, 4, 100, 6, 7, 8), flat = rep(2, 8), gappy = c(1, NA, 3, NA, 5, 6, NA, 8) ) res <- fs_unsupervised(d, method = "variance", threshold = 1) res ## ----------------------------------------------------------------------------- selected(res) # the features that were kept res$scores # per-feature scores, comparable within a method res$method # which method produced this res$task # "classification", "regression", or NA names(res$details) # everything method-specific ## ----------------------------------------------------------------------------- summary(res) ## ----------------------------------------------------------------------------- train <- data.frame( strong = c(1, 2, 3, 4, 5, 6), mirror = c(6, 5, 4, 3, 2, 1), noise = c(1, 0, 1, 0, 1, 0), y = c(1, 2, 3, 4, 5, 6) ) fs_supervised(train, target = "y", threshold = 0.9) ## ----------------------------------------------------------------------------- fs_correlation(train[, c("strong", "mirror", "noise")], threshold = 0.9) ## ----------------------------------------------------------------------------- ig <- data.frame( perfect = rep(c("a", "b", "c", "c"), 5), half = rep(c("n1", "n2"), 10), target = factor(rep(c("a", "b", "c", "c"), 5)) ) fs_infogain(ig, target = "target")$scores