Skip to content

Commit

Permalink
deploy: 7b29285
Browse files Browse the repository at this point in the history
  • Loading branch information
TimRoith committed Aug 16, 2024
0 parents commit 00d2b59
Show file tree
Hide file tree
Showing 511 changed files with 67,477 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .buildinfo
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 added .doctrees/api/dynamic.doctree
Binary file not shown.
Binary file added .doctrees/api/generated/cbx.dynamics.CBO.doctree
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/api/generated/cbx.dynamics.CBS.doctree
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/api/generated/cbx.dynamics.PSO.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 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 .doctrees/api/index.doctree
Binary file not shown.
Binary file added .doctrees/api/objectives.doctree
Binary file not shown.
Binary file added .doctrees/api/plotting.doctree
Binary file not shown.
Binary file added .doctrees/api/scheduler.doctree
Binary file not shown.
Binary file added .doctrees/api/utils.doctree
Binary file not shown.
Binary file added .doctrees/environment.pickle
Binary file not shown.
Binary file added .doctrees/examples/custom_noise.doctree
Binary file not shown.
Binary file added .doctrees/examples/low_level.doctree
Binary file not shown.
Binary file added .doctrees/examples/nns/mnist.doctree
Binary file not shown.
Binary file added .doctrees/examples/onedim_example.doctree
Binary file not shown.
Binary file added .doctrees/examples/polarcbo.doctree
Binary file not shown.
Binary file added .doctrees/examples/sampling.doctree
Binary file not shown.
Binary file added .doctrees/examples/simple_example.doctree
Binary file not shown.
Binary file added .doctrees/examples/success_evaluation.doctree
Binary file not shown.
Binary file added .doctrees/index.doctree
Binary file not shown.
110 changes: 110 additions & 0 deletions .doctrees/nbsphinx/examples/custom_noise.ipynb
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
}
163 changes: 163 additions & 0 deletions .doctrees/nbsphinx/examples/low_level.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 00d2b59

Please sign in to comment.