■ Precision-Recall Graph를 그리는 방법을 보여준다.
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import matplotlib.pyplot as pp import numpy as np modelAPrecisionNDArray = np.array([0.33, 0.38, 0.45, 0.55, 0.57, 0.40, 0.66, 1.00, 1.00, 1.00, 1.00]) modelARecallRateNDArray = np.array([1.00, 1.00, 1.00, 1.00, 0.80, 0.40, 0.40, 0.40, 0.40, 0.20, 0.00]) modelBPrecisionNDArray = np.array([0.33, 0.38, 0.36, 0.37, 0.33, 0.40, 0.33, 0.50, 1.00, 1.00, 1.00]) modelBRecallRateNDArray = np.array([1.00, 1.00, 0.80, 0.60, 0.40, 0.40, 0.20, 0.20, 0.20, 0.20, 0.00]) pp.title("Precision-Recall Graph") pp.xlabel("Recall" ) pp.ylabel("Precision") pp.plot(modelARecallRateNDArray, modelAPrecisionNDArray, "b", label = "Model A") pp.plot(modelBRecallRateNDArray, modelBPrecisionNDArray, "g", label = "Model B") pp.legend(loc = "upper right") pp.show() |