Skip to content

Commit

Permalink
simplify regression modules (#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda authored Jan 12, 2022
1 parent 9e46bd6 commit 4c87069
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 42 deletions.
6 changes: 2 additions & 4 deletions tests/regression/test_mean_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,14 @@
mean_squared_error,
mean_squared_log_error,
)
from torchmetrics.functional.regression.symmetric_mean_absolute_percentage_error import (
symmetric_mean_absolute_percentage_error,
)
from torchmetrics.functional.regression.symmetric_mape import symmetric_mean_absolute_percentage_error
from torchmetrics.regression import (
MeanAbsoluteError,
MeanAbsolutePercentageError,
MeanSquaredError,
MeanSquaredLogError,
)
from torchmetrics.regression.symmetric_mean_absolute_percentage_error import SymmetricMeanAbsolutePercentageError
from torchmetrics.regression.symmetric_mape import SymmetricMeanAbsolutePercentageError
from torchmetrics.utilities.imports import _TORCH_GREATER_EQUAL_1_6

seed_all(42)
Expand Down
2 changes: 1 addition & 1 deletion torchmetrics/classification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from torchmetrics.classification.cohen_kappa import CohenKappa # noqa: F401
from torchmetrics.classification.confusion_matrix import ConfusionMatrix # noqa: F401
from torchmetrics.classification.f_beta import F1, F1Score, FBeta, FBetaScore # noqa: F401
from torchmetrics.classification.hamming_distance import HammingDistance # noqa: F401
from torchmetrics.classification.hamming import HammingDistance # noqa: F401
from torchmetrics.classification.hinge import Hinge, HingeLoss # noqa: F401
from torchmetrics.classification.iou import IoU # noqa: F401
from torchmetrics.classification.jaccard import JaccardIndex # noqa: F401
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import torch
from torch import Tensor, tensor

from torchmetrics.functional.classification.hamming_distance import _hamming_distance_compute, _hamming_distance_update
from torchmetrics.functional.classification.hamming import _hamming_distance_compute, _hamming_distance_update
from torchmetrics.metric import Metric


