some mods

This commit is contained in:
Jens Jasche 2024-06-11 12:10:29 +02:00
parent e5aa8e5d24
commit 71b93af8e8

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "2863fcc5", "id": "7a9ce3d8",
"metadata": {}, "metadata": {},
"source": [ "source": [
"# Create ICs on Demand" "# Create ICs on Demand"
@ -11,7 +11,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"id": "26d5bda1", "id": "3b5cc730",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -26,7 +26,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "c90efc94", "id": "3b4e1ada",
"metadata": {}, "metadata": {},
"source": [ "source": [
"# Setup the model" "# Setup the model"
@ -35,7 +35,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 2,
"id": "603fb2f7", "id": "b521b99e",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -59,7 +59,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "6801dea6", "id": "066fb79e",
"metadata": {}, "metadata": {},
"source": [ "source": [
"# test training with white noise" "# test training with white noise"
@ -68,7 +68,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 6,
"id": "43ae8f71", "id": "8001a82b",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -100,7 +100,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 7,
"id": "a9716f58", "id": "46589304",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -134,7 +134,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "f82355d9", "id": "623c9205",
"metadata": {}, "metadata": {},
"source": [ "source": [
"# load BORG data" "# load BORG data"
@ -143,7 +143,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 8,
"id": "733a7793", "id": "725f2c38",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -168,7 +168,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 9,
"id": "8542d959", "id": "ae7e24a8",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -196,7 +196,7 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "dc019fd6", "id": "1abeba05",
"metadata": {}, "metadata": {},
"source": [ "source": [
"## generate sample" "## generate sample"
@ -205,7 +205,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 10,
"id": "b7ae1741", "id": "8d7b6bf2",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -238,41 +238,16 @@
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "9e7daea8", "id": "7b286278",
"metadata": {}, "metadata": {},
"source": [ "source": [
"## get an ensemble" "## get an ensemble"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"id": "36fe2f0b",
"metadata": {},
"outputs": [],
"source": [
"def incremental_variance(xs):\n",
" w_sum = w_sum2 = mean = S = 0\n",
"\n",
" for x in xs:\n",
" w_sum = w_sum + w\n",
" w_sum2 = w_sum2 + w**2\n",
" mean_old = mean\n",
" mean = mean_old + (w / w_sum) * (x - mean_old)\n",
" S = S + w * (x - mean_old) * (x - mean)\n",
"\n",
" population_variance = S / w_sum\n",
" # Bessel's correction for weighted samples\n",
" # Frequency weights\n",
" sample_frequency_variance = S / (w_sum - 1)\n",
" # Reliability weights\n",
" sample_reliability_variance = S / (w_sum - w_sum2 / w_sum)"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 29, "execution_count": 29,
"id": "80e8b13e", "id": "99a8d21a",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -308,7 +283,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 30,
"id": "80c14c44", "id": "2169349e",
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -348,7 +323,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "754e543e", "id": "7dbea77a",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []