Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LPM Simulation Code

Simulation code accompanying the paper:

Nonparametric Regression on Latent Position Models

This repository contains implementations of the Graphical Nadaraya-Watson (GNW) estimator and the Estimated Nadaraya-Watson (ENW) estimator, along with the position recovery algorithms used to produce the numerical results in the paper.


Overview

Given a graph generated from a Latent Position Model (LPM), the goal is to perform nonparametric regression on the latent positions of the nodes. Two approaches are compared:

  • GNW — Nadaraya-Watson smoothing directly on the graph adjacency structure
  • ENW — Nadaraya-Watson smoothing on estimated latent positions, recovered via:
    • Shortest path embedding (sp_embedding_narrow)
    • Spectral embedding (spectral_embedding_wide)

Repository structure

algo_code/          Core algorithms
  algo.py           Spectral decomposition, cMDS, MLE, embedding algorithms
  LPM.py            LPM class: data generation, GNW smoother, position recovery
  help_functions.py Kernel matrices, scaling, alignment utilities

PLOTSCRIPTS/        Simulation runners and figure generation
  enw_RUN.py        Run ENW/GNW comparison (1D latent positions)
  enw_RUN_2D.py     Run ENW/GNW comparison (2D latent positions)
  nwp_RUN.py        Run NW-under-perturbation simulations
  delta_hg.py       Delta vs length scale curves
  delta_MSE.py      Delta vs MSE curves
  pyplot_config.py  Shared matplotlib configuration
  README.md         Details on running scripts and saving figures

experiments/        Exploratory scripts used during development

Installation

pip install -r requirements.txt

Running simulations

Scripts must be run from inside the PLOTSCRIPTS/ directory:

cd PLOTSCRIPTS
python enw_RUN.py

Simulation data is cached as .pkl files under auxdata/ (created automatically). See PLOTSCRIPTS/README.md for details on saving figures to a custom directory.


Dependencies

Package Version
PyTorch 2.1.2
NumPy 1.26.2
Matplotlib 3.8.2
SciPy 1.11.4
NetworkX 3.2.1
scikit-fda 0.9
matplotx 0.3.10

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages