get_pmi: Compute pointwise mutual information (PMI)

View source: R/pmi_svd.R

get_pmiR Documentation

Compute pointwise mutual information (PMI)

Description

Compute pointwise mutual information (PMI)

Usage

get_pmi(spm_cooc)

Arguments

spm_cooc

Co-occurrence sparse matrix, either a triangular sparse matrix or a dataframe

Value

PMI symmetric matrix

Examples

df_ehr = data.frame(Patient = c(1, 1, 2, 1, 2, 1, 1, 3, 4),
                    Month = c(1, 1, 1, 2, 2, 3, 3, 4, 4),
                    Parent_Code = c('C1', 'C2', 'C2', 'C1', 'C1', 'C1',
                                    'C2', 'C3', 'C4'),
                    Count = 1:9)

spm_cooc = build_df_cooc(df_ehr)

m_pmi = get_pmi(spm_cooc)


nlpembeds documentation built on April 4, 2025, 4:41 a.m.