Skip to contents

Given a tidied dataframe of topic-doc or word-topic distributions and a exponent, renormalizes the distributions.

Usage

renorm(tidy_df, group_col, p_col, exponent, keep_original = FALSE)

Arguments

tidy_df

The tidied distribution dataframe

group_col

Grouping column, RHS of the conditional probability distribution, eg, topics for word-topic distributions

p_col

Column containing the probability for each category (eg, word) conditional on the group (eg, topic)

exponent

Exponent to use in renormalization

keep_original

Keep original probabilities?

Value

A dataframe with (if keep_original is TRUE) an added column of the form p_col_rn containing the renormalized probabilities or (if keep_original is FALSE) renormalized values in p_col.