Get startedGet started for free

Adding network features

Enriching data with network features and other kinds of variables improves a model's ability to detect fraud.

The network net is based on the transactional dataset transfers from different accounts. The data account_info contains details on these accounts which are the nodes of the network. You can add network features to account_info like degree, closeness and betweenness.

This exercise is part of the course

Fraud Detection in R

View Course

Exercise instructions

  • Plot network net and print account_info which contains information about the accounts (i.e. nodes).
  • Add features degree, closeness and betweenness to data frame account_info as the normalized degree, closeness and betweenness respectively.
  • Show the new features of the accounts (i.e. nodes) by printing account_info.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Plot network and print account info
___
legend("bottomleft", legend = c("known money mule", "legit account"), fill = c("darkorange", "lightblue"), bty = "n")
print(___)

# Degree
account_info$___ <- ___(___, normalized = ___)

# Closeness
account_info$___ <- ___(___, ___ = ___)

# Betweenness
account_info$___ <- ___(___, ___ = ___)

print(___)
Edit and Run Code