Skip to content

Commit

Permalink
feat: standardize relative imports across codebase (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
WolodjaZ authored Dec 6, 2024
1 parent e39f1e4 commit 25a49f6
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 29 deletions.
8 changes: 3 additions & 5 deletions src/meteors/attr/explainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
from loguru import logger
from functools import cached_property

from captum.attr import Attribution


import torch
from captum.attr import Attribution

from meteors.models import ExplainableModel
from .attributes import HSIAttributes
from meteors import HSI
from meteors.attr import HSIAttributes
from meteors.models import ExplainableModel
from meteors.exceptions import ShapeMismatchError


Expand Down
7 changes: 4 additions & 3 deletions src/meteors/attr/input_x_gradients.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

from typing import Any


import torch
from captum.attr import InputXGradient as CaptumInputXGradient
from meteors.models import ExplainableModel

from .attributes import HSIAttributes
from .explainer import Explainer
from meteors import HSI
from meteors.attr import HSIAttributes, Explainer
from meteors.models import ExplainableModel
from meteors.exceptions import HSIAttributesError


Expand Down
8 changes: 3 additions & 5 deletions src/meteors/attr/integrated_gradients.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
import torch
from captum.attr import IntegratedGradients as CaptumIntegratedGradients

from meteors.models import ExplainableModel
from .attributes import HSIAttributes
from .explainer import Explainer, validate_and_transform_baseline
from meteors import HSI
from meteors.attr import HSIAttributes, Explainer

from meteors.attr.explainer import validate_and_transform_baseline

from meteors.models import ExplainableModel
from meteors.exceptions import HSIAttributesError


Expand Down
7 changes: 3 additions & 4 deletions src/meteors/attr/lime.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
import spyndex


from .attributes import HSISpatialAttributes, HSISpectralAttributes, ensure_torch_tensor
from .explainer import Explainer
from .lime_base import Lime as LimeBase
from meteors import HSI
from meteors.attr.lime_base import Lime as LimeBase
from meteors.models import ExplainableModel, InterpretableModel, SkLearnLasso
from meteors.utils import torch_dtype_to_python_dtype, change_dtype_of_list, expand_spectral_mask
from meteors.attr import Explainer
from meteors.attr import HSISpatialAttributes, HSISpectralAttributes
from meteors.attr.attributes import ensure_torch_tensor
from meteors.exceptions import (
ShapeMismatchError,
BandSelectionError,
Expand Down
5 changes: 2 additions & 3 deletions src/meteors/attr/noise_tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@

import torch

from meteors.attr import Explainer, HSIAttributes
from meteors.attr.explainer import validate_and_transform_baseline
from .attributes import HSIAttributes
from .explainer import Explainer, validate_and_transform_baseline
from meteors import HSI
from meteors.models import ExplainableModel

from meteors.exceptions import HSIAttributesError, ShapeMismatchError


Expand Down
9 changes: 3 additions & 6 deletions src/meteors/attr/occlusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
import torch
from captum.attr import Occlusion as CaptumOcclusion

from meteors.models import ExplainableModel
from .attributes import HSIAttributes, HSISpatialAttributes, HSISpectralAttributes
from .explainer import Explainer, validate_and_transform_baseline
from meteors import HSI
from meteors.attr import HSIAttributes, HSISpatialAttributes, HSISpectralAttributes
from meteors.attr import Explainer
from meteors.attr.explainer import validate_and_transform_baseline


from meteors.models import ExplainableModel
from meteors.exceptions import HSIAttributesError


Expand Down
6 changes: 3 additions & 3 deletions src/meteors/attr/saliency.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import torch
from captum.attr import Saliency as CaptumSaliency

from meteors.models import ExplainableModel
from .attributes import HSIAttributes
from .explainer import Explainer
from meteors import HSI
from meteors.attr import HSIAttributes, Explainer

from meteors.models import ExplainableModel
from meteors.exceptions import HSIAttributesError

## VALIDATORS
Expand Down

0 comments on commit 25a49f6

Please sign in to comment.