get_classification_accuracy {ssPATHS} | R Documentation

## Get Classification Accuracy

### Description

Get the AUC-ROC, AUC-PR, and ROC/PR curves for plotting.

### Usage

    get_classification_accuracy(sample_scores, positive_val)

### Arguments

`sample_scores` | This is a data.frame containing the sample id, score, and true label Y. This object is returned by the method get_gene_weights.
`positive_val` | This is the value that will denote a true positive. It must be one of the two values in the Y column in sample_scores.

### Value

This returns a list of performance metrics

`auc_pr` | Area under the PR-curve
`auc_roc` | Area under the ROC-curve
`perf_pr` | ROCR object for plotting the PR-curve
`perf_roc` | ROCR object for plotting the ROC-curve

### Author(s)

Natalie R. Davidson

### Examples

    data(tcga_expr_df)

    # transform from data.frame to SummarizedExperiment
    tcga_se <- SummarizedExperiment(t(tcga_expr_df[ , -(1:4)]),
                                    colData=tcga_expr_df[ , 2:4])
    colnames(tcga_se) <- tcga_expr_df$tcga_id
    colData(tcga_se)$sample_id <- tcga_expr_df$tcga_id

    hypoxia_gene_ids <- get_hypoxia_genes()
    hypoxia_gene_ids <- intersect(hypoxia_gene_ids, rownames(tcga_se))
    hypoxia_se <- tcga_se[hypoxia_gene_ids,]

    colData(hypoxia_se)$Y <- ifelse(colData(hypoxia_se)$is_normal, 0, 1)

    # now we can get the gene weightings
    res <- get_gene_weights(hypoxia_se)
    sample_scores <- res[[2]]

    # check how well we did
    training_res <- get_classification_accuracy(sample_scores, positive_val=1)
    print(training_res[[2]])

    plot(training_res[[3]], col="orange", ylim=c(0, 1))
    legend(0.1,0.8,c(training_res$auc_pr,"\n"), border="white", cex=1.7,
            box.col = "white")

    plot(training_res[[4]], col="blue", ylim=c(0, 1))
    legend(0.1,0.8,c(training_res$auc_roc,"\n"),border="white",cex=1.7,
            box.col = "white")

[Package ssPATHS version 1.0.0 Index]