Bugs in degree of freedom finders of noncentral F distribution
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
The failing functions are find_v1 and find_v2 on non_central_f_distribution, which live in include/boost/math/distributions/non_central_f.hpp. Build the standalone reproducer from the issue and confirm the two throws of 'Degrees of freedom argument is inf'. Done means both calls return the expected degrees of freedom for each listed case, for double and float, without throwing.
索引モデルが issue の本文から書いたものです。
説明
Porting the new parameter finders to SciPy, I encountered two more cases where the find_v1 and find_v2 methods of the noncentral F distribution throw an exception when they should not. In both cases, the CDF is monotonic with respect to the search parameter. I suspect that for some reason the root finder tries out extreme values for the CDF where the computation fails.
// Reproducer: non_central_f_distribution::find_v1 / find_v2 fail to invert the CDF
// (they throw "Degrees of freedom argument is inf, but must be > 0") even though the
// CDF is strictly monotonic in the degrees of freedom being searched for.
//
// Build (standalone, header only):
// c++ -std=c++17 -DBOOST_MATH_STANDALONE -I<boost>/include ncf_find_dof_repro.cpp
#include <boost/math/distributions/non_central_f.hpp>
#include <cmath>
#include <iomanip>
#include <iostream>
namespace bm = boost::math;
template <class T>
void check_v1(T v1, T v2, T nc, T f, T p)
{
typedef bm::non_central_f_distribution<T> D;
std::cout << " find_v1(f=" << f << ", v2=" << v2 << ", nc=" << nc << ", p=" << p
<< "), expected " << v1 << ": ";
try { std::cout << D::find_v1(f, v2, nc, p) << "\n"; }
catch (const std::exception& e) { std::cout << "THREW: " << e.what() << "\n"; }
}
template <class T>
void check_v2(T v2, T v1, T nc, T f, T p)
{
typedef bm::non_central_f_distribution<T> D;
std::cout << " find_v2(f=" << f << ", v1=" << v1 << ", nc=" << nc << ", p=" << p
<< "), expected " << v2 << ": ";
try { std::cout << D::find_v2(f, v1, nc, p) << "\n"; }
catch (const std::exception& e) { std::cout << "THREW: " << e.what() << "\n"; }
}
template <class T>
void run(const char* name)
{
std::cout << "=== " << name << " ===" << std::setprecision(17) << "\n";
typedef bm::non_central_f_distribution<T> D;
const T nc = 0.25, f = 15;
std::cout << "find_v1, v2 = 2 (p computed from cdf at the true v1):\n";
for (T v1 : {T(0.1), T(1), T(2), T(3), T(1e4)})
check_v1<T>(v1, 2, nc, f, cdf(D(v1, 2, nc), f));
std::cout << "find_v2, v1 = 2:\n";
for (T v2 : {T(1), T(2), T(3)})
check_v2<T>(v2, 2, nc, f, cdf(D(2, v2, nc), f));
std::cout << "\n";
}
int main()
{
// For nc = 0.25, f = 15 the CDF is strictly increasing in both v1 and v2, e.g.
// v1 (v2=2): 0.1 -> 0.8924, 1 -> 0.9256, 2 -> 0.9302, 3 -> 0.9319, 1e4 -> 0.9355
// v2 (v1=2): 0.5 -> 0.6314, 1 -> 0.8097, 2 -> 0.9302, 4 -> 0.9830
// so the inverse is unique and should be found.
run<double>("double");
run<float>("float");
}
- 主要言語
- C++
- スター
- 382
- フォーク
- 274
- 平均マージ
- 21時間 14分
- マージ済み PR(30日)
- 51
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
boostorg/math のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
-
Fisher F complemented quantile fails for two upper-tail probabilities対応中かも @hector2394 が 2 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
boostorg/math#1666 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Feature Wishlistオープンenhancement
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
boostorg/math#303 · コメント 20 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
agent:WSL code-review linux pri:medium refactoring
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
kind/enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
psi29a/d2decomped#691 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
CachyOS/packageinstaller#144 ·
メンテナーはふだん 1 日以内に返信
-
(S1 - Need confirmation)
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
CleverRaven/Cataclysm-DDA#89715 ·
メンテナーはふだん 1 日以内に返信