|
1045 | 1045 | }
|
1046 | 1046 | ],
|
1047 | 1047 | "source": [
|
1048 |
| - "def tanh_func(x, x1, x2, w, x0):\n", |
| 1048 | + "def tanh_func(x, ls1, ls2, w, x0):\n", |
1049 | 1049 | " \"\"\"\n",
|
1050 |
| - " l1: Left saturation value\n", |
1051 |
| - " l2: Right saturation value\n", |
1052 |
| - " lw: Transition width\n", |
1053 |
| - " x0: Transition location.\n", |
| 1050 | + " ls1: left saturation value\n", |
| 1051 | + " ls2: right saturation value\n", |
| 1052 | + " w: transition width\n", |
| 1053 | + " x0: transition location.\n", |
1054 | 1054 | " \"\"\"\n",
|
1055 |
| - " return (x1 + x2) / 2.0 - (x1 - x2) / 2.0 * tt.tanh((x - x0) / w)\n", |
| 1055 | + " return (ls1 + ls2) / 2.0 - (ls1 - ls2) / 2.0 * tt.tanh((x - x0) / w)\n", |
1056 | 1056 | "\n",
|
1057 | 1057 | "ls1 = 0.05\n",
|
1058 | 1058 | "ls2 = 0.6\n",
|
1059 |
| - "lw = 0.3\n", |
| 1059 | + "w = 0.3\n", |
1060 | 1060 | "x0 = 1.0\n",
|
1061 |
| - "cov = pm.gp.cov.Gibbs(1, tanh_func, args=(ls1, ls2, lw, x0))\n", |
| 1061 | + "cov = pm.gp.cov.Gibbs(1, tanh_func, args=(ls1, ls2, w, x0))\n", |
1062 | 1062 | " \n",
|
1063 |
| - "wf = theano.function([], tanh_func(X, ls1, ls2, lw, x0))()\n", |
| 1063 | + "wf = theano.function([], tanh_func(X, ls1, ls2, w, x0))()\n", |
1064 | 1064 | "plt.plot(X, wf); plt.ylabel(\"tanh_func(X)\"); plt.xlabel(\"X\"); plt.title(\"Lengthscale as a function of X\");\n",
|
1065 | 1065 | "\n",
|
1066 | 1066 | "K = cov(X).eval()\n",
|
|
0 commit comments