Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
565 views
in Technique[技术] by (71.8m points)

r - How to draw ROC curve using value of confusion matrix?

Consider i have a classifier like A and the result of its classification gives me the following table:

    TP  TN  FP  FN
A   225 100 175 100

TP is True Positive

TN is True Negative

FP is False Postive

FN is False Negative

How i can draw a plot curve of ROC?

I know, i can define a variable, and try to predict it based on A, and then make a dataframe which exactly simulate the above values, and finally, i can use this code. But i think there should be an easier way?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is impossible, because you only have a confusion matrix for a certain (unknown) threshold of your classifier. A ROC-Curve contains information about all possible thresholds.

The Confusion matrix corresponds to a single point on your ROC Curve:

Sensitivity = TP / (TP + FN)
1 - Specificy = TN / (TN + FP) .


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...