get_classification_accuracy: Get Classification Accuracy

Description Usage Arguments Value Author(s) Examples

View source: R/ssPATHS.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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")

nrosed/ssPATHS documentation built on April 24, 2020, 6:22 p.m.