BaşlayınÜcretsiz Başlayın

Compare the results

We have seen that a mixture model gives to every observation a probability of belonging to each cluster. However, if we want to assign each observation to the cluster that has the maximum probability, we can use the function clusters() from flexmix package.

Since the mix_example dataset was a simulation, we actually have the real labels for each observation. These are provided in the assignment variable. The aim in this exercise is to compare the labels assigned by the clusters() function versus the real assignments.

Bu egzersiz

Mixture Models in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Explore the first six elements of the clusters() function.
  • Explore the first six elements of the real labels.
  • Use the function table() to make a frequency table where the rows correspond to the real labels and the columns the predicted label.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Explore the first assignments
___(___(fit_mix_example))

# Explore the first real labels
___(mix_example$___)

# Create frequency table
___(___, clusters(fit_mix_example))
Kodu Düzenle ve Çalıştır