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

Link-based features

In this exercise, you will compute first order link-based features by multiplying the Churn attribute of the network with the network's adjacency matrix.

Note, that since churn is a binary indicator, the attribute Churn has 1 for churners and 0 for non-churners. Consequently, the attribute 1-Churn has 1 for non-churners and 0 for churners. This is helpful when computing the number of non-churn neighbors.

Bu egzersiz

Predictive Analytics using Networked Data in R

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

Egzersiz talimatları

  • Compute the attribute ChurnNeighbors, i.e. the number of neighbors who churned, by multiplying AdjacencyMatrix with the Churn attribute of network. Apply as.vector() to the result and add it to the network.
  • Similarly, compute NonChurnNeighbors, i.e. the number of non-churn neighbors.
  • Calculate the attribute RelationalNeighbor, the ratio of churners in the neighborhood, by dividing ChurnNeighbors with the sum of ChurnNeighbors and NonChurnNeighbors.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Compute the number of churn neighbors
V(network)$ChurnNeighbors <- as.vector(___ %*% V(network)$___)

# Compute the number of non-churn neighbors
V(network)$___ <- as.vector(___ %*% (1 - V(network)$___))

# Compute the relational neighbor probability
V(network)$RelationalNeighbor <- as.vector(V(network)$___ / 
    (V(network)$___ + V(network)$___))
Kodu Düzenle ve Çalıştır