Aan de slagGa gratis aan de slag

Getting a flat dataset

In this exercise, you will turn your network into a dataframe, where the rows are the people in the network and the columns are the network features you computed in the previous chapter. You will also prepare the dataset for the pre-processing.

Deze oefening maakt deel uit van de cursus

Predictive Analytics using Networked Data in R

Cursus bekijken

Oefeninstructies

  • Extract the dataframe of the customers using the as_data_frame() function. Note that you want the node attributes, i.e. vertices. Call the dataset studentnetworkdata_full
  • Inspect the first few rows of the data frame using the head() function.
  • Remove the customers who already churned by conditioning on the Churn attribute. Call this dataframe studentnetworkdata_filtered
  • Remove the first two columns, called Churn and name, since you don't need them anymore and name the dataframe studentnetworkdata.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Extract the dataset
studentnetworkdata_full <- ___(network, what = ___)

# Inspect the dataset
head(___)

# Remove customers who already churned
studentnetworkdata_filtered <- studentnetworkdata_full[-which(studentnetworkdata_full$___ == 1), ]

# Remove useless columns
studentnetworkdata <- ___[, -c(1, 2)]
Code bewerken en uitvoeren