accessing values stored in an R confusion matrix conf_mat() by indexing

12 Views Asked by At

I have R code that creates a confusion matrix. My code is along the lines of

my_conf_mat <- data_predictions %>% conf_mat(truth = true_labes, estimate = .pred_class)

I get this output, which I'm satisfied with

Truth Prediction no yes no 89 14 yes 105 78

I think this has created a object of type conf_mat.

Now I want to store these values in variables to perform calculations. I'm stuck on this.

If want to store the value 78 in a varaible, I have tried things like

TP <- cheaters_conf_mat$yes[2]

(returns NULL)

and

TP <- cheaters_conf_mat[2,2]

Which throws this error: "Error in cheaters_conf_mat[2, 2] : incorrect number of dimensions"

Am I close? Any suggestions on how to store the value 78?

0

There are 0 best solutions below