시작하기무료로 시작하기

Selecting number of clusters

In this exercise, you will compare the outputs from your hierarchical clustering model to the actual diagnoses. Normally when performing unsupervised learning like this, a target variable isn't available. We do have it with this dataset, however, so it can be used to check the performance of the clustering model.

When performing supervised learning—that is, when you're trying to predict some target variable of interest and that target variable is available in the original data—using clustering to create new features may or may not improve the performance of the final model. This exercise will help you determine if, in this case, hierarchical clustering provides a promising new feature.

이 연습은 강의의 일부입니다

Unsupervised Learning in R

강의 보기

연습 안내

wisc.data, diagnosis, wisc.pr, pve, and wisc.hclust are available in your workspace.

  • Use cutree() to cut the tree so that it has 4 clusters. Assign the output to the variable wisc.hclust.clusters.
  • Use the table() function to compare the cluster membership to the actual diagnoses.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Cut tree so that it has 4 clusters: wisc.hclust.clusters


# Compare cluster membership to actual diagnoses
코드 편집 및 실행