The following figure shows the trend of loss decrease and AUC increase during model training:

https://github.com/inneedloveBu/wikinet-link-prediction/animations/training_progress_english_20260124_160006.gif

WikiNet is a graph representation learning project designed to perform link prediction on a Wikipedia hyperlink network.
The task is formulated as a binary classification problem over node pairs.
The project focuses on:
- Structural feature engineering
- Hardness-aware negative sampling
- Multi-interaction edge decoding
- Robust training stabilization techniques
The graph is constructed from the WikiLinks dataset.
- Number of nodes: 1000
- Number of edges: 5000
- Node feature dimension: 20 (structural + content features)
- Training edges: 1771
- Validation edges: 253
- Test edges: 507
- Normalized degree
- Clustering coefficient
- Betweenness centrality
- PageRank score
- Neighbor statistics (mean / std / max / min degree)
- Title length
- Word count
- Numeric token count
- Uppercase ratio
- Special character ratio
- Hash-based embedding component
All features are standardized before training.
A 3-layer MLP encoder:
-
Linear → BatchNorm → ReLU → Dropout
-
Linear → BatchNorm → ReLU → Dropout
-
Linear projection layer
-
Hidden dimension: 64
-
Total trainable parameters: 21,729
Instead of naive concatenation, the decoder integrates multiple interaction patterns:
- Node embedding u
- Node embedding v
- Absolute difference |u − v|
- Element-wise product u ⊙ v
These representations are concatenated and passed through an MLP classifier.
This design increases expressive power for link prediction tasks.
Three difficulty levels were implemented:
- Easy — Random negative sampling
- Medium — Common-neighbor-based sampling
- Hard — Degree-similarity-based sampling
Final training uses:
- Medium hardness sampling
This generates more informative negative edges and improves generalization.
-
Binary Cross Entropy with logits
-
Class-weight balancing
-
Gradient clipping
-
Early stopping (patience = 20)
-
ReduceLROnPlateau learning rate scheduler
-
Best model checkpointing
-
Training epochs: 300
-
Best validation AUC: 0.897 (epoch 110)
- ROC-AUC: 0.798
- Average Precision (AP): 0.784
- F1-score: 0.763
- Accuracy: 0.696
The model demonstrates stable generalization performance under controlled negative sampling.
- PyTorch 2.0+
- PyTorch Geometric
- NetworkX
- NumPy
- Pandas
- scikit-learn
- Matplotlib
wikinet-link-prediction/
├── data/
│ ├── raw/
│ └── cleaned/
├── models/
├── notebooks/
├── train11.py
├── requirements.txt
└── README.mdgit clone https://github.com/inneedloveBu/wikinet-link-prediction.git
cd wikinet-link-predictionpip install -r requirements.txtpython train11.py- Designed hardness-controlled negative sampling mechanism
- Implemented multi-interaction edge decoder
- Combined structural and lightweight content features
- Applied full training stabilization pipeline
- Conducted systematic multi-metric evaluation
- Replace MLP encoder with GCN / GAT
- Neighbor sampling for scalability
- Larger-scale graph experiments
- Embedding visualization
- Interactive web deployment
- MIT License
- GitHub Issues: https://github.com/inneedloveBu/wikinet-link-prediction/issues
- Email: indeedlove@foxmail.com

