crps_cnormal ignores the backend argument for the tail masses

オープン
#138 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@gopain185 がすでに取り組んでいます。

2026年11月1日 から。

  • #142 @gopain185 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
20/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python, pytorch

調査の方向性

Read crps_cnormal and compare it with crps.gtcnormal, as the issue names both as relevant entry points. Check how the two _norm_cdf calls handle converted inputs and the requested backend. Done means the torch reproducer works with gradient-requiring tensors; pull request #142 is already open for this issue.

索引モデルが issue の本文から書いたものです。

説明

bug
What happened?

crps_cnormal computes the censored masses with stats._norm_cdf(...) but doesn't pass backend on, so it uses the globally active backend (numpy by default) instead of the one requested. With torch tensors this goes through numpy, which fails for tensors that need gradients (and for GPU tensors). This is the same kind of bug as #98.

Suggested fix: pass backend=backend to both _norm_cdf calls, after converting the inputs with B.asarray, as crps.gtcnormal does.

Minimal reproducer
import torch
import scoringrules as sr

sr.register_backend("torch")

obs = torch.zeros(3)
mu = torch.zeros(3, requires_grad=True)
sigma = torch.ones(3)

# the active backend is still numpy
sr.crps_cnormal(obs, mu, sigma, -1.0, 1.0, backend="torch")
Backend

torch

Python version

3.12

scoringrules version

0.11.0

主要言語
Python
スター
108
フォーク
15
平均マージ
1時間 42分
マージ済み PR(30日)
9

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

frazane/scoringrules のほかの issue

frazane/scoringrules の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。