Skip to content

Commit

Permalink
Newmetric: NRMSE (#2442)
Browse files Browse the repository at this point in the history
  • Loading branch information
SkafteNicki authored Oct 22, 2024
1 parent 46978fc commit 02f050a
Show file tree
Hide file tree
Showing 15 changed files with 621 additions and 55 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

-
- Added `NormalizedRootMeanSquaredError` metric to regression subpackage ([#2442](https://github.com/Lightning-AI/torchmetrics/pull/2442))


### Changed
Expand Down
3 changes: 3 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ def linkcode_resolve(domain, info) -> Optional[str]: # noqa: ANN001
"https://aclanthology.org/W17-4770",
# A wavelet transform method to merge Landsat TM and SPOT panchromatic data
"https://www.ingentaconnect.com/content/tandf/tres/1998/00000019/00000004/art00013",
# Improved normalization of time-lapse seismic data using normalized root mean square repeatability data ...
# ... to improve automatic production and seismic history matching in the Nelson field
"https://onlinelibrary.wiley.com/doi/abs/10.1111/1365-2478.12109",
# todo: these links seems to be unstable, referring to .devcontainer
"https://code.visualstudio.com",
"https://code.visualstudio.com/.*",
Expand Down
1 change: 1 addition & 0 deletions docs/source/links.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
.. _FLORES-200: https://arxiv.org/abs/2207.04672
.. _averaging curve objects: https://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html
.. _SCC: https://www.ingentaconnect.com/content/tandf/tres/1998/00000019/00000004/art00013
.. _Normalized Root Mean Squared Error: https://onlinelibrary.wiley.com/doi/abs/10.1111/1365-2478.12109
.. _Generalized Dice Score: https://arxiv.org/abs/1707.03237
.. _Hausdorff Distance: https://en.wikipedia.org/wiki/Hausdorff_distance
.. _averaging curve objects: https://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html
Expand Down
21 changes: 21 additions & 0 deletions docs/source/regression/normalized_root_mean_squared_error.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.. customcarditem::
:header: Normalized Root Mean Squared Error (NRMSE)
:image: https://pl-flash-data.s3.amazonaws.com/assets/thumbnails/tabular_classification.svg
:tags: Regression

.. include:: ../links.rst

##########################################
Normalized Root Mean Squared Error (NRMSE)
##########################################

Module Interface
________________

.. autoclass:: torchmetrics.NormalizedRootMeanSquaredError
:exclude-members: update, compute

Functional Interface
____________________

.. autofunction:: torchmetrics.functional.normalized_root_mean_squared_error
1 change: 1 addition & 0 deletions requirements/_devel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
-r classification_test.txt
-r nominal_test.txt
-r segmentation_test.txt
-r regression_test.txt
1 change: 1 addition & 0 deletions requirements/regression_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
permetrics==2.0.0
36 changes: 19 additions & 17 deletions src/torchmetrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
MeanSquaredError,
MeanSquaredLogError,
MinkowskiDistance,
NormalizedRootMeanSquaredError,
PearsonCorrCoef,
R2Score,
RelativeSquaredError,
Expand Down Expand Up @@ -158,25 +159,23 @@
)

__all__ = [
"functional",
"Accuracy",
"AUROC",
"Accuracy",
"AveragePrecision",
"BLEUScore",
"BootStrapper",
"CHRFScore",
"CalibrationError",
"CatMetric",
"ClasswiseWrapper",
"CharErrorRate",
"CHRFScore",
"ConcordanceCorrCoef",
"ClasswiseWrapper",
"CohenKappa",
"ConcordanceCorrCoef",
"ConfusionMatrix",
"CosineSimilarity",
"CramersV",
"CriticalSuccessIndex",
"Dice",
"TweedieDevianceScore",
"ErrorRelativeGlobalDimensionlessSynthesis",
"ExactMatch",
"ExplainedVariance",
Expand All @@ -187,8 +186,8 @@
"HammingDistance",
"HingeLoss",
"JaccardIndex",
"KendallRankCorrCoef",
"KLDivergence",
"KendallRankCorrCoef",
"LogCoshError",
"MatchErrorRate",
"MatthewsCorrCoef",
Expand All @@ -201,23 +200,25 @@
"Metric",
"MetricCollection",
"MetricTracker",
"MinkowskiDistance",
"MinMaxMetric",
"MinMetric",
"MinkowskiDistance",
"ModifiedPanopticQuality",
"MultiScaleStructuralSimilarityIndexMeasure",
"MultioutputWrapper",
"MultitaskWrapper",
"MultiScaleStructuralSimilarityIndexMeasure",
"NormalizedRootMeanSquaredError",
"PanopticQuality",
"PeakSignalNoiseRatio",
"PearsonCorrCoef",
"PearsonsContingencyCoefficient",
"PermutationInvariantTraining",
"Perplexity",
"Precision",
"PrecisionAtFixedRecall",
"PrecisionRecallCurve",
"PeakSignalNoiseRatio",
"R2Score",
"ROC",
"Recall",
"RecallAtFixedPrecision",
"RelativeAverageSpectralError",
Expand All @@ -228,37 +229,38 @@
"RetrievalMRR",
"RetrievalNormalizedDCG",
"RetrievalPrecision",
"RetrievalRecall",
"RetrievalRPrecision",
"RetrievalPrecisionRecallCurve",
"RetrievalRPrecision",
"RetrievalRecall",
"RetrievalRecallAtFixedPrecision",
"ROC",
"RootMeanSquaredErrorUsingSlidingWindow",
"RunningMean",
"RunningSum",
"SQuAD",
"SacreBLEUScore",
"SignalDistortionRatio",
"ScaleInvariantSignalDistortionRatio",
"ScaleInvariantSignalNoiseRatio",
"SensitivityAtSpecificity",
"SignalDistortionRatio",
"SignalNoiseRatio",
"SpearmanCorrCoef",
"Specificity",
"SpecificityAtSensitivity",
"SensitivityAtSpecificity",
"SpectralAngleMapper",
"SpectralDistortionIndex",
"SQuAD",
"StructuralSimilarityIndexMeasure",
"StatScores",
"StructuralSimilarityIndexMeasure",
"SumMetric",
"SymmetricMeanAbsolutePercentageError",
"TheilsU",
"TotalVariation",
"TranslationEditRate",
"TschuprowsT",
"TweedieDevianceScore",
"UniversalImageQualityIndex",
"WeightedMeanAbsolutePercentageError",
"WordErrorRate",
"WordInfoLost",
"WordInfoPreserved",
"functional",
]
24 changes: 13 additions & 11 deletions src/torchmetrics/functional/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
mean_squared_error,
mean_squared_log_error,
minkowski_distance,
normalized_root_mean_squared_error,
pearson_corrcoef,
r2_score,
relative_squared_error,
Expand Down Expand Up @@ -146,14 +147,13 @@
"calibration_error",
"char_error_rate",
"chrf_score",
"concordance_corrcoef",
"cohen_kappa",
"concordance_corrcoef",
"confusion_matrix",
"cosine_similarity",
"cramers_v",
"cramers_v_matrix",
"critical_success_index",
"tweedie_deviance_score",
"dice",
"error_relative_global_dimensionless_synthesis",
"exact_match",
Expand All @@ -177,63 +177,65 @@
"mean_squared_log_error",
"minkowski_distance",
"multiscale_structural_similarity_index_measure",
"normalized_root_mean_squared_error",
"pairwise_cosine_similarity",
"pairwise_euclidean_distance",
"pairwise_linear_similarity",
"pairwise_manhattan_distance",
"pairwise_minkowski_distance",
"panoptic_quality",
"peak_signal_noise_ratio",
"pearson_corrcoef",
"pearsons_contingency_coefficient",
"pearsons_contingency_coefficient_matrix",
"permutation_invariant_training",
"perplexity",
"pit_permutate",
"precision",
"precision_at_fixed_recall",
"precision_recall_curve",
"peak_signal_noise_ratio",
"r2_score",
"recall",
"recall_at_fixed_precision",
"relative_average_spectral_error",
"relative_squared_error",
"retrieval_average_precision",
"retrieval_fall_out",
"retrieval_hit_rate",
"retrieval_normalized_dcg",
"retrieval_precision",
"retrieval_precision_recall_curve",
"retrieval_r_precision",
"retrieval_recall",
"retrieval_reciprocal_rank",
"retrieval_precision_recall_curve",
"roc",
"root_mean_squared_error_using_sliding_window",
"rouge_score",
"sacre_bleu_score",
"signal_distortion_ratio",
"scale_invariant_signal_distortion_ratio",
"scale_invariant_signal_noise_ratio",
"sensitivity_at_specificity",
"signal_distortion_ratio",
"signal_noise_ratio",
"spearman_corrcoef",
"specificity",
"specificity_at_sensitivity",
"spectral_angle_mapper",
"spectral_distortion_index",
"squad",
"structural_similarity_index_measure",
"stat_scores",
"structural_similarity_index_measure",
"symmetric_mean_absolute_percentage_error",
"theils_u",
"theils_u_matrix",
"total_variation",
"translation_edit_rate",
"tschuprows_t",
"tschuprows_t_matrix",
"tweedie_deviance_score",
"universal_image_quality_index",
"spectral_angle_mapper",
"weighted_mean_absolute_percentage_error",
"word_error_rate",
"word_information_lost",
"word_information_preserved",
"precision_at_fixed_recall",
"recall_at_fixed_precision",
"sensitivity_at_specificity",
"specificity_at_sensitivity",
]
8 changes: 5 additions & 3 deletions src/torchmetrics/functional/regression/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from torchmetrics.functional.regression.mape import mean_absolute_percentage_error
from torchmetrics.functional.regression.minkowski import minkowski_distance
from torchmetrics.functional.regression.mse import mean_squared_error
from torchmetrics.functional.regression.nrmse import normalized_root_mean_squared_error
from torchmetrics.functional.regression.pearson import pearson_corrcoef
from torchmetrics.functional.regression.r2 import r2_score
from torchmetrics.functional.regression.rse import relative_squared_error
Expand All @@ -39,13 +40,14 @@
"kendall_rank_corrcoef",
"kl_divergence",
"log_cosh_error",
"mean_squared_log_error",
"mean_absolute_error",
"mean_squared_error",
"pearson_corrcoef",
"mean_absolute_percentage_error",
"mean_absolute_percentage_error",
"mean_squared_error",
"mean_squared_log_error",
"minkowski_distance",
"normalized_root_mean_squared_error",
"pearson_corrcoef",
"r2_score",
"relative_squared_error",
"spearman_corrcoef",
Expand Down
Loading

0 comments on commit 02f050a

Please sign in to comment.