Skip to content

Levia-Mobius/HG-PD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HG-PD Model

This repository is the official implementation of the group polarization detection model proposed in our paper When "normal" becomes polarized: Heterogeneous graph clustering for non-ideological community conflicts.

Requirements

  • Python version: 3.10.13

Usage Instruction

  1. You can refer to Data_description.txt for more information about .csv .xlsx .pt and .npy files in our codes.
  2. Code files Include 2 types:
    • Python scripts .py for collecting Sina Weibo's data (Sina_crawl) and some model-training related functions
    • Jupyter files .ipyn for (a) data processing; (b) all experiments in paper; and (c) visualization for HG-PD (i.e., exp3)
    • All Jupyter files are in 2 language versions, i.e., Chinese and English, for better understanding :D
  3. Python scripts (.py)
    • Sina_crawl: Used for crawling the data we need from Sina weibo (You can use it for crawling other Sina Weibo posts)
    • userInter: HomoG-based model framework for exp2
    • mcr_HGPD: HG-PD model framework for exp3
    • mcrLoss: MCR2 loss function
    • augment: Data augmentation
    • other_func: Used for constructing membership matrix \Pi
    • savePara: Used for saving loss .csv and model states .pt
  4. Jupyter files (.ipynb)
    • Data_processing: Include all data processing steps for 3 experiments
    • K-Prototype: Inmplementation of exp1 in our paper; Results are saved in Train_record/KPrototype
    • Ablation: Implementation of exp2 with related visualizations in our paper; Training results are saved in Train_record/Ablation and visualizations in Visualization
    • Model: Implementation of exp3 in our paper; Results are saved in Train_record/Model
    • Analysis_visualize: Visualizations of exp3 in our paper; Figures are saved in Visualization; Note that some additional visualizations are generated within Supplementary.ipynb and saved automatically to the specified output paths.
    • Abnormal_compar: Model Comparisons Experiments in our paper; including 5 GAD models for GP detection and corresponding analysis & visualization
    • Supplementary: Includes supplementary visualizations and result analyses, applicable to both the ablation experiments and the GAD models
  5. About Train_record
    • We just put the best model state in Train_record folder
  6. About Abnormal_result
    • Including (a) detection results (embedding, labels and scores) from all 5 GAD models; (b) csv file involved in analysis of all 5 GAD models; (c) tsne visualizations

Feel free to post any issues via Github.

Releases

No releases published

Packages

 
 
 

Contributors