栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

torchmetrics:支持80+任务评价指标

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

torchmetrics:支持80+任务评价指标

torchmetrics是由pytorch-lightning开源的评估指标计算库,内置了常见的80+指标计算逻辑,可以直接使用,也可以与pytorch-lightning结合一起使用。

安装 & 使用
pip install torchmetrics

基础案例:

# import 三方包
import torchmetrics

# initialize metric
metric = torchmetrics.Accuracy()

# move the metric to device you want computations to take place
device = "cuda" if torch.cuda.is_available() else "cpu"
metric.to(device)

n_batches = 10
for i in range(n_batches):
    # simulate a classification problem
    preds = torch.randn(10, 5).softmax(dim=-1).to(device)
    target = torch.randint(5, (10,)).to(device)

    # metric on current batch
    acc = metric(preds, target)
    print(f"Accuracy on batch {i}: {acc}")

# metric on all batches using custom accumulation
acc = metric.compute()
print(f"Accuracy on all data: {acc}")
Auido 任务指标
  • Perceptual Evaluation of Speech Quality (PESQ)

  • Permutation Invariant Training (PIT)

  • Scale-Invariant Signal-to-Distortion Ratio (SI-SDR)

  • Scale-Invariant Signal-to-Noise Ratio (SI-SNR)

  • Short-Time Objective Intelligibility (STOI)

  • Signal to Distortion Ratio (SDR)

  • Signal-to-Noise Ratio (SNR)

分类 任务指标
  • Accuracy

  • AUC

  • AUROC

  • Average Precision

  • Binned Average Precision

  • Binned Precision Recall Curve

  • Binned Recall At Fixed Precision

  • Calibration Error

  • Cohen Kappa

  • Confusion Matrix

  • Coverage Error

  • Dice Score

  • F1 Score

  • FBeta Score

  • Hamming Distance

  • Hinge Loss

  • Jaccard Index

  • KL Divergence

  • Label Ranking Average Precision

  • Label Ranking Loss

  • Matthews Corr. Coef.

  • Precision

  • Precision Recall

  • Precision Recall Curve

  • Recall

  • ROC

  • Specificity

  • Stat Scores

图像 任务指标
  • Error Relative Global Dim. Synthesis (ERGAS)

  • Frechet Inception Distance (FID)

  • Image Gradients

  • Inception Score

  • Kernel Inception Distance

  • Learned Perceptual Image Patch Similarity (LPIPS)

  • Multi-Scale SSIM

  • Peak Signal-to-Noise Ratio (PSNR)

  • Spectral Angle Mapper

  • Spectral Distortion Index

  • Structural Similarity Index Measure (SSIM)

  • Universal Image Quality Index

检测 任务指标
  • Mean-Average-Precision (mAP)

Pairwise 任务指标
  • Cosine Similarity

  • Euclidean Distance

  • Linear Similarity

  • Manhattan Distance

Regression 任务指标
  • Cosine Similarity

  • Explained Variance

  • Mean Absolute Error (MAE)

  • Mean Absolute Percentage Error (MAPE)

  • Mean Squared Error (MSE)

  • Mean Squared Log Error (MSLE)

  • Pearson Corr. Coef.

  • R2 Score

  • Spearman Corr. Coef.

  • Symmetric Mean Absolute Percentage Error (SMAPE)

  • Tweedie Deviance Score

  • Weighted MAPE

Retrieval 任务指标
  • Retrieval Fall-Out

  • Retrieval Hit Rate

  • Retrieval Mean Average Precision (MAP)

  • Retrieval Mean Reciprocal Rank (MRR)

  • Retrieval Normalized DCG

  • Retrieval Precision

  • Retrieval R-Precision

  • Retrieval Recall

Text 任务指标
  • BERT Score

  • BLEU Score

  • Char Error Rate

  • ChrF Score

  • Extended Edit Distance

  • Match Error Rate

  • ROUGE Score

  • Sacre BLEU Score

  • SQuAD

  • Translation Edit Rate (TER)

  • Word Error Rate

  • Word Info. Lost

  • Word Info. Preserved

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/942341.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号