pyEDM Examples
from pyEDM import *
import matplotlib.pyplot as plt
tentmap = sampleData['TentMap']
tentmapNoise = sampleData['TentMapNoise']
plt.plot( tentmap['TentMap'][1:40] );
Evaluate optimal embedding dimension (via Simplex)
EmbedDimension( dataFrame = tentmap, lib = "1 100", pred = "201 500",
columns = "TentMap" );
Optimal embedding dimension is E = 2
Evaluate nonlinearity
PredictInterval( dataFrame = tentmap, lib = "1 100", pred = "251 500",
columns = "TentMap", E = 2 );
Decay in predictability as forecast interval increases is an indication of nonlinearity.
Simplex prediction
Simplex( dataFrame = tentmapNoise, lib = "1 500", pred = "501 550",
columns = "TentMap", E = 2, showPlot = True );
Simplex Prediction using multivariate embedding
block_3sp = sampleData['block_3sp']
block_3sp.head(3)
# embedded = True
Simplex( dataFrame = block_3sp, lib = "1 99", pred = "100 195",
E = 3, columns = "x_t y_t z_t", target = "x_t",
embedded = True, showPlot = True );
Evaluate optimal SMap theta parameter indicating state-dependence and extent of nonlinearity
PredictNonlinear( dataFrame = tentmapNoise, lib = "1 100", pred = "201 500",
columns = "TentMap", E = 2 );
SMap theta parameter in the range of [2-3] provides optimal resolution. The non-zero theta peak of predictability indicates nonlinearity.
SMap Prediction
SMap( dataFrame = tentmapNoise, lib = "1 500", pred = "501 550",
columns = "TentMap", E = 2, theta = 3, showPlot = True );
SMap Prediction multivariate embedding
# embedded = True
SMap( dataFrame = sampleData[ 'circle' ],
lib = "1 100", pred = "110 190", theta = 4, E = 2,
embedded = True, columns = "x y", target = "x", showPlot = True );
Inference of causality via Convergent Cross Mapping (CCM)
sardine_anchovy_sst = sampleData['sardine_anchovy_sst']
sardine_anchovy_sst[['anchovy','np_sst']].plot();
CCM( dataFrame = sardine_anchovy_sst, E = 3,
columns = "anchovy", target = "np_sst",
libSizes = "10 75 5", sample = 100, showPlot = True );
The CCM result anchovy::np_sst is interpreted as: sea surface temperature (np_sst) influences anchovy population. The reverse influence (np_sst::anchovy) indicates no link, consistent with the fact that anchovy population does not influence sea surface temperature.
Multiview Embedding
MV = Multiview( dataFrame = block_3sp, lib = "1 99", pred = "105 190", E = 3,
columns = "x_t y_t z_t", target = "x_t", showPlot = True );
MV['View']
# Col_i are column indices in block_3sp