Best Feature Function (bff) Given a pc object from pca, or a rotated version, we wish to interpret the individual dimensions. Often, each unit/row (or context/column) of the original interaction_model will have a some sort of text description. For example, if each row is an R package, we have the package title and description. Convert these text descriptions into an interaction_model where the units (i.e. the variable before the *) matches either the units or context for the pc.
Source:R/bff.R
bff.Rd
This function bff takes both the pc object, and an interaction_model. It
Examples
im = make_interaction_model(all_packages, ~Package*Imports, parse_text = TRUE, to_lower = FALSE)
pcs = im |> pca(10)
im_text = make_interaction_model(top_packages, ~Package*(Title & Description), parse_text= TRUE)
im_text$column_universe = im_text$column_universe |> dplyr::anti_join(tidytext::stop_words, by = c("token"="word"))
im_text = im_text |> subset_im() |> core()
#> [1] "adding graph summaries (coreness and connected components)."
bff(pcs, im_text, num_best = 4)
#> # A tibble: 10 × 5
#> factor word1 word2 word3 word4
#> <chr> <chr> <chr> <chr> <chr>
#> 1 pc_01_rows data/Description ggplot2/Description ggplot2/Title mode…
#> 2 pc_02_rows shiny/Description tidy/Description shiny/Title tidy…
#> 3 pc_03_rows shiny/Description shiny/Title analysis/Descripti… apps…
#> 4 pc_04_rows tidy/Description tidy/Title data/Description ggpl…
#> 5 pc_05_rows spatial/Description models/Description geometrical/Descri… fitt…
#> 6 pc_06_rows fitted/Description spatial/Description models/Description netw…
#> 7 pc_07_rows shiny/Description mlr3/Description shiny/Title fore…
#> 8 pc_08_rows spatial/Description patterns/Description data/Description form…
#> 9 pc_09_rows spatial/Description raster/Description goal/Description ggpl…
#> 10 pc_10_rows models/Description mixed/Description methods/Description para…