dselivanov / dselivanov/text2vec

coherence() documentation

Open
#348 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
876
Forks
133
PR merge metrics
No merged PRs in 30d

Description

Ran into an issue with fitting coherence() into my workflow with external term co-occurrence matrices, figured it out now but letting you know that the documentation could reflect this:

> The term co-occurrence matrix, e.g, a Matrix::sparseMatrix or base::matrix, serving as the reference to calculate coherence metrics. Please note that a memory efficient version of the tcm is assumed as input with all entries in the lower triangle (excluding diagonal) set to zero (see, e.g., create_tcm).

coherence() actually works properly with Matrix class dsCMatrix (which is what is produced in the example workflow), but does not work with class dgCMatrix with empty lower triangle. This is because

> tcm = as.matrix(tcm[top_terms_tcm, top_terms_tcm])

in coherence() doesn't produce the wanted result with lower-triangle empty dgCMatrix. However, a symmetrical dgCMatrix produces the same results as a dsCMatrix.

Given dgCMatrix is the default for converting to sparseMatrix with Matrix, it might be nice to note this in the documentation.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.