% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/renormalize.R
\name{renorm}
\alias{renorm}
\title{Renormalize tidied distributions}
\usage{
renorm(tidy_df, group_col, p_col, exponent, keep_original = FALSE)
}
\arguments{
\item{tidy_df}{The tidied distribution dataframe}

\item{group_col}{Grouping column, RHS of the conditional probability distribution, eg, topics for word-topic distributions}

\item{p_col}{Column containing the probability for each category (eg, word) conditional on the group (eg, topic)}

\item{exponent}{Exponent to use in renormalization}

\item{keep_original}{Keep original probabilities?}
}
\value{
A dataframe with (if \code{keep_original} is \code{TRUE}) an added column of the form \code{p_col_rn} containing the renormalized probabilities or (if \code{keep_original} is \code{FALSE}) renormalized values in \code{p_col}.
}
\description{
Given a tidied dataframe of topic-doc or word-topic distributions and a exponent, renormalizes the distributions.
}
\examples{
\donttest{
set.seed(42)
theta  = rdirichlet(50, 1, k = 3)
phi    = rdirichlet(3, 0.1, k = 20)
corpus = draw_corpus(rep(50L, 50), theta, phi)
model  = tmfast(corpus, n = 3)
beta   = tidy(model, matrix = 'beta', k = 3)
pwr    = target_power(beta, topic, beta, target_entropy = 2)
renorm(beta, topic, beta, exponent = pwr)
}
}
