Skip to contents

This function wraps the Truncated SVD (Single Value Decomposition) functionality from Python's sklearn package for use in R via reticulate. It allows you to perform dimension reduction on high-dimensional data. Its intended use is in a BertopicR pipeline. If you're concerned about processing time, you most likely will only want to reduce the dimensions of your dataset once. In this case, when compiling your model with bt_compile_model you should call reducer <- bt_empty_reducer().

Usage

bt_make_reducer_truncated_svd(
  n_components,
  ...,
  n_iter = 5L,
  svd_solver = c("randomized", "arpack")
)

Arguments

n_components

Number of components to keep

...

Sent to sklearn.decomposition Truncated SVD function for adding additional arguments

n_iter

Number of iterations for randomised svd solver. Not used if svd solver is "arpack".

svd_solver

method for reducing components can be arpack or randomized

Value

Truncated SVD Model that can be input to bt_do_reducing to reduce dimensions of data

Examples

reducer <- bt_make_reducer_truncated_svd(n_components = 5)