Skip to contents

Calculates a sparse, z-scored similarity graph between parcels based on their encoding weight profiles for a set of features.

Usage

compute_W_task_from_encoding(
  encoding_weights_matrix,
  parcel_names,
  k_conn_task_pos,
  k_conn_task_neg,
  similarity_method = "pearson"
)

Arguments

encoding_weights_matrix

A numeric matrix (`V_p x N_features`) where `V_p` is the number of parcels and `N_features` is the number of encoding features. Each row represents the encoding weight profile for a parcel.

parcel_names

A character vector of length `V_p` specifying parcel names.

k_conn_task_pos

Non-negative integer. Number of strongest positive connections to retain per parcel during sparsification.

k_conn_task_neg

Non-negative integer. Number of strongest negative connections to retain per parcel during sparsification.

similarity_method

Character string or function. Specifies the method to compute the initial `V_p x V_p` similarity matrix. If "pearson" (default) or "spearman", `stats::cor` is used on the transposed input (to compare rows/parcels). If a function, it must take `encoding_weights_matrix` (V_p x N_features) as input and return a `V_p x V_p` numeric matrix.

Value

A sparse, symmetric `Matrix::dgCMatrix` of size `V_p x V_p` representing the z-scored task-based similarity graph `W_task_i`.