FIFA 18: exploring defenders
In the FIFA 18 dataset, various attributes of players are present. Two such attributes are:
- sliding tackle: a number between 0-99 which signifies how accurate a player is able to perform sliding tackles
- aggression: a number between 0-99 which signifies the commitment and will of a player
These are typically high in defense-minded players. In this exercise, you will perform clustering based on these attributes in the data.
This data consists of 5000 rows, and is considerably larger than earlier datasets. Running hierarchical clustering on this data can take up to 10 seconds.
The following modules are pre-loaded: dendrogram
, linkage
, fcluster
from scipy.cluster.hierarchy
, matplotlib.pyplot
as plt
, seaborn
as sns
. The data is stored in a pandas DataFrame, fifa
.
Diese Übung ist Teil des Kurses
Cluster Analysis in Python
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Fit the data into a hierarchical clustering algorithm
distance_matrix = ____(fifa[[____, ____]], 'ward')