group_correlated_features: Group correlated features

Description Usage Arguments Value Author(s) Examples

View source: R/corr_feats.R

Description

Group correlated features

Usage

1
2
3
4
5
6
group_correlated_features(
  features,
  corr_thresh = 1,
  group_neg_corr = TRUE,
  corr_method = "spearman"
)

Arguments

features

a dataframe with each column as a feature for ML

corr_thresh

For feature importance, group correlations above or equal to corr_thresh (range 0 to 1; default: 1).

group_neg_corr

Whether to group negatively correlated features together (e.g. c(0,1) and c(1,0)).

corr_method

correlation method. options or the same as those supported by stats::cor: spearman, pearson, kendall. (default: spearman)

Value

vector where each element is a group of correlated features separated by pipes (|)

Author(s)

Kelly Sovacool, sovacool@umich.edu

Examples

1
2
3
4
5
features <- data.frame(
  a = 1:3, b = 2:4, c = c(1, 0, 1),
  d = (5:7), e = c(5, 1, 4), f = c(-1, 0, -1)
)
group_correlated_features(features)

SchlossLab/mikropml documentation built on Nov. 25, 2021, 1:13 p.m.