-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b8f42d7
Showing
328 changed files
with
53,966 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 42647dab2a9c89d69feefbcf6c6f1d6d | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+6.08 KB
.doctrees/api/generated/folie.analysis.free_energy_profile_1d.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+18.7 KB
.doctrees/auto_examples/toy_models/plot_biased_1D_Double_Well.doctree
Binary file not shown.
Binary file added
BIN
+27.3 KB
.doctrees/auto_examples/toy_models/plot_biased_2D_Double_Well.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Analysis of obtained models\n", | ||
"\n", | ||
"\n", | ||
"Once we have obtained a model, we can extract useful quantities" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
129 changes: 129 additions & 0 deletions
129
.doctrees/nbsphinx/notebooks/statistical_performances/overdampedOU.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "718db51f", | ||
"metadata": {}, | ||
"source": [ | ||
"# Overdamped" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "9e03f944-d2c1-48ba-88ec-494c9e7c40ea", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import folie as fl\n", | ||
"import matplotlib.pyplot as plt" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "82c19e11-896e-48de-ae8d-4c614545b4e8", | ||
"metadata": {}, | ||
"source": [ | ||
"Let's first simulate some trajectories with various timestep" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "8bf9d6de-29f8-4bc7-8b0c-92f68b262b7d", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"ename": "ValueError", | ||
"evalue": "could not broadcast input array from shape (25,25) into shape (25,1)", | ||
"output_type": "error", | ||
"traceback": [ | ||
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | ||
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", | ||
"Cell \u001b[0;32mIn[2], line 7\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m dt \u001b[38;5;129;01min\u001b[39;00m list_dts:\n\u001b[1;32m 6\u001b[0m simulator \u001b[38;5;241m=\u001b[39m fl\u001b[38;5;241m.\u001b[39mSimulator(fl\u001b[38;5;241m.\u001b[39mExactDensity(model_simu), dt)\n\u001b[0;32m----> 7\u001b[0m data_dts\u001b[38;5;241m.\u001b[39mappend(\u001b[43msimulator\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m5000\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mzeros\u001b[49m\u001b[43m(\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m25\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m25\u001b[39;49m\u001b[43m)\u001b[49m)\n", | ||
"File \u001b[0;32m~/Projets/folie/folie/simulations/__init__.py:34\u001b[0m, in \u001b[0;36mSimulator.run\u001b[0;34m(self, nsteps, x0, ntrajs, save_every, **kwargs)\u001b[0m\n\u001b[1;32m 32\u001b[0m x \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtransition\u001b[38;5;241m.\u001b[39mrun_step(x, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdt, dW[:, n])\n\u001b[1;32m 33\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m n \u001b[38;5;241m%\u001b[39m save_every \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[0;32m---> 34\u001b[0m \u001b[43mx_val\u001b[49m\u001b[43m[\u001b[49m\u001b[43m:\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mn\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m/\u001b[39;49m\u001b[38;5;241;43m/\u001b[39;49m\u001b[43m \u001b[49m\u001b[43msave_every\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m:\u001b[49m\u001b[43m]\u001b[49m \u001b[38;5;241m=\u001b[39m x\n\u001b[1;32m 35\u001b[0m data \u001b[38;5;241m=\u001b[39m Trajectories(dt\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdt \u001b[38;5;241m*\u001b[39m save_every)\n\u001b[1;32m 36\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(ntrajs):\n", | ||
"\u001b[0;31mValueError\u001b[0m: could not broadcast input array from shape (25,25) into shape (25,1)" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"model_simu = fl.models.OrnsteinUhlenbeck()\n", | ||
"model_simu.coefficients = np.array([0.1, 1.2, 2.0])\n", | ||
"data_dts = []\n", | ||
"list_dts = [1e-3, 5e-3, 1e-2, 5e-2]\n", | ||
"for dt in list_dts:\n", | ||
" simulator = fl.Simulator(fl.simulations.ExactStepper(model_simu), dt)\n", | ||
" data_dts.append(simulator.run(5000, np.zeros((25,)), 25))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "fc477114-844e-415c-88a4-f5a19c088057", | ||
"metadata": {}, | ||
"source": [ | ||
"We can then run the estimation for various likelihood at all timesteps" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "d7756920-1780-47f4-bef7-7296d8ea127f", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"fig, axs = plt.subplots(1, len(model_simu.coefficients))\n", | ||
"\n", | ||
"for name, transitioncls in zip(\n", | ||
" [\"Exact\", \"Euler\", \"Ozaki\", \"ShojiOzaki\", \"Elerian\", \"Kessler\", \"Drozdov\"],\n", | ||
" [\n", | ||
" fl.ExactDensity,\n", | ||
" fl.EulerDensity,\n", | ||
" fl.OzakiDensity,\n", | ||
" fl.ShojiOzakiDensity,\n", | ||
" fl.ElerianDensity,\n", | ||
" fl.KesslerDensity,\n", | ||
" fl.DrozdovDensity,\n", | ||
" ],\n", | ||
"):\n", | ||
" model = fl.models.OrnsteinUhlenbeck()\n", | ||
" estimator = fl.LikelihoodEstimator(transitioncls(model))\n", | ||
" coeffs_vals = np.empty((len(data_dts), len(model.coefficients)))\n", | ||
" for n, data in enumerate(data_dts):\n", | ||
" res = estimator.fit_fetch(data)\n", | ||
" coeffs_vals[n, :] = res.coefficients\n", | ||
" for n in range(len(axs)):\n", | ||
" axs[n].plot(list_dts, np.abs(coeffs_vals[:, n] - model_simu.coefficients[n]), \"-+\", label=name)\n", | ||
" print(coeffs_vals)\n", | ||
"for n in range(len(axs)):\n", | ||
" axs[n].legend()\n", | ||
" axs[n].set_yscale(\"log\")\n", | ||
" axs[n].grid()\n", | ||
" axs[n].set_xlabel(r\"$\\Delta t$\")\n", | ||
" axs[n].set_ylabel(r\"$|c-c_{real}|$\")\n", | ||
"plt.show()\n" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3.8", | ||
"language": "python", | ||
"name": "python3.8" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.18" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
111 changes: 111 additions & 0 deletions
111
.doctrees/nbsphinx/notebooks/statistical_performances/overdampedhiddenOU.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "2199d582", | ||
"metadata": {}, | ||
"source": [ | ||
"# Overdamped with hidden variables" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "ad5f8a73-e432-41db-bf0b-625ff80db5b6", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import folie as fl\n", | ||
"import matplotlib.pyplot as plt\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "0191d59f-9793-4efc-9fe7-fc53cd46f4d1", | ||
"metadata": {}, | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "b1a4b8c2-948a-4bcd-b4b2-6208c1684260", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"model_simu = model_simu = fl.models.OrnsteinUhlenbeck(dim=3)\n", | ||
"data_dts = []\n", | ||
"list_dts = [1e-3, 5e-3, 1e-2, 5e-2]\n", | ||
"for dt in list_dts:\n", | ||
" simulator = fl.Simulator(fl.simulations.ExactStepper(model_simu), dt, keep_dim=1)\n", | ||
" data_dts.append(simulator.run(5000, np.random.normal(loc=0.0, scale=1.0, size=(25, 3)), 25))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "a1d5f7af-d2e2-4511-aea2-e61c32f0929b", | ||
"metadata": {}, | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "473bb54a-7291-4019-9004-a6b260e9c599", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"fig, axs = plt.subplots(1, len(model_simu.coefficients))\n", | ||
"\n", | ||
"for name, transitioncls in zip(\n", | ||
" [\"Euler\"],\n", | ||
" [\n", | ||
" fl.EulerDensity,\n", | ||
" ],\n", | ||
"):\n", | ||
" fun_lin = fl.functions.Linear().fit(data_dts[0])\n", | ||
" fun_frct = fl.functions.Constant().fit(data_dts[0])\n", | ||
" fun_cst = fl.functions.Constant().fit(data_dts[0])\n", | ||
" model = fl.models.OverdampedHidden(fun_lin, fun_frct, fun_cst, dim=1, dim_h=2)\n", | ||
" estimator = fl.EMEstimator(transitioncls(model), max_iter=15, verbose=2, verbose_interval=1)\n", | ||
" coeffs_vals = np.empty((len(data_dts), len(model.coefficients)))\n", | ||
" for n, data in enumerate(data_dts):\n", | ||
" res = estimator.fit_fetch(\n", | ||
" data[\n", | ||
" :,\n", | ||
" ]\n", | ||
" )\n", | ||
" coeffs_vals[n, :] = res.coefficients\n", | ||
" for n in range(len(axs)):\n", | ||
" axs[n].plot(list_dts, np.abs(coeffs_vals[:, n] - model_simu.coefficients[n]), \"-+\", label=name)\n", | ||
"for n in range(len(axs)):\n", | ||
" axs[n].legend()\n", | ||
" axs[n].set_yscale(\"log\")\n", | ||
" axs[n].grid()\n", | ||
" axs[n].set_xlabel(\"$\\\\Delta t\")\n", | ||
" axs[n].set_ylabel(\"$|c-c_{real}|$\")\n", | ||
"plt.show()\n" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3.8", | ||
"language": "python", | ||
"name": "python3.8" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.18" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.