|
165 | 165 | "This reason this modified optimization is required is that linear terms in $\\dot{x}$ are no longer guaranteed, so every candidate library term is fit with a different model to find the best combination of implicit terms. Note $\\text{diag}(\\Xi) = 0$ is required because without this, the model would just fit every candidate library term with itself, $\\dot{x} = \\dot{x}$, $x\\dot{x} = x\\dot{x}$, $x^2\\dot{x} = x^2\\dot{x}$, and so on." |
166 | 166 | ] |
167 | 167 | }, |
168 | | - { |
169 | | - "cell_type": "code", |
170 | | - "execution_count": null, |
171 | | - "metadata": {}, |
172 | | - "outputs": [], |
173 | | - "source": [] |
174 | | - }, |
175 | 168 | { |
176 | 169 | "cell_type": "code", |
177 | 170 | "execution_count": 3, |
|
302 | 295 | }, |
303 | 296 | { |
304 | 297 | "cell_type": "code", |
305 | | - "execution_count": 145, |
| 298 | + "execution_count": 5, |
306 | 299 | "metadata": {}, |
307 | 300 | "outputs": [ |
308 | 301 | { |
|
318 | 311 | "Model 6\n", |
319 | 312 | "Model 7\n", |
320 | 313 | "Model 8\n", |
321 | | - "Solver failed on model 8 , setting coefs to zeros\n", |
322 | 314 | "Model 9\n", |
323 | | - "1 = 5.000 x0 + 1.667 x0_t + 5.556 x0x0_t\n", |
324 | | - "x0 = 0.200 1 + 0.005 x0x0 + -0.334 x0_t + -1.104 x0x0_t\n", |
325 | | - "x0x0 = 0.019 1 + 0.079 x0 + 0.625 x0x0x0 + -0.672 x0x0_t\n", |
326 | | - "x0x0x0 = -0.008 1 + 0.371 x0x0 + 0.827 x0x0x0x0 + 0.033 x0_t\n", |
327 | | - "x0x0x0x0 = -0.005 1 + 0.858 x0x0x0 + -0.022 x0_t + 0.294 x0x0_t + -0.110 x0x0x0x0x0_t\n", |
328 | | - "x0_t = 0.599 1 + -2.996 x0 + 0.015 x0x0 + -3.307 x0x0_t\n", |
329 | | - "x0x0_t = 0.177 1 + -0.882 x0 + -0.014 x0x0 + -0.293 x0_t\n", |
330 | | - "x0x0x0_t = 0.013 1 + -0.246 x0x0 + -0.406 x0x0x0 + -0.043 x0_t\n", |
331 | | - "x0x0x0x0_t = 0.000\n", |
332 | | - "x0x0x0x0x0_t = 0.001 1 + -0.492 x0x0x0x0 + 0.007 x0_t + -0.068 x0x0_t\n" |
| 315 | + "1 = 5.000 x0 + 1.667 x0_t + 5.555 x0x0_t\n", |
| 316 | + "x0 = 0.200 1 + 0.010 x0x0 + -0.334 x0_t + -1.097 x0x0_t\n", |
| 317 | + "x0x0 = 0.019 1 + 0.080 x0 + 0.627 x0x0x0 + -0.669 x0x0_t\n", |
| 318 | + "x0x0x0 = -0.008 1 + 0.373 x0x0 + 0.823 x0x0x0x0 + 0.033 x0_t\n", |
| 319 | + "x0x0x0x0 = -0.006 1 + 0.893 x0x0x0 + -0.021 x0_t + 0.305 x0x0_t\n", |
| 320 | + "x0_t = 0.597 1 + -2.991 x0 + 0.031 x0x0 + -3.279 x0x0_t\n", |
| 321 | + "x0x0_t = 0.174 1 + -0.863 x0 + -0.029 x0x0 + -0.285 x0_t\n", |
| 322 | + "x0x0x0_t = 0.013 1 + -0.247 x0x0 + -0.405 x0x0x0 + -0.043 x0_t\n", |
| 323 | + "x0x0x0x0_t = 0.010 x0 + -0.143 x0x0x0 + -0.501 x0x0x0x0 + -0.006 x0_t\n", |
| 324 | + "x0x0x0x0x0_t = 0.001 1 + -0.479 x0x0x0x0 + 0.005 x0_t + -0.060 x0x0_t\n" |
333 | 325 | ] |
334 | 326 | }, |
335 | 327 | { |
|
347 | 339 | " 'x0x0x0x0x0_t']" |
348 | 340 | ] |
349 | 341 | }, |
350 | | - "execution_count": 145, |
| 342 | + "execution_count": 5, |
351 | 343 | "metadata": {}, |
352 | 344 | "output_type": "execute_result" |
353 | 345 | } |
354 | 346 | ], |
355 | 347 | "source": [ |
356 | | - "library_functions = [\n", |
357 | | - " lambda x: x,\n", |
358 | | - " lambda x, y: x * y,\n", |
359 | | - " lambda x: x ** 2,\n", |
360 | | - " lambda x, y, z: x * y * z,\n", |
361 | | - " lambda x, y: x * y ** 2,\n", |
362 | | - " lambda x: x ** 3,\n", |
363 | | - " lambda x, y, z, w: x * y * z * w,\n", |
364 | | - " lambda x, y, z: x * y * z ** 2,\n", |
365 | | - " lambda x, y: x * y ** 3,\n", |
366 | | - " lambda x: x ** 4,\n", |
367 | | - "]\n", |
368 | 348 | "library_function_names = [\n", |
369 | 349 | " lambda x: x,\n", |
370 | 350 | " lambda x, y: x + y,\n", |
|
378 | 358 | " lambda x: x + x + x + x,\n", |
379 | 359 | "]\n", |
380 | 360 | "\n", |
381 | | - "sindy_opt = ps.SINDyPI(\n", |
382 | | - " threshold=1e-6,\n", |
383 | | - " tol=1e-9,\n", |
384 | | - " thresholder=\"l1\",\n", |
385 | | - " max_iter=20000,\n", |
386 | | - ")\n", |
387 | | - "\n", |
388 | 361 | "sindy_library = ps.WeakPDELibrary(\n", |
389 | 362 | " library_functions=library_functions,\n", |
390 | 363 | " spatiotemporal_grid=t[:,np.newaxis],\n", |
|
406 | 379 | }, |
407 | 380 | { |
408 | 381 | "cell_type": "code", |
409 | | - "execution_count": 14, |
| 382 | + "execution_count": 6, |
410 | 383 | "metadata": {}, |
411 | 384 | "outputs": [ |
412 | 385 | { |
|
451 | 424 | " 'x0x0x0x0x0_t']" |
452 | 425 | ] |
453 | 426 | }, |
454 | | - "execution_count": 14, |
| 427 | + "execution_count": 6, |
455 | 428 | "metadata": {}, |
456 | 429 | "output_type": "execute_result" |
457 | 430 | } |
|
0 commit comments