worm_evaluate,WormTensor-method {WormTensor}R Documentation

Evaluates clustering result An evaluation result is generated from a WormTensor object.

Description

Evaluates clustering result An evaluation result is generated from a WormTensor object.

Usage

## S4 method for signature 'WormTensor'
worm_evaluate(object, labels = NULL)

Arguments

object

WormTensor object with a result of worm_clustering

labels

Labels for external evaluation

Value

WormTensor object with an evaluation result added

Examples


    # Pipe Operation
    worm_download("mSBD", qc = "PASS")$Ds |>
        as_worm_tensor() |>
            worm_membership(k = 6) |>
                worm_clustering() -> object
     # Internal evaluation
     worm_evaluate(object) -> object_internal

     # External evaluation by sample labels
     labels <- list(
         label1 = sample(3, length(object@clustering), replace = TRUE),
         label2 = sample(4, length(object@clustering), replace = TRUE),
         label3 = sample(5, length(object@clustering), replace = TRUE)
     )
     worm_evaluate(object, labels) -> object_external

     # External evaluation by worm_download labels
     Ds_mSBD <- worm_download("mSBD", qc = "PASS")
     labels <- list(
         label1 = replace(
             Ds_mSBD$labels$Class,
             which(is.na(Ds_mSBD$labels$Class)),
             "NA"
         ),
         label2 = sample(4, length(object@clustering), replace = TRUE),
         label3 = sample(5, length(object@clustering), replace = TRUE)
     )
     worm_evaluate(object, labels) -> object_external_Class


[Package WormTensor version 0.1.1 Index]