Forward difference gradient has the same number of function calls as central difference
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- julia
- 領域
- performance
調査の方向性
src/gradients.jl の GradientCache コンストラクターと、138 行目および 144-145 行目付近の finite_difference_gradient! コードから始めます。前進差分に対して fx がどのように渡されるかを追跡し、中央差分と関数呼び出しの動作を比較します。前進差分がキャッシュを通じて f(x) を再利用でき、必要な関数呼び出し回数が少なくなり、選択したアプローチによるパフォーマンス上の影響を理解できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Changes to gradients.jl made in fc5a08e removed any way to reduce the number of function calls made when using forward difference for gradients as compared to central difference. The finite_difference_gradient! functions assume that f(x) will be provided in the GradientCache for forward differences, but the only constructor for GradientCache forces fx = nothing.
Here are the lines returning the only cache the constructor will give you:
https://github.com/JuliaDiff/FiniteDiff.jl/blob/9945e7d7f567dc2eb6a95a714b1de9782d0ecea4/src/gradients.jl#L52-L53
I can think of three ways to fix it:
- There could be a constructor that accepts an input of
fxreturns the a cache with fx, although fc5a08e was trying to get rid of extra constructors. - Instead of using the type
Nothingfor the first parameter of the returned GradientCache, useUnion{Nothing,returntype}so the user can manually update it later. - Or, don't bother using the cache and change the following line
https://github.com/JuliaDiff/FiniteDiff.jl/blob/9945e7d7f567dc2eb6a95a714b1de9782d0ecea4/src/gradients.jl#L138
to_fx, c1, c2, c3 = cache.fx, cache.c1, cache.c2, cache.c3and then before this for loop:
https://github.com/JuliaDiff/FiniteDiff.jl/blob/9945e7d7f567dc2eb6a95a714b1de9782d0ecea4/src/gradients.jl#L144-L145
add something along the lines offx = _fx == Nothing ? f(x) : _fx
2 makes the most sense to me, but I'm not sure what the performance implications are.
- 主要言語
- Julia
- スター
- 305
- フォーク
- 42
- 平均マージ
- 24分
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaDiff/FiniteDiff.jl のほかの issue
-
tagbot-manual
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
JuliaDiff/FiniteDiff.jl#218 ·
-
Feature request: vectorized finite difference evaluation対応中かも @ChrisRackauckas-Claude が 192 日前に担当しました。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
JuliaDiff/FiniteDiff.jl#210 · コメント 1 件 · リアクション 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
JuliaDiff/FiniteDiff.jl#199 · コメント 3 件 ·
-
StridedArraysオープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
JuliaDiff/FiniteDiff.jl#158 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
JuliaDiff/FiniteDiff.jl#157 · コメント 1 件 ·
JuliaDiff/FiniteDiff.jl の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
oscar-system/GAP.jl#1455 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
JuliaAI/MLJTransforms.jl#85 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
SciML/OrdinaryDiffEq.jl#4875 ·
メンテナーはふだん 4 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
SciML/NonlinearSolve.jl#1372 ·
メンテナーはふだん 1 日以内に返信