Skip to content

vislearn/Fermat-Distance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Fermat Distance

This repository contains a PyTorch implementation of the experiments from the paper Learning Distances from Data with Normalizing Flows and Score Matching. It presents a method for computing Fermat distances, a type of density-based distance where shortest paths follow the data manifold, using a relaxation algorithm.

Package Structure

/
├── cpp_dijkstra/
│   ├── [Python package for C++ implementation of Dijkstra's algorithm]
├── fermat_distance/
│   ├── fermat_distance/
│   │   ├── [Python package containing three core files for computing Fermat distances]
│   ├── experiments/
│   │   ├── script.py  # Creates and runs experiments

Installation

Clone this repository and install the dependencies:

git clone https://github.com/vislearn/Fermat-Distance.git 
cd Fermat-Distance
pip install -r requirements.txt  

# Install the C++ Dijkstra package
cd cpp_dijkstra
pip install .
cd ..

# Install the Fermat distance package
cd fermat_distance
pip install .

Then you can import the package via

import fermat_distance

Running Experiments

python script.py --config [config file]

For an example configuration file, see configs/spiral_energy.yaml

Optional flags include:

  • --skip-data: Skip data creation
  • --skip-training: Skip model training
  • --skip-graphs: Skip graph creation
  • --skip-eval: Skip evaluation step
  • --score-relaxation: Calculate geodesics using a score model

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published