R/RcppExports.R

Defines functions quickPSM createSimilarityMat

Documented in createSimilarityMat quickPSM

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' @title Calculate item similarity
#' @decription Compares how similar two points are with regards to their clustering across 
#' all iterations. Works for unsupervised methods (i.e. allows label flipping).
#' 
#' @param point The index row within cluster_record for the first object.
#' @param comparison_point The comparison row index from cluster_record.
#' @param cluster_record A matrix of combined membership column vectors where 
#' the ijth entry is the membership assigned to the ith person in the jth 
#' iteration of sampling.
#' @param num_iter The number of samples recorded.
#' 
#' @return A score between 0 and 1 of the fraction of iterations for which the 
#' objects denoted by the point and comparison_point rows are assigned the same
#' label.
NULL

#' @title Create Similarity Matrix
#' @description Constructs a similarity matrix comparing all points clustering across the 
#' iterations.
#' 
#' @param cluster_record Matrix of label assignment for data across iterations.
#' 
#' @return A symmetric n x n matrix (for n rows in cluster record) describing 
#' the fraction of iterations for which each pairwise combination of points are
#' assigned the same label.
#' @export
createSimilarityMat <- function(cluster_record) {
    .Call(`_mdiHelpR_createSimilarityMat`, cluster_record)
}

#' @title Quick PSM
#' @description Constructs a similarity matrix trying assuming that there are 
#' a small number of modes. This function is intended to be more clever in
#' calculating the PSM, relying upon the poor quality exploration of many MCMC
#' samplers. It probably is not a good idea in low dimensions.
#' 
#' @param partitions Matrix of label assignment for data across iterations.
#' 
#' @return A symmetric n x n matrix (for n rows in cluster record) describing 
#' the fraction of iterations for which each pairwise combination of points are
#' assigned the same label.
#' @export
quickPSM <- function(partitions, tol = 0.001) {
    .Call(`_mdiHelpR_quickPSM`, partitions, tol)
}
stcolema/mdiHelpR documentation built on July 28, 2024, 5:41 a.m.