Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 13, 2022
1 parent 89fe4fa commit 6652c55
Show file tree
Hide file tree
Showing 24 changed files with 171 additions and 171 deletions.
26 changes: 13 additions & 13 deletions src/torchmetrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging as __logging
import os

from torchmetrics.__about__ import * # noqa: F401, F403
from torchmetrics.__about__ import *

_logger = __logging.getLogger("torchmetrics")
_logger.addHandler(__logging.StreamHandler())
Expand All @@ -11,16 +11,16 @@
_PACKAGE_ROOT = os.path.dirname(__file__)
_PROJECT_ROOT = os.path.dirname(_PACKAGE_ROOT)

from torchmetrics import functional # noqa: E402
from torchmetrics.aggregation import CatMetric, MaxMetric, MeanMetric, MinMetric, SumMetric # noqa: E402
from torchmetrics.audio import ( # noqa: E402
from torchmetrics import functional
from torchmetrics.aggregation import CatMetric, MaxMetric, MeanMetric, MinMetric, SumMetric
from torchmetrics.audio import (
PermutationInvariantTraining,
ScaleInvariantSignalDistortionRatio,
ScaleInvariantSignalNoiseRatio,
SignalDistortionRatio,
SignalNoiseRatio,
)
from torchmetrics.classification import ( # noqa: E402
from torchmetrics.classification import (
AUROC,
ROC,
Accuracy,
Expand All @@ -42,8 +42,8 @@
Specificity,
StatScores,
)
from torchmetrics.collections import MetricCollection # noqa: E402
from torchmetrics.image import ( # noqa: E402
from torchmetrics.collections import MetricCollection
from torchmetrics.image import (
ErrorRelativeGlobalDimensionlessSynthesis,
MultiScaleStructuralSimilarityIndexMeasure,
PeakSignalNoiseRatio,
Expand All @@ -53,9 +53,9 @@
TotalVariation,
UniversalImageQualityIndex,
)
from torchmetrics.metric import Metric # noqa: E402
from torchmetrics.nominal import CramersV, PearsonsContingencyCoefficient, TheilsU, TschuprowsT # noqa: E402
from torchmetrics.regression import ( # noqa: E402
from torchmetrics.metric import Metric
from torchmetrics.nominal import CramersV, PearsonsContingencyCoefficient, TheilsU, TschuprowsT
from torchmetrics.regression import (
ConcordanceCorrCoef,
CosineSimilarity,
ExplainedVariance,
Expand All @@ -73,7 +73,7 @@
TweedieDevianceScore,
WeightedMeanAbsolutePercentageError,
)
from torchmetrics.retrieval import ( # noqa: E402
from torchmetrics.retrieval import (
RetrievalFallOut,
RetrievalHitRate,
RetrievalMAP,
Expand All @@ -85,7 +85,7 @@
RetrievalRecallAtFixedPrecision,
RetrievalRPrecision,
)
from torchmetrics.text import ( # noqa: E402
from torchmetrics.text import (
BLEUScore,
CharErrorRate,
CHRFScore,
Expand All @@ -99,7 +99,7 @@
WordInfoLost,
WordInfoPreserved,
)
from torchmetrics.wrappers import ( # noqa: E402
from torchmetrics.wrappers import (
BootStrapper,
ClasswiseWrapper,
MetricTracker,
Expand Down
10 changes: 5 additions & 5 deletions src/torchmetrics/audio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from torchmetrics.audio.pit import PermutationInvariantTraining # noqa: F401
from torchmetrics.audio.sdr import ScaleInvariantSignalDistortionRatio, SignalDistortionRatio # noqa: F401
from torchmetrics.audio.snr import ScaleInvariantSignalNoiseRatio, SignalNoiseRatio # noqa: F401
from torchmetrics.audio.pit import PermutationInvariantTraining
from torchmetrics.audio.sdr import ScaleInvariantSignalDistortionRatio, SignalDistortionRatio
from torchmetrics.audio.snr import ScaleInvariantSignalNoiseRatio, SignalNoiseRatio
from torchmetrics.utilities.imports import _PESQ_AVAILABLE, _PYSTOI_AVAILABLE

if _PESQ_AVAILABLE:
from torchmetrics.audio.pesq import PerceptualEvaluationSpeechQuality # noqa: F401
from torchmetrics.audio.pesq import PerceptualEvaluationSpeechQuality

if _PYSTOI_AVAILABLE:
from torchmetrics.audio.stoi import ShortTimeObjectiveIntelligibility # noqa: F401
from torchmetrics.audio.stoi import ShortTimeObjectiveIntelligibility
2 changes: 1 addition & 1 deletion src/torchmetrics/detection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
from torchmetrics.utilities.imports import _TORCHVISION_GREATER_EQUAL_0_8

if _TORCHVISION_GREATER_EQUAL_0_8:
from torchmetrics.detection.mean_ap import MeanAveragePrecision # noqa: F401
from torchmetrics.detection.mean_ap import MeanAveragePrecision
2 changes: 1 addition & 1 deletion src/torchmetrics/detection/mean_ap.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ def __calculate_recall_precision_scores(
det_matches = torch.cat([e["dtMatches"][:, :max_det] for e in img_eval_cls_bbox], axis=1)[:, inds]
det_ignore = torch.cat([e["dtIgnore"][:, :max_det] for e in img_eval_cls_bbox], axis=1)[:, inds]
gt_ignore = torch.cat([e["gtIgnore"] for e in img_eval_cls_bbox])
npig = torch.count_nonzero(gt_ignore == False) # noqa: E712
npig = torch.count_nonzero(gt_ignore == False)
if npig == 0:
return recall, precision, scores
tps = torch.logical_and(det_matches, torch.logical_not(det_ignore))
Expand Down
4 changes: 2 additions & 2 deletions src/torchmetrics/functional/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
from torchmetrics.utilities.imports import _TRANSFORMERS_AVAILABLE

if _TRANSFORMERS_AVAILABLE:
from torchmetrics.functional.text.bert import bert_score # noqa: F401
from torchmetrics.functional.text.infolm import infolm # noqa: F401
from torchmetrics.functional.text.bert import bert_score
from torchmetrics.functional.text.infolm import infolm

__all__ = [
"accuracy",
Expand Down
10 changes: 5 additions & 5 deletions src/torchmetrics/functional/audio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from torchmetrics.functional.audio.pit import permutation_invariant_training, pit_permutate # noqa: F401
from torchmetrics.functional.audio.sdr import ( # noqa: F401
from torchmetrics.functional.audio.pit import permutation_invariant_training, pit_permutate
from torchmetrics.functional.audio.sdr import (
scale_invariant_signal_distortion_ratio,
signal_distortion_ratio,
)
from torchmetrics.functional.audio.snr import scale_invariant_signal_noise_ratio, signal_noise_ratio # noqa: F401
from torchmetrics.functional.audio.snr import scale_invariant_signal_noise_ratio, signal_noise_ratio
from torchmetrics.utilities.imports import _PESQ_AVAILABLE, _PYSTOI_AVAILABLE

if _PESQ_AVAILABLE:
from torchmetrics.functional.audio.pesq import perceptual_evaluation_speech_quality # noqa: F401
from torchmetrics.functional.audio.pesq import perceptual_evaluation_speech_quality

if _PYSTOI_AVAILABLE:
from torchmetrics.functional.audio.stoi import short_time_objective_intelligibility # noqa: F401
from torchmetrics.functional.audio.stoi import short_time_objective_intelligibility
40 changes: 20 additions & 20 deletions src/torchmetrics/functional/classification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,47 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from torchmetrics.functional.classification.accuracy import ( # noqa: F401
from torchmetrics.functional.classification.accuracy import (
accuracy,
binary_accuracy,
multiclass_accuracy,
multilabel_accuracy,
)
from torchmetrics.functional.classification.auroc import ( # noqa: F401
from torchmetrics.functional.classification.auroc import (
auroc,
binary_auroc,
multiclass_auroc,
multilabel_auroc,
)
from torchmetrics.functional.classification.average_precision import ( # noqa: F401
from torchmetrics.functional.classification.average_precision import (
average_precision,
binary_average_precision,
multiclass_average_precision,
multilabel_average_precision,
)
from torchmetrics.functional.classification.calibration_error import ( # noqa: F401
from torchmetrics.functional.classification.calibration_error import (
binary_calibration_error,
calibration_error,
multiclass_calibration_error,
)
from torchmetrics.functional.classification.cohen_kappa import ( # noqa: F401
from torchmetrics.functional.classification.cohen_kappa import (
binary_cohen_kappa,
cohen_kappa,
multiclass_cohen_kappa,
)
from torchmetrics.functional.classification.confusion_matrix import ( # noqa: F401
from torchmetrics.functional.classification.confusion_matrix import (
binary_confusion_matrix,
confusion_matrix,
multiclass_confusion_matrix,
multilabel_confusion_matrix,
)
from torchmetrics.functional.classification.dice import dice # noqa: F401
from torchmetrics.functional.classification.exact_match import ( # noqa: F401
from torchmetrics.functional.classification.dice import dice
from torchmetrics.functional.classification.exact_match import (
exact_match,
multiclass_exact_match,
multilabel_exact_match,
)
from torchmetrics.functional.classification.f_beta import ( # noqa: F401
from torchmetrics.functional.classification.f_beta import (
binary_f1_score,
binary_fbeta_score,
f1_score,
Expand All @@ -61,30 +61,30 @@
multilabel_f1_score,
multilabel_fbeta_score,
)
from torchmetrics.functional.classification.hamming import ( # noqa: F401
from torchmetrics.functional.classification.hamming import (
binary_hamming_distance,
hamming_distance,
multiclass_hamming_distance,
multilabel_hamming_distance,
)
from torchmetrics.functional.classification.hinge import ( # noqa: F401
from torchmetrics.functional.classification.hinge import (
binary_hinge_loss,
hinge_loss,
multiclass_hinge_loss,
)
from torchmetrics.functional.classification.jaccard import ( # noqa: F401
from torchmetrics.functional.classification.jaccard import (
binary_jaccard_index,
jaccard_index,
multiclass_jaccard_index,
multilabel_jaccard_index,
)
from torchmetrics.functional.classification.matthews_corrcoef import ( # noqa: F401
from torchmetrics.functional.classification.matthews_corrcoef import (
binary_matthews_corrcoef,
matthews_corrcoef,
multiclass_matthews_corrcoef,
multilabel_matthews_corrcoef,
)
from torchmetrics.functional.classification.precision_recall import ( # noqa: F401
from torchmetrics.functional.classification.precision_recall import (
binary_precision,
binary_recall,
multiclass_precision,
Expand All @@ -94,30 +94,30 @@
precision,
recall,
)
from torchmetrics.functional.classification.precision_recall_curve import ( # noqa: F401
from torchmetrics.functional.classification.precision_recall_curve import (
binary_precision_recall_curve,
multiclass_precision_recall_curve,
multilabel_precision_recall_curve,
precision_recall_curve,
)
from torchmetrics.functional.classification.ranking import ( # noqa: F401
from torchmetrics.functional.classification.ranking import (
multilabel_coverage_error,
multilabel_ranking_average_precision,
multilabel_ranking_loss,
)
from torchmetrics.functional.classification.recall_at_fixed_precision import ( # noqa: F401
from torchmetrics.functional.classification.recall_at_fixed_precision import (
binary_recall_at_fixed_precision,
multiclass_recall_at_fixed_precision,
multilabel_recall_at_fixed_precision,
)
from torchmetrics.functional.classification.roc import binary_roc, multiclass_roc, multilabel_roc, roc # noqa: F401
from torchmetrics.functional.classification.specificity import ( # noqa: F401
from torchmetrics.functional.classification.roc import binary_roc, multiclass_roc, multilabel_roc, roc
from torchmetrics.functional.classification.specificity import (
binary_specificity,
multiclass_specificity,
multilabel_specificity,
specificity,
)
from torchmetrics.functional.classification.stat_scores import ( # noqa: F401
from torchmetrics.functional.classification.stat_scores import (
binary_stat_scores,
multiclass_stat_scores,
multilabel_stat_scores,
Expand Down
16 changes: 8 additions & 8 deletions src/torchmetrics/functional/image/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from torchmetrics.functional.image.d_lambda import spectral_distortion_index # noqa: F401
from torchmetrics.functional.image.ergas import error_relative_global_dimensionless_synthesis # noqa: F401
from torchmetrics.functional.image.gradients import image_gradients # noqa: F401
from torchmetrics.functional.image.psnr import peak_signal_noise_ratio # noqa: F401
from torchmetrics.functional.image.sam import spectral_angle_mapper # noqa: F401
from torchmetrics.functional.image.ssim import ( # noqa: F401
from torchmetrics.functional.image.d_lambda import spectral_distortion_index
from torchmetrics.functional.image.ergas import error_relative_global_dimensionless_synthesis
from torchmetrics.functional.image.gradients import image_gradients
from torchmetrics.functional.image.psnr import peak_signal_noise_ratio
from torchmetrics.functional.image.sam import spectral_angle_mapper
from torchmetrics.functional.image.ssim import (
multiscale_structural_similarity_index_measure,
structural_similarity_index_measure,
)
from torchmetrics.functional.image.tv import total_variation # noqa: F401
from torchmetrics.functional.image.uqi import universal_image_quality_index # noqa: F401
from torchmetrics.functional.image.tv import total_variation
from torchmetrics.functional.image.uqi import universal_image_quality_index
2 changes: 1 addition & 1 deletion src/torchmetrics/functional/multimodal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
from torchmetrics.utilities.imports import _TRANSFORMERS_AVAILABLE

if _TRANSFORMERS_AVAILABLE:
from torchmetrics.functional.multimodal.clip_score import clip_score # noqa: F401
from torchmetrics.functional.multimodal.clip_score import clip_score
8 changes: 4 additions & 4 deletions src/torchmetrics/functional/nominal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from torchmetrics.functional.nominal.cramers import cramers_v, cramers_v_matrix # noqa: F401
from torchmetrics.functional.nominal.pearson import ( # noqa: F401
from torchmetrics.functional.nominal.cramers import cramers_v, cramers_v_matrix
from torchmetrics.functional.nominal.pearson import (
pearsons_contingency_coefficient,
pearsons_contingency_coefficient_matrix,
)
from torchmetrics.functional.nominal.theils_u import theils_u, theils_u_matrix # noqa: F401
from torchmetrics.functional.nominal.tschuprows import tschuprows_t, tschuprows_t_matrix # noqa: F401
from torchmetrics.functional.nominal.theils_u import theils_u, theils_u_matrix
from torchmetrics.functional.nominal.tschuprows import tschuprows_t, tschuprows_t_matrix
8 changes: 4 additions & 4 deletions src/torchmetrics/functional/pairwise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from torchmetrics.functional.pairwise.cosine import pairwise_cosine_similarity # noqa: F401
from torchmetrics.functional.pairwise.euclidean import pairwise_euclidean_distance # noqa: F401
from torchmetrics.functional.pairwise.linear import pairwise_linear_similarity # noqa: F401
from torchmetrics.functional.pairwise.manhattan import pairwise_manhattan_distance # noqa: F401
from torchmetrics.functional.pairwise.cosine import pairwise_cosine_similarity
from torchmetrics.functional.pairwise.euclidean import pairwise_euclidean_distance
from torchmetrics.functional.pairwise.linear import pairwise_linear_similarity
from torchmetrics.functional.pairwise.manhattan import pairwise_manhattan_distance
30 changes: 15 additions & 15 deletions src/torchmetrics/functional/regression/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from torchmetrics.functional.regression.concordance import concordance_corrcoef # 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.kendall import kendall_rank_corrcoef # noqa: F401
from torchmetrics.functional.regression.kl_divergence import kl_divergence # noqa: F401
from torchmetrics.functional.regression.log_cosh import log_cosh_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
from torchmetrics.functional.regression.tweedie_deviance import tweedie_deviance_score # noqa: F401
from torchmetrics.functional.regression.wmape import weighted_mean_absolute_percentage_error # noqa: F401
from torchmetrics.functional.regression.concordance import concordance_corrcoef
from torchmetrics.functional.regression.cosine_similarity import cosine_similarity
from torchmetrics.functional.regression.explained_variance import explained_variance
from torchmetrics.functional.regression.kendall import kendall_rank_corrcoef
from torchmetrics.functional.regression.kl_divergence import kl_divergence
from torchmetrics.functional.regression.log_cosh import log_cosh_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.tweedie_deviance import tweedie_deviance_score
from torchmetrics.functional.regression.wmape import weighted_mean_absolute_percentage_error
18 changes: 9 additions & 9 deletions src/torchmetrics/functional/retrieval/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from torchmetrics.functional.retrieval.average_precision import retrieval_average_precision # noqa: F401
from torchmetrics.functional.retrieval.fall_out import retrieval_fall_out # noqa: F401
from torchmetrics.functional.retrieval.hit_rate import retrieval_hit_rate # noqa: F401
from torchmetrics.functional.retrieval.ndcg import retrieval_normalized_dcg # noqa: F401
from torchmetrics.functional.retrieval.precision import retrieval_precision # noqa: F401
from torchmetrics.functional.retrieval.precision_recall_curve import retrieval_precision_recall_curve # noqa: F401
from torchmetrics.functional.retrieval.r_precision import retrieval_r_precision # noqa: F401
from torchmetrics.functional.retrieval.recall import retrieval_recall # noqa: F401
from torchmetrics.functional.retrieval.reciprocal_rank import retrieval_reciprocal_rank # noqa: F401
from torchmetrics.functional.retrieval.average_precision import retrieval_average_precision
from torchmetrics.functional.retrieval.fall_out import retrieval_fall_out
from torchmetrics.functional.retrieval.hit_rate import retrieval_hit_rate
from torchmetrics.functional.retrieval.ndcg import retrieval_normalized_dcg
from torchmetrics.functional.retrieval.precision import retrieval_precision
from torchmetrics.functional.retrieval.precision_recall_curve import retrieval_precision_recall_curve
from torchmetrics.functional.retrieval.r_precision import retrieval_r_precision
from torchmetrics.functional.retrieval.recall import retrieval_recall
from torchmetrics.functional.retrieval.reciprocal_rank import retrieval_reciprocal_rank
Loading

0 comments on commit 6652c55

Please sign in to comment.