Expand Down
14 changes: 6 additions & 8 deletions torchmetrics/functional/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from torchmetrics.functional.classification.confusion_matrix import confusion_matrix
from torchmetrics.functional.classification.dice import dice_score
from torchmetrics.functional.classification.f_beta import f1, f1_score, fbeta, fbeta_score
from torchmetrics.functional.classification.hamming_distance import hamming_distance
from torchmetrics.functional.classification.hamming import hamming_distance
from torchmetrics.functional.classification.hinge import hinge, hinge_loss
from torchmetrics.functional.classification.iou import iou # noqa: F401
from torchmetrics.functional.classification.jaccard import jaccard_index
Expand All @@ -47,16 +47,14 @@
from torchmetrics.functional.pairwise.manhatten import pairwise_manhatten_distance
from torchmetrics.functional.regression.cosine_similarity import cosine_similarity
from torchmetrics.functional.regression.explained_variance import explained_variance
from torchmetrics.functional.regression.mean_absolute_error import mean_absolute_error
from torchmetrics.functional.regression.mean_absolute_percentage_error import mean_absolute_percentage_error
from torchmetrics.functional.regression.mean_squared_error import mean_squared_error
from torchmetrics.functional.regression.mean_squared_log_error import mean_squared_log_error
from torchmetrics.functional.regression.log_mse import mean_squared_log_error
from torchmetrics.functional.regression.mae import mean_absolute_error
from torchmetrics.functional.regression.mape import mean_absolute_percentage_error
from torchmetrics.functional.regression.mse import mean_squared_error
from torchmetrics.functional.regression.pearson import pearson_corrcoef
from torchmetrics.functional.regression.r2 import r2_score
from torchmetrics.functional.regression.spearman import spearman_corrcoef
from torchmetrics.functional.regression.symmetric_mean_absolute_percentage_error import (
symmetric_mean_absolute_percentage_error,
)
from torchmetrics.functional.regression.symmetric_mape import symmetric_mean_absolute_percentage_error
from torchmetrics.functional.regression.tweedie_deviance import tweedie_deviance_score
from torchmetrics.functional.retrieval.average_precision import retrieval_average_precision
from torchmetrics.functional.retrieval.fall_out import retrieval_fall_out
Expand Down
2 changes: 1 addition & 1 deletion torchmetrics/functional/classification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from torchmetrics.functional.classification.confusion_matrix import confusion_matrix # noqa: F401
from torchmetrics.functional.classification.dice import dice_score # noqa: F401
from torchmetrics.functional.classification.f_beta import f1, f1_score, fbeta, fbeta_score # noqa: F401
from torchmetrics.functional.classification.hamming_distance import hamming_distance # noqa: F401
from torchmetrics.functional.classification.hamming import hamming_distance # noqa: F401
from torchmetrics.functional.classification.hinge import hinge, hinge_loss # noqa: F401
from torchmetrics.functional.classification.jaccard import jaccard_index # noqa: F401
from torchmetrics.functional.classification.kl_divergence import kl_divergence # noqa: F401
Expand Down
10 changes: 4 additions & 6 deletions torchmetrics/functional/regression/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@
from torchmetrics.functional.image.ssim import ssim # noqa: F401
from torchmetrics.functional.regression.cosine_similarity import cosine_similarity # noqa: F401
from torchmetrics.functional.regression.explained_variance import explained_variance # noqa: F401
from torchmetrics.functional.regression.mean_absolute_error import mean_absolute_error # noqa: F401
from torchmetrics.functional.regression.mean_absolute_percentage_error import ( # noqa: F401
mean_absolute_percentage_error,
)
from torchmetrics.functional.regression.mean_squared_error import mean_squared_error # noqa: F401
from torchmetrics.functional.regression.mean_squared_log_error import mean_squared_log_error # noqa: F401
from torchmetrics.functional.regression.log_mse import mean_squared_log_error # noqa: F401
from torchmetrics.functional.regression.mae import mean_absolute_error # noqa: F401
from torchmetrics.functional.regression.mape import mean_absolute_percentage_error # noqa: F401
from torchmetrics.functional.regression.mse import mean_squared_error # noqa: F401
from torchmetrics.functional.regression.pearson import pearson_corrcoef # noqa: F401
from torchmetrics.functional.regression.r2 import r2_score # noqa: F401
from torchmetrics.functional.regression.spearman import spearman_corrcoef # noqa: F401
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 5 additions & 7 deletions torchmetrics/regression/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
# limitations under the License.
from torchmetrics.regression.cosine_similarity import CosineSimilarity # noqa: F401
from torchmetrics.regression.explained_variance import ExplainedVariance # noqa: F401
from torchmetrics.regression.mean_absolute_error import MeanAbsoluteError # noqa: F401
from torchmetrics.regression.mean_absolute_percentage_error import MeanAbsolutePercentageError # noqa: F401
from torchmetrics.regression.mean_squared_error import MeanSquaredError # noqa: F401
from torchmetrics.regression.mean_squared_log_error import MeanSquaredLogError # noqa: F401
from torchmetrics.regression.log_mse import MeanSquaredLogError # noqa: F401
from torchmetrics.regression.mae import MeanAbsoluteError # noqa: F401
from torchmetrics.regression.mape import MeanAbsolutePercentageError # noqa: F401
from torchmetrics.regression.mse import MeanSquaredError # noqa: F401
from torchmetrics.regression.pearson import PearsonCorrCoef, PearsonCorrcoef # noqa: F401
from torchmetrics.regression.r2 import R2Score # noqa: F401
from torchmetrics.regression.spearman import SpearmanCorrCoef, SpearmanCorrcoef # noqa: F401
from torchmetrics.regression.symmetric_mean_absolute_percentage_error import ( # noqa: F401
SymmetricMeanAbsolutePercentageError,
)
from torchmetrics.regression.symmetric_mape import SymmetricMeanAbsolutePercentageError # noqa: F401
from torchmetrics.regression.tweedie_deviance import TweedieDevianceScore # noqa: F401
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
import torch
from torch import Tensor, tensor

from torchmetrics.functional.regression.mean_squared_log_error import (
_mean_squared_log_error_compute,
_mean_squared_log_error_update,
)
from torchmetrics.functional.regression.log_mse import _mean_squared_log_error_compute, _mean_squared_log_error_update
from torchmetrics.metric import Metric


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
import torch
from torch import Tensor, tensor

from torchmetrics.functional.regression.mean_absolute_error import (
_mean_absolute_error_compute,
_mean_absolute_error_update,
)
from torchmetrics.functional.regression.mae import _mean_absolute_error_compute, _mean_absolute_error_update
from torchmetrics.metric import Metric


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import torch
from torch import Tensor, tensor

from torchmetrics.functional.regression.mean_absolute_percentage_error import (
from torchmetrics.functional.regression.mape import (
_mean_absolute_percentage_error_compute,
_mean_absolute_percentage_error_update,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
import torch
from torch import Tensor, tensor

from torchmetrics.functional.regression.mean_squared_error import (
_mean_squared_error_compute,
_mean_squared_error_update,
)
from torchmetrics.functional.regression.mse import _mean_squared_error_compute, _mean_squared_error_update
from torchmetrics.metric import Metric


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import torch
from torch import Tensor, tensor

from torchmetrics.functional.regression.symmetric_mean_absolute_percentage_error import (
from torchmetrics.functional.regression.symmetric_mape import (
_symmetric_mean_absolute_percentage_error_compute,
_symmetric_mean_absolute_percentage_error_update,
)
Expand Down

0 comments on commit 4c87069

Please sign in to comment.