A dataset split separates available relationships or triples into training, testing, and validation subsets so a model can be evaluated on held-out data. section 10.2 section 11.2.2
Use the split differently depending on the features and prediction task:
- For non-graph features such as age and education, allocate existing relationships between training and evaluation sets, such as 80% and 20%. section 10.2
- Add negative examples so classification can distinguish existing relationships from unconnected node pairs; subsample negatives when their larger pool creates imbalance. section 10.2
- Recompute graph-based features using the appropriate training relationships; otherwise network distance or embeddings can leak the target relationship into the features. section 10.2
- For knowledge graph completion, specify training, testing, and validation ratios, with the validation ratio optionally inferred from the other two. section 11.2.2
Splitting triples with PyKEEN
Load source, relationship type, and target columns into a TriplesFactory, then call split([0.8, 0.1, 0.1], random_state=0) to create training, testing, and validation sets. section 11.2.2
Listing 11.3 Inputting triples to PyKEEN
from pykeen.triples import TriplesFactory tf = TriplesFactory.from_labeled_triples( data[["source_name", "type", "target_name"]].values, )
Inspect the PyKEEN setup that converts selected dataframe columns into labeled triples before splitting. section 11.2.2
Listing 11.4 Splitting the dataset into train, test, and validation sets
training, testing, validation = tf.split([0.8, 0.1, 0.1], random_state=0)
Inspect the executable PyKEEN call that assigns 80%, 10%, and 10% to training, testing, and validation. section 11.2.2




















