diff --git a/prototorch/models/abstract.py b/prototorch/models/abstract.py index c6c1164..d4d8e97 100644 --- a/prototorch/models/abstract.py +++ b/prototorch/models/abstract.py @@ -3,13 +3,12 @@ import pytorch_lightning as pl import torch import torchmetrics - -from ..core.competitions import WTAC -from ..core.components import Components, LabeledComponents -from ..core.distances import euclidean_distance -from ..core.initializers import LabelsInitializer -from ..core.pooling import stratified_min_pooling -from ..nn.wrappers import LambdaLayer +from prototorch.core.competitions import WTAC +from prototorch.core.components import Components, LabeledComponents +from prototorch.core.distances import euclidean_distance +from prototorch.core.initializers import LabelsInitializer +from prototorch.core.pooling import stratified_min_pooling +from prototorch.nn.wrappers import LambdaLayer class ProtoTorchBolt(pl.LightningModule): diff --git a/prototorch/models/callbacks.py b/prototorch/models/callbacks.py index 095f41d..0037c7c 100644 --- a/prototorch/models/callbacks.py +++ b/prototorch/models/callbacks.py @@ -4,9 +4,9 @@ import logging import pytorch_lightning as pl import torch +from prototorch.core.components import Components +from prototorch.core.initializers import LiteralCompInitializer -from ..core.components import Components -from ..core.initializers import LiteralCompInitializer from .extras import ConnectionTopology diff --git a/prototorch/models/cbc.py b/prototorch/models/cbc.py index a8cba61..c94644b 100644 --- a/prototorch/models/cbc.py +++ b/prototorch/models/cbc.py @@ -1,12 +1,12 @@ import torch import torchmetrics +from prototorch.core.competitions import CBCC +from prototorch.core.components import ReasoningComponents +from prototorch.core.initializers import RandomReasoningsInitializer +from prototorch.core.losses import MarginLoss +from prototorch.core.similarities import euclidean_similarity +from prototorch.nn.wrappers import LambdaLayer -from ..core.competitions import CBCC -from ..core.components import ReasoningComponents -from ..core.initializers import RandomReasoningsInitializer -from ..core.losses import MarginLoss -from ..core.similarities import euclidean_similarity -from ..nn.wrappers import LambdaLayer from .abstract import ImagePrototypesMixin from .glvq import SiameseGLVQ diff --git a/prototorch/models/extras.py b/prototorch/models/extras.py index 644d0f1..fdd6b4b 100644 --- a/prototorch/models/extras.py +++ b/prototorch/models/extras.py @@ -5,8 +5,7 @@ Modules not yet available in prototorch go here temporarily. """ import torch - -from ..core.similarities import gaussian +from prototorch.core.similarities import gaussian def rank_scaled_gaussian(distances, lambd): diff --git a/prototorch/models/glvq.py b/prototorch/models/glvq.py index c781784..8bc0295 100644 --- a/prototorch/models/glvq.py +++ b/prototorch/models/glvq.py @@ -1,14 +1,14 @@ """Models based on the GLVQ framework.""" import torch +from prototorch.core.competitions import wtac +from prototorch.core.distances import lomega_distance, omega_distance, squared_euclidean_distance +from prototorch.core.initializers import EyeTransformInitializer +from prototorch.core.losses import GLVQLoss, lvq1_loss, lvq21_loss +from prototorch.core.transforms import LinearTransform +from prototorch.nn.wrappers import LambdaLayer, LossLayer from torch.nn.parameter import Parameter -from ..core.competitions import wtac -from ..core.distances import lomega_distance, omega_distance, squared_euclidean_distance -from ..core.initializers import EyeTransformInitializer -from ..core.losses import GLVQLoss, lvq1_loss, lvq21_loss -from ..core.transforms import LinearTransform -from ..nn.wrappers import LambdaLayer, LossLayer from .abstract import ImagePrototypesMixin, SupervisedPrototypeModel diff --git a/prototorch/models/knn.py b/prototorch/models/knn.py index 0886550..6b2077a 100644 --- a/prototorch/models/knn.py +++ b/prototorch/models/knn.py @@ -2,10 +2,11 @@ import warnings -from ..core.competitions import KNNC -from ..core.components import LabeledComponents -from ..core.initializers import LiteralCompInitializer, LiteralLabelsInitializer -from ..utils.utils import parse_data_arg +from prototorch.core.competitions import KNNC +from prototorch.core.components import LabeledComponents +from prototorch.core.initializers import LiteralCompInitializer, LiteralLabelsInitializer +from prototorch.utils.utils import parse_data_arg + from .abstract import SupervisedPrototypeModel diff --git a/prototorch/models/lvq.py b/prototorch/models/lvq.py index f398f93..7306f53 100644 --- a/prototorch/models/lvq.py +++ b/prototorch/models/lvq.py @@ -1,8 +1,9 @@ """LVQ models that are optimized using non-gradient methods.""" -from ..core.losses import _get_dp_dm -from ..nn.activations import get_activation -from ..nn.wrappers import LambdaLayer +from prototorch.core.losses import _get_dp_dm +from prototorch.nn.activations import get_activation +from prototorch.nn.wrappers import LambdaLayer + from .abstract import NonGradientMixin from .glvq import GLVQ diff --git a/prototorch/models/probabilistic.py b/prototorch/models/probabilistic.py index c00375f..fda3433 100644 --- a/prototorch/models/probabilistic.py +++ b/prototorch/models/probabilistic.py @@ -1,10 +1,10 @@ """Probabilistic GLVQ methods""" import torch +from prototorch.core.losses import nllr_loss, rslvq_loss +from prototorch.core.pooling import stratified_min_pooling, stratified_sum_pooling +from prototorch.nn.wrappers import LambdaLayer, LossLayer -from ..core.losses import nllr_loss, rslvq_loss -from ..core.pooling import stratified_min_pooling, stratified_sum_pooling -from ..nn.wrappers import LambdaLayer, LossLayer from .extras import GaussianPrior, RankScaledGaussianPrior from .glvq import GLVQ, SiameseGMLVQ diff --git a/prototorch/models/unsupervised.py b/prototorch/models/unsupervised.py index c18f033..8458f10 100644 --- a/prototorch/models/unsupervised.py +++ b/prototorch/models/unsupervised.py @@ -2,11 +2,11 @@ import numpy as np import torch +from prototorch.core.competitions import wtac +from prototorch.core.distances import squared_euclidean_distance +from prototorch.core.losses import NeuralGasEnergy +from prototorch.nn.wrappers import LambdaLayer -from ..core.competitions import wtac -from ..core.distances import squared_euclidean_distance -from ..core.losses import NeuralGasEnergy -from ..nn.wrappers import LambdaLayer from .abstract import NonGradientMixin, UnsupervisedPrototypeModel from .callbacks import GNGCallback from .extras import ConnectionTopology diff --git a/prototorch/models/vis.py b/prototorch/models/vis.py index 9744a9d..1836398 100644 --- a/prototorch/models/vis.py +++ b/prototorch/models/vis.py @@ -5,10 +5,9 @@ import pytorch_lightning as pl import torch import torchvision from matplotlib import pyplot as plt +from prototorch.utils.utils import mesh2d from torch.utils.data import DataLoader, Dataset -from ..utils.utils import mesh2d - class Vis2DAbstract(pl.Callback): def __init__(self,