Created
April 3, 2018 15:51
-
-
Save halleysfifthinc/32c55697e5ad7a3cb7b83867d497bb27 to your computer and use it in GitHub Desktop.
The first minimum of the mutual information function using a number of different *kth* nearest neighbors.
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"using ChaosTools, DataFrames" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<table class=\"data-frame\"><thead><tr><th></th><th>k</th><th>N10e2</th></tr></thead><tbody><tr><th>1</th><td>1</td><td>15</td></tr><tr><th>2</th><td>2</td><td>16</td></tr><tr><th>3</th><td>3</td><td>11</td></tr><tr><th>4</th><td>4</td><td>12</td></tr><tr><th>5</th><td>5</td><td>13</td></tr><tr><th>6</th><td>100</td><td>7</td></tr><tr><th>7</th><td>250</td><td>5</td></tr><tr><th>8</th><td>500</td><td>2</td></tr></tbody></table>" | |
], | |
"text/plain": [ | |
"8×2 DataFrames.DataFrame\n", | |
"│ Row │ k │ N10e2 │\n", | |
"├─────┼─────┼───────┤\n", | |
"│ 1 │ 1 │ 15 │\n", | |
"│ 2 │ 2 │ 16 │\n", | |
"│ 3 │ 3 │ 11 │\n", | |
"│ 4 │ 4 │ 12 │\n", | |
"│ 5 │ 5 │ 13 │\n", | |
"│ 6 │ 100 │ 7 │\n", | |
"│ 7 │ 250 │ 5 │\n", | |
"│ 8 │ 500 │ 2 │" | |
] | |
}, | |
"execution_count": 2, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"N = 10e2\n", | |
"\n", | |
"ks = [ collect(1:5); [ Int(N*0.1), Int(N*0.25), Int(N*0.5) ]]\n", | |
"N10e2 = zeros(Int,length(ks))\n", | |
"\n", | |
"ds = Systems.henon()\n", | |
"data = trajectory(ds,N;dt=1)\n", | |
"x = data[:,1]\n", | |
"\n", | |
"for k in eachindex(ks)\n", | |
" N10e2[k] = estimate_delay(x,\"mutual_inf\"; k=ks[k])\n", | |
"end\n", | |
"\n", | |
"dfN10e2 = DataFrame(k = ks, N10e2 = N10e2)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<table class=\"data-frame\"><thead><tr><th></th><th>k</th><th>N10e3</th></tr></thead><tbody><tr><th>1</th><td>1</td><td>22</td></tr><tr><th>2</th><td>2</td><td>24</td></tr><tr><th>3</th><td>3</td><td>25</td></tr><tr><th>4</th><td>4</td><td>18</td></tr><tr><th>5</th><td>5</td><td>19</td></tr><tr><th>6</th><td>1000</td><td>8</td></tr><tr><th>7</th><td>2500</td><td>3</td></tr><tr><th>8</th><td>5000</td><td>1</td></tr></tbody></table>" | |
], | |
"text/plain": [ | |
"8×2 DataFrames.DataFrame\n", | |
"│ Row │ k │ N10e3 │\n", | |
"├─────┼──────┼───────┤\n", | |
"│ 1 │ 1 │ 22 │\n", | |
"│ 2 │ 2 │ 24 │\n", | |
"│ 3 │ 3 │ 25 │\n", | |
"│ 4 │ 4 │ 18 │\n", | |
"│ 5 │ 5 │ 19 │\n", | |
"│ 6 │ 1000 │ 8 │\n", | |
"│ 7 │ 2500 │ 3 │\n", | |
"│ 8 │ 5000 │ 1 │" | |
] | |
}, | |
"execution_count": 3, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"N = 10e3\n", | |
"\n", | |
"ks = [ collect(1:5); [ Int(N*0.1), Int(N*0.25), Int(N*0.5) ]]\n", | |
"N10e3 = zeros(Int,length(ks))\n", | |
"\n", | |
"ds = Systems.henon()\n", | |
"data = trajectory(ds,N;dt=1)\n", | |
"x = data[:,1]\n", | |
"\n", | |
"for k in eachindex(ks)\n", | |
" N10e3[k] = estimate_delay(x,\"mutual_inf\"; k=ks[k])\n", | |
"end\n", | |
"\n", | |
"dfN10e3 = DataFrame(k = ks, N10e3 = N10e3)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Julia 0.6.2", | |
"language": "julia", | |
"name": "julia-0.6" | |
}, | |
"language_info": { | |
"file_extension": ".jl", | |
"mimetype": "application/julia", | |
"name": "julia", | |
"version": "0.6.2" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment