R'de Atamaya Dayalı Eksik Veri Doldurma
Michal Oleszak
Machine Learning Engineer
Atama (imputation) = eksik değerlerin ne olabileceğine dair bilinçli tahmin yapma
Bu bölüm bağışçı tabanlı yöntemlere odaklanır:

Ortalama ile atama, uzun dönem ortalaması etrafında rastgele dalgalanan zaman serilerinde iyi çalışır.
Kesitsel verilerde ise genelde çok kötü bir seçimdir:
Görev: NHANES verisinde Height ve Weight için ortalama ile atama yapın.
nhanes <- nhanes %>%
mutate(Height_imp = ifelse(is.na(Height), TRUE, FALSE)) %>%
mutate(Weight_imp = ifelse(is.na(Weight), TRUE, FALSE))
Height ve Weight’teki eksik değerleri, kendi ortalamalarıyla değiştirin.nhanes_imp <- nhanes %>%
mutate(Height = ifelse(is.na(Height), mean(Height, na.rm = TRUE), Height)) %>%
mutate(Weight = ifelse(is.na(Weight), mean(Weight, na.rm = TRUE), Weight))
nhanes_imp %>%
select(Weight, Height, Height_imp, Weight_imp) %>%
head()
Weight Height Height_imp Weight_imp
1 73.20000 166.2499 TRUE FALSE
2 72.30000 166.2499 TRUE FALSE
3 57.70000 158.9000 FALSE FALSE
4 88.90000 183.3000 FALSE FALSE
5 45.10000 157.6000 FALSE FALSE
6 66.77065 158.4000 FALSE TRUE
nhanes_imp %>% select(Weight, Height, Height_imp, Weight_imp) %>% marginplot(delimiter="imp")

Değişkenler arası ilişkiyi bozma:
Height ve Weight ortalama ile atanınca, pozitif korelasyon zayıflar.Atanan veride değişkenlik yok:

R'de Atamaya Dayalı Eksik Veri Doldurma