From 0e6ed2437f6ab8d92e7de0b0ac6e90968af89adc Mon Sep 17 00:00:00 2001 From: Zachary Nicolaou Date: Tue, 7 Jun 2022 15:59:36 -0700 Subject: [PATCH] updated notebook --- examples/9_sindypi_with_sympy.ipynb | 55 ++++++++--------------------- 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/examples/9_sindypi_with_sympy.ipynb b/examples/9_sindypi_with_sympy.ipynb index add1355d7..89827aa4a 100644 --- a/examples/9_sindypi_with_sympy.ipynb +++ b/examples/9_sindypi_with_sympy.ipynb @@ -165,13 +165,6 @@ "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." ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "code", "execution_count": 3, @@ -302,7 +295,7 @@ }, { "cell_type": "code", - "execution_count": 145, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -318,18 +311,17 @@ "Model 6\n", "Model 7\n", "Model 8\n", - "Solver failed on model 8 , setting coefs to zeros\n", "Model 9\n", - "1 = 5.000 x0 + 1.667 x0_t + 5.556 x0x0_t\n", - "x0 = 0.200 1 + 0.005 x0x0 + -0.334 x0_t + -1.104 x0x0_t\n", - "x0x0 = 0.019 1 + 0.079 x0 + 0.625 x0x0x0 + -0.672 x0x0_t\n", - "x0x0x0 = -0.008 1 + 0.371 x0x0 + 0.827 x0x0x0x0 + 0.033 x0_t\n", - "x0x0x0x0 = -0.005 1 + 0.858 x0x0x0 + -0.022 x0_t + 0.294 x0x0_t + -0.110 x0x0x0x0x0_t\n", - "x0_t = 0.599 1 + -2.996 x0 + 0.015 x0x0 + -3.307 x0x0_t\n", - "x0x0_t = 0.177 1 + -0.882 x0 + -0.014 x0x0 + -0.293 x0_t\n", - "x0x0x0_t = 0.013 1 + -0.246 x0x0 + -0.406 x0x0x0 + -0.043 x0_t\n", - "x0x0x0x0_t = 0.000\n", - "x0x0x0x0x0_t = 0.001 1 + -0.492 x0x0x0x0 + 0.007 x0_t + -0.068 x0x0_t\n" + "1 = 5.000 x0 + 1.667 x0_t + 5.555 x0x0_t\n", + "x0 = 0.200 1 + 0.010 x0x0 + -0.334 x0_t + -1.097 x0x0_t\n", + "x0x0 = 0.019 1 + 0.080 x0 + 0.627 x0x0x0 + -0.669 x0x0_t\n", + "x0x0x0 = -0.008 1 + 0.373 x0x0 + 0.823 x0x0x0x0 + 0.033 x0_t\n", + "x0x0x0x0 = -0.006 1 + 0.893 x0x0x0 + -0.021 x0_t + 0.305 x0x0_t\n", + "x0_t = 0.597 1 + -2.991 x0 + 0.031 x0x0 + -3.279 x0x0_t\n", + "x0x0_t = 0.174 1 + -0.863 x0 + -0.029 x0x0 + -0.285 x0_t\n", + "x0x0x0_t = 0.013 1 + -0.247 x0x0 + -0.405 x0x0x0 + -0.043 x0_t\n", + "x0x0x0x0_t = 0.010 x0 + -0.143 x0x0x0 + -0.501 x0x0x0x0 + -0.006 x0_t\n", + "x0x0x0x0x0_t = 0.001 1 + -0.479 x0x0x0x0 + 0.005 x0_t + -0.060 x0x0_t\n" ] }, { @@ -347,24 +339,12 @@ " 'x0x0x0x0x0_t']" ] }, - "execution_count": 145, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "library_functions = [\n", - " lambda x: x,\n", - " lambda x, y: x * y,\n", - " lambda x: x ** 2,\n", - " lambda x, y, z: x * y * z,\n", - " lambda x, y: x * y ** 2,\n", - " lambda x: x ** 3,\n", - " lambda x, y, z, w: x * y * z * w,\n", - " lambda x, y, z: x * y * z ** 2,\n", - " lambda x, y: x * y ** 3,\n", - " lambda x: x ** 4,\n", - "]\n", "library_function_names = [\n", " lambda x: x,\n", " lambda x, y: x + y,\n", @@ -378,13 +358,6 @@ " lambda x: x + x + x + x,\n", "]\n", "\n", - "sindy_opt = ps.SINDyPI(\n", - " threshold=1e-6,\n", - " tol=1e-9,\n", - " thresholder=\"l1\",\n", - " max_iter=20000,\n", - ")\n", - "\n", "sindy_library = ps.WeakPDELibrary(\n", " library_functions=library_functions,\n", " spatiotemporal_grid=t[:,np.newaxis],\n", @@ -406,7 +379,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -451,7 +424,7 @@ " 'x0x0x0x0x0_t']" ] }, - "execution_count": 14, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" }