Open tangxj98 opened 3 months ago
I think there is a bug in the code for rank estimation. I tried with the above estimate rank 3, and the function reported no errors. It seems that the estimated rank, elbow_metric_raw, is not assigned to the tensor, but an undefined/unused orphan variable py$temp. Please check the code liana_tensor_c2c.
tensor <- c2c$tensor$dataframes_to_tensor(context_df_dict = context_df_dict,
sender_col = sender_col, receiver_col = receiver_col,
ligand_col = ligand_col, receptor_col = receptor_col,
score_col = score_col, how = how, lr_fill = lr_fill,
cell_fill = cell_fill, lr_sep = lr_sep, context_order = context_order,
order_labels = list("contexts", "interactions", "senders",
"receivers"), sort_elements = sort_elements, device = device)
if (build_only)
return(tensor)
elbow_metric_raw <- NULL
if (is.null(rank)) {
liana_message(str_glue("Estimating ranks..."), verbose = verbose,
output = "message")
py$temp <- tensor$elbow_rank_selection(upper_rank = as.integer(upper_rank),
runs = as.integer(runs), init = init, automatic_elbow = TRUE,
random_state = as.integer(seed))
elbow_metric_raw <- tensor$elbow_metric_raw
rank <- as.integer(tensor$rank)
}
Dear authors,
The liana_tensor_c2c took 4.5 hours to run but failed with the error: 'PreBuiltTensor' object has no attribute 'elbow_metric_raw' . But the code of liana_tensor_c2c showed that elbow_metric_raw should be something that is defined right here in this step. Why would this happen?
── Python Exception Message ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── AttributeError: 'PreBuiltTensor' object has no attribute 'elbow_metric_raw'
── R Traceback ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ▆
$.python.builtin.object
(tensor, "elbow_metric_raw")reticulate::py_last_error()$r_trace$full_call
for more details.