Comments (2)
Yeah the adams algorithm that's implemented here has some numerical instability issues and the those test don't pass right now. I'd suggest just using the "dopri5" method.
from torchdiffeq.
Wrote up better tests and indeed this implementation of Adams falls a factor of ~1/3 orders behind the actual provided tolerance. Might be a problem in the error control.
Running on DETEST problems:
======= dopri5 | tol=1.000000e-03 =======
A1: NFE 68 | Time 0.010788440704345703 | Err 7.272080e-04
A2: NFE 44 | Time 0.008060693740844727 | Err 1.500953e-03
A3: NFE 140 | Time 0.02200770378112793 | Err 1.716421e-03
A4: NFE 32 | Time 0.006029605865478516 | Err 2.036043e-02
A5: NFE 32 | Time 0.005509614944458008 | Err 1.539949e-03
B1: NFE 320 | Time 0.060266733169555664 | Err 4.882935e-02
B2: NFE 158 | Time 0.027115821838378906 | Err 4.669148e-04
B3: NFE 86 | Time 0.01594233512878418 | Err 4.134018e-04
B4: NFE 176 | Time 0.03801274299621582 | Err 2.398165e-02
B5: NFE 152 | Time 0.02939462661743164 | Err 2.673915e-01
C1: NFE 86 | Time 0.015246868133544922 | Err 1.827017e-03
C2: NFE 422 | Time 0.06947016716003418 | Err 9.209132e-04
C3: NFE 194 | Time 0.033211708068847656 | Err 1.451195e-04
C4: NFE 194 | Time 0.03212714195251465 | Err 2.741384e-04
C5: NFE 44 | Time 0.01403665542602539 | Err 2.438725e-01
D1: NFE 284 | Time 0.05735015869140625 | Err 5.659548e-01
D2: NFE 236 | Time 0.04625296592712402 | Err 1.376881e+00
D3: NFE 248 | Time 0.05043292045593262 | Err 1.186594e+00
D4: NFE 338 | Time 0.11568188667297363 | Err 5.510144e-01
D5: NFE 554 | Time 0.10770630836486816 | Err 1.526093e+00
E1: NFE 92 | Time 0.021599769592285156 | Err 6.680222e-03
E2: NFE 404 | Time 0.07837677001953125 | Err 1.600952e-01
E3: NFE 218 | Time 0.044493675231933594 | Err 1.830766e-01
E4: NFE 62 | Time 0.015431880950927734 | Err 4.148992e-03
E5: NFE 86 | Time 0.019739627838134766 | Err 8.007785e-05
Total NFE 4670 | Total Time 0.9442868232727051 | GeomAvg Error 1.255112e-02
======= dopri5 | tol=1.000000e-06 =======
A1: NFE 152 | Time 0.02960991859436035 | Err 4.827294e-08
A2: NFE 92 | Time 0.022008657455444336 | Err 6.298700e-07
A3: NFE 464 | Time 0.09589576721191406 | Err 4.952654e-06
A4: NFE 86 | Time 0.021008729934692383 | Err 1.167257e-05
A5: NFE 86 | Time 0.020976543426513672 | Err 2.249016e-05
B1: NFE 836 | Time 0.23632431030273438 | Err 1.821727e-05
B2: NFE 224 | Time 0.0466306209564209 | Err 1.058051e-06
B3: NFE 164 | Time 0.03553318977355957 | Err 1.045420e-06
B4: NFE 542 | Time 0.13701200485229492 | Err 2.967035e-05
B5: NFE 458 | Time 0.099029541015625 | Err 3.317421e-05
C1: NFE 194 | Time 0.037261247634887695 | Err 4.386875e-07
C2: NFE 440 | Time 0.08108210563659668 | Err 8.595845e-07
C3: NFE 242 | Time 0.04698491096496582 | Err 3.355572e-07
C4: NFE 236 | Time 0.041779279708862305 | Err 4.573760e-07
C5: NFE 74 | Time 0.024898767471313477 | Err 1.063609e-04
D1: NFE 428 | Time 0.08998489379882812 | Err 1.257160e-03
D2: NFE 548 | Time 0.11421680450439453 | Err 7.037382e-04
D3: NFE 692 | Time 0.14804530143737793 | Err 2.068639e-04
D4: NFE 872 | Time 0.19138097763061523 | Err 7.570222e-05
D5: NFE 1268 | Time 0.27721571922302246 | Err 3.269919e-04
E1: NFE 332 | Time 0.08937478065490723 | Err 5.266044e-06
E2: NFE 1118 | Time 0.227827787399292 | Err 2.004079e-05
E3: NFE 770 | Time 0.17755675315856934 | Err 6.289734e-05
E4: NFE 134 | Time 0.03200125694274902 | Err 2.371371e-06
E5: NFE 128 | Time 0.02749037742614746 | Err 8.093759e-06
Total NFE 10580 | Total Time 2.351130247116089 | GeomAvg Error 9.501614e-06
======= dopri5 | tol=1.000000e-09 =======
A1: NFE 494 | Time 0.09552311897277832 | Err 8.870814e-11
A2: NFE 278 | Time 0.05334758758544922 | Err 1.460342e-09
A3: NFE 1490 | Time 0.26694178581237793 | Err 2.041464e-08
A4: NFE 302 | Time 0.06706738471984863 | Err 9.264589e-10
A5: NFE 260 | Time 0.04881024360656738 | Err 2.044358e-08
B1: NFE 2726 | Time 0.5740509033203125 | Err 2.376178e-08
B2: NFE 566 | Time 0.11288928985595703 | Err 9.142480e-11
B3: NFE 536 | Time 0.11006927490234375 | Err 2.787073e-10
B4: NFE 1988 | Time 0.49640464782714844 | Err 1.131809e-08
B5: NFE 1466 | Time 0.33092188835144043 | Err 2.653110e-08
C1: NFE 668 | Time 0.12520098686218262 | Err 4.931615e-10
C2: NFE 758 | Time 0.13526248931884766 | Err 1.246951e-09
C3: NFE 548 | Time 0.11997032165527344 | Err 8.067746e-11
C4: NFE 470 | Time 0.08623170852661133 | Err 2.484901e-10
C5: NFE 242 | Time 0.0868535041809082 | Err 2.785863e-05
D1: NFE 1592 | Time 0.3392162322998047 | Err 2.187210e-07
D2: NFE 1784 | Time 0.39351963996887207 | Err 2.466973e-07
D3: NFE 2192 | Time 0.524996280670166 | Err 2.430116e-07
D4: NFE 2816 | Time 0.6436746120452881 | Err 2.702230e-07
D5: NFE 3950 | Time 0.9376566410064697 | Err 4.759827e-07
E1: NFE 1304 | Time 0.33426499366760254 | Err 4.797903e-09
E2: NFE 3392 | Time 0.6913485527038574 | Err 1.119791e-08
E3: NFE 2642 | Time 0.5711958408355713 | Err 1.811273e-08
E4: NFE 392 | Time 0.0781702995300293 | Err 1.376803e-09
E5: NFE 290 | Time 0.06084704399108887 | Err 6.430645e-09
Total NFE 33146 | Total Time 7.284435272216797 | GeomAvg Error 8.059362e-09
======= adams | tol=1.000000e-03 =======
A1: NFE 51 | Time 0.012702465057373047 | Err 2.261270e-03
A2: NFE 45 | Time 0.01181340217590332 | Err 8.602290e-03
A3: NFE 144 | Time 0.04609036445617676 | Err 5.195046e-01
A4: NFE 32 | Time 0.008631467819213867 | Err 1.706534e-01
A5: NFE 34 | Time 0.010343551635742188 | Err 6.239182e-02
B1: NFE 274 | Time 0.10616064071655273 | Err 6.643999e-01
B2: NFE 148 | Time 0.0475153923034668 | Err 1.090780e-03
B3: NFE 55 | Time 0.016512393951416016 | Err 3.878499e-03
B4: NFE 143 | Time 0.056386709213256836 | Err 1.864493e+00
B5: NFE 135 | Time 0.05435657501220703 | Err 7.413579e-02
C1: NFE 117 | Time 0.03713655471801758 | Err 8.153828e-04
C2: NFE 399 | Time 0.14408206939697266 | Err 4.570841e-04
C3: NFE 158 | Time 0.05196857452392578 | Err 8.268178e-04
C4: NFE 192 | Time 0.06265926361083984 | Err 2.151150e-04
C5: NFE 28 | Time 0.012468338012695312 | Err 7.926124e-02
D1: NFE 95 | Time 0.037720441818237305 | Err 1.247976e+00
D2: NFE 131 | Time 0.07047510147094727 | Err 8.986149e-01
D3: NFE 106 | Time 0.06598615646362305 | Err 1.922219e+00
D4: NFE 121 | Time 0.06752753257751465 | Err 3.871925e+00
D5: NFE 164 | Time 0.06992220878601074 | Err 7.857053e+00
E1: NFE 97 | Time 0.056398868560791016 | Err 6.842797e-02
E2: NFE 303 | Time 0.11104989051818848 | Err 5.833851e-02
E3: NFE 206 | Time 0.0821683406829834 | Err 5.089961e-01
E4: NFE 49 | Time 0.014600038528442383 | Err 2.049716e-03
E5: NFE 34 | Time 0.012566566467285156 | Err 2.273417e-01
Total NFE 3261 | Total Time 1.2672429084777832 | GeomAvg Error 5.313620e-02
======= adams | tol=1.000000e-06 =======
A1: NFE 137 | Time 0.041599273681640625 | Err 1.930932e-07
A2: NFE 119 | Time 0.03770089149475098 | Err 7.068730e-05
A3: NFE 417 | Time 0.1475205421447754 | Err 1.370366e-02
A4: NFE 87 | Time 0.03063511848449707 | Err 3.308265e-04
A5: NFE 85 | Time 0.03133106231689453 | Err 1.391768e-04
B1: NFE 654 | Time 0.2576448917388916 | Err 2.972835e-02
B2: NFE 184 | Time 0.05686616897583008 | Err 6.439643e-07
B3: NFE 146 | Time 0.052620887756347656 | Err 4.579437e-05
B4: NFE 384 | Time 0.16078734397888184 | Err 1.253109e-02
B5: NFE 347 | Time 0.13953137397766113 | Err 1.339096e-03
C1: NFE 174 | Time 0.05699801445007324 | Err 4.405296e-05
C2: NFE 415 | Time 0.13611149787902832 | Err 2.026881e-05
C3: NFE 258 | Time 0.08983993530273438 | Err 9.127962e-06
C4: NFE 222 | Time 0.07784795761108398 | Err 9.537573e-06
C5: NFE 67 | Time 0.033365488052368164 | Err 3.890013e-03
D1: NFE 319 | Time 0.13143253326416016 | Err 3.308274e-02
D2: NFE 394 | Time 0.16957736015319824 | Err 1.565481e-02
D3: NFE 567 | Time 0.2311103343963623 | Err 1.431569e-01
D4: NFE 637 | Time 0.2905595302581787 | Err 5.694917e-02
D5: NFE 936 | Time 0.4241025447845459 | Err 1.110112e-01
E1: NFE 236 | Time 0.09818840026855469 | Err 7.604773e-04
E2: NFE 844 | Time 0.3378312587738037 | Err 7.197080e-05
E3: NFE 522 | Time 0.21934962272644043 | Err 5.654675e-03
E4: NFE 102 | Time 0.03478431701660156 | Err 1.347482e-04
E5: NFE 73 | Time 0.02921271324157715 | Err 5.706134e-03
Total NFE 8326 | Total Time 3.316549062728882 | GeomAvg Error 6.098600e-04
======= adams | tol=1.000000e-09 =======
A1: NFE 424 | Time 0.13251209259033203 | Err 1.612025e-09
A2: NFE 271 | Time 0.09582948684692383 | Err 5.578094e-07
A3: NFE 1014 | Time 0.4057459831237793 | Err 1.960314e-04
A4: NFE 162 | Time 0.06768465042114258 | Err 1.184666e-05
A5: NFE 173 | Time 0.0699775218963623 | Err 3.741281e-06
B1: NFE 1486 | Time 0.6508052349090576 | Err 1.585581e-05
B2: NFE 479 | Time 0.15500402450561523 | Err 1.108606e-09
B3: NFE 362 | Time 0.1456615924835205 | Err 1.989949e-07
B4: NFE 924 | Time 0.414292573928833 | Err 2.569040e-05
B5: NFE 765 | Time 0.33356714248657227 | Err 6.556738e-06
C1: NFE 425 | Time 0.15400385856628418 | Err 2.273003e-07
C2: NFE 709 | Time 0.2643897533416748 | Err 7.480299e-09
C3: NFE 460 | Time 0.17317628860473633 | Err 5.051544e-07
C4: NFE 368 | Time 0.12443256378173828 | Err 9.529091e-08
C5: NFE 144 | Time 0.07560181617736816 | Err 3.835668e-05
D1: NFE 735 | Time 0.3128347396850586 | Err 6.962990e-06
D2: NFE 897 | Time 0.38929200172424316 | Err 1.424647e-04
D3: NFE 1094 | Time 0.49249982833862305 | Err 1.772647e-05
D4: NFE 1374 | Time 0.6379408836364746 | Err 2.946724e-04
D5: NFE 2010 | Time 0.9306154251098633 | Err 1.802271e-04
E1: NFE 656 | Time 0.2737274169921875 | Err 1.275190e-05
E2: NFE 1891 | Time 0.8151400089263916 | Err 5.415014e-06
E3: NFE 1106 | Time 0.5112884044647217 | Err 4.944611e-06
E4: NFE 265 | Time 0.0979304313659668 | Err 8.585508e-07
E5: NFE 154 | Time 0.06854581832885742 | Err 3.427993e-05
Total NFE 18348 | Total Time 7.792499542236328 | GeomAvg Error 2.787995e-06
from torchdiffeq.
Related Issues (20)
- reuse solver object
- Integrate Forced Andronov-Hopf Bifurcation HOT 3
- Export to ONNX?
- Is func variable in odeint(func, y0, t) the derivative part of the ode?
- Initial Condition changes when calling the odeint_adjoint
- How to use the summary function for model description?
- How to work with control namely PID controller
- Why odeint sometimes provides a wrong solution? HOT 5
- Non uniform time step in example/ode_demo.py
- runtime of ode_demo.py using adjoint vs. not using it HOT 1
- underflow in dt nan HOT 4
- Typo in paper (?) HOT 1
- How to pass extra paramaters of func to odeint? HOT 2
- Bug: Memory Leaky with from torchdiffeq import odeint HOT 1
- Perform one integration step HOT 2
- Scipy LSODA for stiff ODE
- Question about the gradient of `odeint`
- A warning message when there is only 1 evaluation point provided would be helpful
- Enabling Mixed Precision Training for Your Model
- How do I use a solver when input and output shapes don't match?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torchdiffeq.