-
Notifications
You must be signed in to change notification settings - Fork 8
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 00d2b59
Showing
511 changed files
with
67,477 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: cc44cf10018c4aa3ef2bb959c238c120 | ||
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 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
+8.63 KB
.doctrees/api/generated/cbx.utils.objective_handling.cbx_objective.doctree
Binary file not shown.
Binary file added
BIN
+8.32 KB
.doctrees/api/generated/cbx.utils.objective_handling.cbx_objective_f1D.doctree
Binary file not shown.
Binary file added
BIN
+8.62 KB
.doctrees/api/generated/cbx.utils.objective_handling.cbx_objective_f2D.doctree
Binary file not shown.
Binary file added
BIN
+8.59 KB
.doctrees/api/generated/cbx.utils.objective_handling.cbx_objective_fh.doctree
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+9.19 KB
.doctrees/api/generated/cbx.utils.resampling.ensemble_update_resampling.doctree
Binary file not shown.
Binary file added
BIN
+10.4 KB
.doctrees/api/generated/cbx.utils.resampling.loss_update_resampling.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+8.33 KB
.doctrees/api/generated/cbx.utils.termination.energy_tol_term.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.
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,110 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c70df536-cea0-4cdf-bd6a-601824a52768", | ||
"metadata": {}, | ||
"source": [ | ||
"# Custom Noise CBX\n", | ||
"\n", | ||
"This notebook showcases, how to use a custom noise function." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "33394a7d-caa6-4f01-aa88-4dd69d5c400d", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from cbx.dynamics import CBO\n", | ||
"import numpy as np" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "ef05a88a-d000-4ea8-af21-714df66858fa", | ||
"metadata": {}, | ||
"source": [ | ||
"## Define the custom noise function\n", | ||
"\n", | ||
"In this case we select that the noise should be zero" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "319270d9-01d4-49c0-8ac5-ab94bd6c327b", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def custom_noise(dyn):\n", | ||
" return np.zeros(dyn.drift.shape)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "08dac699-4772-4409-8e25-2a398216a2f4", | ||
"metadata": {}, | ||
"source": [ | ||
"## Define a loss function and test the method" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "aae8cac4-7a04-41a2-b9ee-a0c8c26e27da", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def f(x):\n", | ||
" return np.linalg.norm(x, axis=-1)\n", | ||
"\n", | ||
"x0 = np.random.normal(0,1,(4,7,26))\n", | ||
"dyn_cn = CBO(f, x=x0, noise=custom_noise, max_it=10, verbosity = 0)\n", | ||
"x_cn = dyn_cn.optimize()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "762bcbf2-6861-4c21-8475-3e6b45e35fdb", | ||
"metadata": {}, | ||
"source": [ | ||
"Using this noise is equivalent to specifying ``sigma=0`` with standard CBO. So let's test, if this is the case:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "f1f11124-6a10-4e54-abef-4168cbfd6dbc", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"dyn = CBO(f, x=x0, sigma=0, max_it=10, verbosity = 0)\n", | ||
"x = dyn.optimize()\n", | ||
"print('L-infinty Error between the custom noise solution and standard CBO with sigma=0: ' + str(np.abs(x-x_cn).max()))" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"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.12.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.