Skip to content

Commit

Permalink
Fix imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaeladuta committed Dec 4, 2024
1 parent 255757b commit aa98637
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.DS_Store
__pycache__/
build/
l2gv2.egg-info/
.venv/
docs/build/
15 changes: 8 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
# pylint: disable=invalid-name
# pylint: disable=redefined-builtin
import warnings

project = "l2gv2"
copyright = "2024"
Expand All @@ -23,9 +19,14 @@
"show-inheritance": True,
}

# diable warnings
warnings.filterwarnings("ignore", category=UserWarning)

templates_path = ["_templates"]
exclude_patterns = []

# autodoc_mock_imports = ["torch", "torch.nn", "torch.optim", "torch_geometric"]

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

Expand Down
3 changes: 2 additions & 1 deletion l2gv2/clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import numpy as np
import numba

from network import TGraph, NPGraph
from .network.tgraph import TGraph
from .network.npgraph import NPGraph
from . import progress


Expand Down
2 changes: 1 addition & 1 deletion l2gv2/embedding/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from scipy.special import expit
import torch
from sklearn.metrics import roc_auc_score
from .network import Graph
from ..network.graph import Graph


def reconstruction_auc(coordinates, graph: Graph, dist=False, max_samples=int(1e6)):
Expand Down
2 changes: 1 addition & 1 deletion l2gv2/embedding/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import torch

from .utils import EarlyStopping
from ..utils import EarlyStopping


def lr_grid_search(
Expand Down
5 changes: 2 additions & 3 deletions l2gv2/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
embeddings of a list of patches using VGAE and Node2Vec."""

from typing import Tuple
import numpy.typing as npt
from numpy.typing import ArrayLike

from tqdm import tqdm
import torch
Expand Down Expand Up @@ -348,8 +348,7 @@ def node2vec_patch_embeddings(

def chunk_embedding(
chunk_size: int, patches: list[Patch], dim=2
) -> Tuple[npt.ArrayLike, WeightedAlignmentProblem]:

) -> Tuple[ArrayLike, WeightedAlignmentProblem]:
"""TODO: docstring for `chunk_embedding`
Note: this only works for Autonomous System dataset.
Expand Down
7 changes: 3 additions & 4 deletions l2gv2/patch/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import copy
import numpy as np
import numpy.typing as npt
from numpy.typing import ArrayLike
from l2gv2.patch.lazy import (
BaseLazyCoordinates,
LazyMeanAggregatorCoordinates,
Expand All @@ -35,11 +35,10 @@ class Patch:
index: dict[int, int]
"""mapping of node index to patch coordinate index"""

coordinates: np.ArrayLike
coordinates: ArrayLike
"""patch embedding coordinates"""


def __init__(self, nodes: iter, coordinates: npt.ArrayLike | None = None):
def __init__(self, nodes: iter, coordinates: ArrayLike | None = None):
"""Initialise a patch from a list of nodes and corresponding coordinates
Args:
Expand Down
8 changes: 4 additions & 4 deletions l2gv2/patch/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

import numba

from .clustering import Partition
from .network.tgraph import TGraph
from .network.npgraph import JitGraph, NPGraph
from .sparsify import (
from ..clustering import Partition
from ..network.tgraph import TGraph
from ..network.npgraph import JitGraph, NPGraph
from ..sparsify import (
resistance_sparsify,
relaxed_spanning_tree,
edge_sampling_sparsify,
Expand Down
2 changes: 1 addition & 1 deletion l2gv2/patch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import ilupp

from tqdm.auto import tqdm
from patch import Patch
from .patch import Patch


def random_gen(new_seed=None) -> np.random.Generator:
Expand Down
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
requires = ['setuptools>=40.8.0']
build-backend = 'setuptools.build_meta'

[tool.setuptools]

[tool.setuptools.packages.find]
where = ["."]
include = ["l2gv2", "l2gv2.patch", "l2gv2.network", "l2gv2.embedding", "l2gv2.embedding.dgi.layers", "l2gv2.embedding.dgi.models", "l2gv2.embedding.dgi.utils", "l2gv2.embedding.gae.layers", "l2gv2.embedding.gae.models", "l2gv2.embedding.gae.utils", "l2gv2.datasets"]

# project
# #######
Expand Down

0 comments on commit aa98637

Please sign in to comment.