เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

From probabilites to confusion matrix

Conversely, say you want to be really certain that your model correctly identifies all the mines as mines. In this case, you might use a prediction threshold of 0.10, instead of 0.90.

The code pattern for cutting probabilities into predicted classes, then calculating a confusion matrix, was shown in Exercise 7 of this chapter.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Machine Learning with caret in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Use ifelse() to create a character vector, m_or_r that is the positive class, "M", when p is greater than 0.1, and the negative class, "R", otherwise.
  • Convert m_or_r to be a factor, p_class, with levels the same as those of test[["Class"]].
  • Make a confusion matrix with confusionMatrix(), passing p_class and the "Class" column from the test dataset.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# If p exceeds threshold of 0.1, M else R: m_or_r


# Convert to factor: p_class


# Create confusion matrix
แก้ไขและรันโค้ด