{{ message }}

Instantly share code, notes, and snippets.

# halleysfifthinc/Mutual information first minimum.ipynb

Created Apr 3, 2018
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": [ "
kN10e2
1115
2216
3311
4412
5513
61007
72505
85002
" ], "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": [ "
kN10e3
1122
2224
3325
4418
5519
610008
725003
850001
" ], "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 }