data(
vi,
vi_predictors
)
#subset to limit example run time
vi <- vi[1:1000, ]
vi_predictors <- vi_predictors[1:5]
#convert correlation data frame to matrix
df <- cor_df(
df = vi,
predictors = vi_predictors
)
m <- cor_matrix(
df = df
)
#show first three columns and rows
m[1:5, 1:5]
#generate correlation matrix directly
m <- cor_matrix(
df = vi,
predictors = vi_predictors
)
m[1:5, 1:5]
#with response (much faster)
#different solution than previous one
#because target encoding is done against the response
#rather than against the other numeric in the pair
m <- cor_matrix(
df = vi,
response = "vi_mean",
predictors = vi_predictors
)
m[1:5, 1:5]
Run the code above in your browser using DataLab