├── .gitignore ├── .gitmodules ├── CITATION.cff ├── LICENSE ├── MANIFEST.in ├── README.md ├── apps ├── .gitignore ├── CCM_Matrix.py ├── CrossMap_ColumnList.py ├── CrossMap_Columns.py ├── CrossMap_Matrix.py ├── EmbedDim_Columns.py ├── Embedding.py ├── SMap_Tp.py ├── SMap_theta.py └── tests │ ├── .gitignore │ ├── CLI_tests.py │ └── pyEDM_apps_tests.ipynb ├── doc ├── pyEDM.odt └── pyEDM.pdf ├── pyproject.toml └── src ├── .gitignore └── pyEDM ├── .gitignore ├── API.py ├── AuxFunc.py ├── CCM.py ├── EDM.py ├── Formatting.py ├── LoadData.py ├── Multiview.py ├── Neighbors.py ├── PoolFunc.py ├── SMap.py ├── Simplex.py ├── __init__.py ├── data ├── LorenzData1000.csv ├── S12CD-S333-SumFlow_1980-2005.csv ├── TentMap.csv ├── TentMapNoise.csv ├── block_3sp.csv ├── circle.csv ├── circle_noTime.csv ├── circle_noise.csv ├── columnNameSpace.csv └── sardine_anchovy_sst.csv └── tests ├── .gitignore ├── examples.py ├── smapSolverTest.py ├── tests.py └── validation ├── CCM_Lorenz5D_MV_Space_valid.csv ├── CCM_Lorenz5D_MV_valid.csv ├── CCM_anch_sst_valid.csv ├── CCM_nan_valid.csv ├── EmbedDim_valid.csv ├── Multiview_combos_valid.csv ├── Multiview_pred_valid.csv ├── PredictInterval_valid.csv ├── PredictNonlinear_valid.csv ├── SMap_circle_E2_embd_valid.csv ├── SMap_circle_E4_valid.csv ├── SMap_nan_valid.csv ├── SMap_noTime_valid.csv ├── Smplx_DateTime_valid.csv ├── Smplx_E3_block_3sp_valid.csv ├── Smplx_E3_embd_block_3sp_valid.csv ├── Smplx_disjointLib_valid.csv ├── Smplx_disjointPred_nan_valid.csv ├── Smplx_exclRadius_valid.csv ├── Smplx_nan2_valid.csv ├── Smplx_nan_valid.csv ├── Smplx_negTp_block_3sp_valid.csv └── Smplx_validLib_valid.csv /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | dist 3 | etc 4 | __pycache__ 5 | src/pyEDM.egg-info 6 | src/pyEDM/__pycache__ 7 | src/pyEDM/tests/__pycache__ 8 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SugiharaLab/pyEDM/11bbebe323c74fc6765292bf7e5f53510bada9ce/.gitmodules -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.2.0 2 | title: pyEDM 3 | message: >- 4 | If you use this software please cite. 5 | type: software 6 | authors: 7 | - given-names: Joseph 8 | family-names: Park 9 | email: josephpark@ieee.org 10 | orcid: 'https://orcid.org/0000-0001-5411-1409' 11 | - {} 12 | identifiers: 13 | - type: url 14 | value: 'https://github.com/SugiharaLab/pyEDM' 15 | repository-code: 'https://github.com/SugiharaLab/pyEDM' 16 | url: 'https://github.com/SugiharaLab/pyEDM#readme' 17 | repository: 'https://pypi.org/project/pyEDM/' 18 | abstract: >- 19 | Python implementation of EDM tools developed at the 20 | Sugihara Lab, UCSD Scripps Institution of Oceanography. 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 The Regents of the University of California. 2 | All Rights Reserved. 3 | 4 | Permission to copy, modify, and distribute this software and its 5 | documentation for educational, research and non-profit purposes, 6 | without fee, and without a written agreement is hereby granted, 7 | provided that the above copyright notice, this paragraph and the 8 | following three paragraphs appear in all copies. 9 | 10 | Those desiring to incorporate this software into commercial products 11 | or use for commercial purposes should contact: 12 | 13 | Office of Innovation & Commercialization 14 | University of California, San Diego 15 | 9500 Gilman Drive, Mail Code 0910 16 | La Jolla, CA 92093-0910 17 | Ph: (858) 534-5815, FAX: (858) 534-7345 18 | E-MAIL:invent@ucsd.edu. 19 | 20 | IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY 21 | PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 22 | DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED 24 | OF THE POSSIBILITY OF SUCH DAMAGE. 25 | 26 | THE SOFTWARE PROVIDED HEREIN IS ON AN "AS IS" BASIS, AND THE 27 | UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, 28 | SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. THE UNIVERSITY 29 | OF CALIFORNIA MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES 30 | OF ANY KIND, EITHER IMPLIED OR EXPRESS, INCLUDING, BUT NOT LIMITED 31 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A 32 | PARTICULAR PURPOSE, OR THAT THE USE OF THE SOFTWARE WILL NOT 33 | INFRINGE ANY PATENT, TRADEMARK OR OTHER RIGHTS. 34 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include src/pyEDM/data/*.csv 2 | include src/pyEDM/tests/*.py 3 | include src/pyEDM/tests/validation/*.csv 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Empirical Dynamic Modeling (EDM) 2 | --- 3 | This package provides a Python/Pandas DataFrame toolset for [EDM analysis](http://deepeco.ucsd.edu/nonlinear-dynamics-research/edm/ "EDM @ Sugihara Lab"). Introduction and documentation are are avilable [online](https://sugiharalab.github.io/EDM_Documentation/ "EDM Docs"), or in the package [API docs](https://github.com/SugiharaLab/pyEDM/blob/master/doc/pyEDM.pdf "pyEDM API"). A Jupyter notebook interface is available at [jpyEDM](https://github.com/SugiharaLab/jpyEDM#empirical-dynamic-modeling-edm-jupyter-notebook). 4 | 5 | Functionality includes: 6 | * Simplex projection ([Sugihara and May 1990](https://www.nature.com/articles/344734a0)) 7 | * Sequential Locally Weighted Global Linear Maps (S-Map) ([Sugihara 1994](https://royalsocietypublishing.org/doi/abs/10.1098/rsta.1994.0106)) 8 | * Multivariate embeddings ([Dixon et. al. 1999](https://science.sciencemag.org/content/283/5407/1528)) 9 | * Convergent cross mapping ([Sugihara et. al. 2012](https://science.sciencemag.org/content/338/6106/496)) 10 | * Multiview embedding ([Ye and Sugihara 2016](https://science.sciencemag.org/content/353/6302/922)) 11 | 12 | --- 13 | ## Installation 14 | 15 | ### Python Package Index (PyPI) 16 | Certain MacOS, Linux and Windows platforms are supported with prebuilt binary distributions hosted on PyPI [pyEDM](https://pypi.org/project/pyEDM/) and can be installed with the Python pip module: `python -m pip install pyEDM` 17 | 18 | --- 19 | ## Usage 20 | Examples can be executed in the python command line: 21 | ```python 22 | >>> import pyEDM 23 | >>> pyEDM.Examples() 24 | ``` 25 | 26 | --- 27 | ### References 28 | Sugihara G. and May R. 1990. Nonlinear forecasting as a way of distinguishing 29 | chaos from measurement error in time series. [Nature, 344:734–741](https://www.nature.com/articles/344734a0). 30 | 31 | Sugihara G. 1994. Nonlinear forecasting for the classification of natural 32 | time series. [Philosophical Transactions: Physical Sciences and 33 | Engineering, 348 (1688) : 477–495](https://royalsocietypublishing.org/doi/abs/10.1098/rsta.1994.0106). 34 | 35 | Dixon, P. A., M. Milicich, and G. Sugihara, 1999. Episodic fluctuations in larval supply. [Science 283:1528–1530](https://science.sciencemag.org/content/283/5407/1528). 36 | 37 | Sugihara G., May R., Ye H., Hsieh C., Deyle E., Fogarty M., Munch S., 2012. 38 | Detecting Causality in Complex Ecosystems. [Science 338:496-500](https://science.sciencemag.org/content/338/6106/496). 39 | 40 | Ye H., and G. Sugihara, 2016. Information leverage in interconnected 41 | ecosystems: Overcoming the curse of dimensionality. [Science 353:922–925](https://science.sciencemag.org/content/353/6302/922). 42 | -------------------------------------------------------------------------------- /apps/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | -------------------------------------------------------------------------------- /apps/CrossMap_ColumnList.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import time, argparse 4 | from multiprocessing import Pool 5 | from itertools import repeat 6 | 7 | from pandas import DataFrame, read_csv, concat 8 | from pyEDM import Simplex, sampleData 9 | from matplotlib import pyplot as plt 10 | 11 | #---------------------------------------------------------------------------- 12 | # 13 | #---------------------------------------------------------------------------- 14 | def CrossMap_ColumnList( data, columns = [], target = None, E = 0, 15 | Tp = 1, tau = -1, exclusionRadius = 0, 16 | lib = None, pred = None, embedded = False, 17 | cores = 5, outputFile = None, noTime = False, 18 | verbose = False, plot = False ): 19 | 20 | '''Use multiprocessing Pool to process parallelise Simplex. 21 | columns is a list of columns to be cross mapped against 22 | the target (-t). columns can be a list of single columns, 23 | or list of multiple columns. 24 | Return : dict '{columns[i]}:{target}' : Simplex DataFrame 25 | ''' 26 | 27 | startTime = time.time() 28 | 29 | if not len( columns ) : 30 | raise( RuntimeError( 'columns list required' ) ) 31 | 32 | if not target : 33 | raise( RuntimeError( 'target required' ) ) 34 | 35 | # If no lib and pred, create from full data span 36 | if not lib : 37 | lib = [ 1, data.shape[0] ] 38 | if not pred : 39 | pred = [ 1, data.shape[0] ] 40 | 41 | if noTime : 42 | dataColumns = data.columns 43 | else : 44 | # Ignore first data column, convert to list 45 | dataColumns = data.columns[ 1 : len(data.columns) ].to_list() 46 | 47 | # Dictionary of arguments for Pool : SimplexFunc 48 | argsD = { 'target' : target, 'lib' : lib, 'pred' : pred, 'E' : E, 49 | 'embedded' : embedded, 'exclusionRadius' : exclusionRadius, 50 | 'Tp' : Tp, 'tau' : tau, 'noTime' : noTime } 51 | 52 | # Create iterable for Pool.starmap, use repeated copies of argsD, data 53 | poolArgs = zip( columns, repeat( argsD ), repeat( data ) ) 54 | 55 | # Use pool.starmap to distribute among cores 56 | with Pool( processes = cores ) as pool : 57 | CMList = pool.starmap( SimplexFunc, poolArgs ) 58 | 59 | # Load CMList results into dictionary 60 | D = {} 61 | for i in range( len( columns ) ) : 62 | D[ f'{columns[i]}:{target}' ] = CMList[ i ] 63 | 64 | if verbose : 65 | print( "Elapsed time:", round( time.time() - startTime, 2 ) ) 66 | 67 | print( D.keys() ) 68 | 69 | if plot : 70 | df = D[ list( D.keys() )[-1] ] 71 | df.plot( df.columns[0], df.columns[1:3], linewidth = 3, 72 | ylabel = list( D.keys() )[-1] ) 73 | plt.show() 74 | 75 | if outputFile : 76 | df.to_csv( outputFile ) 77 | 78 | return D 79 | 80 | #---------------------------------------------------------------------------- 81 | #---------------------------------------------------------------------------- 82 | def SimplexFunc( columns, argsD, data ): 83 | '''Call pyEDM Simplex using the column, args, and data''' 84 | 85 | df = Simplex( dataFrame = data, 86 | columns = columns, 87 | target = argsD['target'], 88 | lib = argsD['lib'], 89 | pred = argsD['pred'], 90 | E = argsD['E'], 91 | embedded = argsD['embedded'], 92 | exclusionRadius = argsD['exclusionRadius'], 93 | Tp = argsD['Tp'], 94 | tau = argsD['tau'], 95 | noTime = argsD['noTime'], 96 | showPlot = False ) 97 | 98 | return df 99 | 100 | #---------------------------------------------------------------------------- 101 | #---------------------------------------------------------------------------- 102 | def CrossMap_ColumnList_CmdLine(): 103 | '''Wrapper for CrossMap_ColumnList with command line parsing''' 104 | 105 | args = ParseCmdLine() 106 | 107 | # Read data 108 | # If -i input file: load it, else look for inputData in sampleData 109 | if args.inputFile: 110 | dataFrame = read_csv( args.inputFile ) 111 | elif args.inputData: 112 | dataFrame = sampleData[ args.inputData ] 113 | else: 114 | raise RuntimeError( "Invalid inputFile or inputData" ) 115 | 116 | # Call CrossMap_ColumnList() 117 | df = CrossMap_ColumnList( data = dataFrame, 118 | columns = args.columns, target = args.target, 119 | E = args.E, Tp = args.Tp, tau = args.tau, 120 | exclusionRadius = args.exclusionRadius, 121 | lib = args.lib, pred = args.pred, 122 | cores = args.cores, noTime = args.noTime, 123 | outputFile = args.outputFile, 124 | verbose = args.verbose, plot = args.Plot ) 125 | 126 | #---------------------------------------------------------------------------- 127 | #---------------------------------------------------------------------------- 128 | def ParseCmdLine(): 129 | 130 | parser = argparse.ArgumentParser( description = 'CrossMap Column List' ) 131 | 132 | parser.add_argument('-i', '--inputFile', 133 | dest = 'inputFile', type = str, 134 | action = 'store', 135 | default = None, 136 | help = 'Input data file.') 137 | 138 | parser.add_argument('-d', '--inputData', 139 | dest = 'inputData', type = str, 140 | action = 'store', 141 | default = 'Lorenz5D', 142 | help = 'Input data frame name.') 143 | 144 | parser.add_argument('-o', '--outputFile', 145 | dest = 'outputFile', type = str, 146 | action = 'store', 147 | default = None, 148 | help = 'Output file.') 149 | 150 | parser.add_argument('-E', '--E', 151 | dest = 'E', type = int, 152 | action = 'store', 153 | default = 0, 154 | help = 'E.') 155 | 156 | parser.add_argument('-x', '--exclusionRadius', 157 | dest = 'exclusionRadius', type = int, 158 | action = 'store', 159 | default = 0, 160 | help = 'Exclusion Radius.') 161 | 162 | parser.add_argument('-T', '--Tp', 163 | dest = 'Tp', type = int, 164 | action = 'store', 165 | default = 1, 166 | help = 'Tp.') 167 | 168 | parser.add_argument('-tau', '--tau', 169 | dest = 'tau', type = int, 170 | action = 'store', 171 | default = -1, 172 | help = 'tau.') 173 | 174 | parser.add_argument('-cols', '--columns', nargs = '*', 175 | dest = 'columns', type = str, 176 | action = 'store', 177 | default = [], 178 | help = 'List of columns.') 179 | 180 | parser.add_argument('-t', '--target', 181 | dest = 'target', type = str, 182 | action = 'store', 183 | default = 'V5', 184 | help = 'Data target name.') 185 | 186 | parser.add_argument('-l', '--lib', nargs = '*', 187 | dest = 'lib', type = int, 188 | action = 'store', 189 | default = [], 190 | help = 'library indices.') 191 | 192 | parser.add_argument('-p', '--pred', nargs = '*', 193 | dest = 'pred', type = int, 194 | action = 'store', 195 | default = [], 196 | help = 'prediction indices.') 197 | 198 | parser.add_argument('-C', '--cores', 199 | dest = 'cores', type = int, 200 | action = 'store', 201 | default = 5, 202 | help = 'Multiprocessing cores.') 203 | 204 | parser.add_argument('-nT', '--noTime', 205 | dest = 'noTime', 206 | action = 'store_true', 207 | default = False, 208 | help = 'noTime.') 209 | 210 | parser.add_argument('-v', '--verbose', 211 | dest = 'verbose', 212 | action = 'store_true', 213 | default = False, 214 | help = 'verbose.') 215 | 216 | parser.add_argument('-P', '--Plot', 217 | dest = 'Plot', 218 | action = 'store_true', 219 | default = False, 220 | help = 'Plot.') 221 | 222 | args = parser.parse_args() 223 | 224 | return args 225 | 226 | #---------------------------------------------------------------------------- 227 | # Provide for cmd line invocation and clean module loading 228 | if __name__ == "__main__": 229 | CrossMap_ColumnList_CmdLine() 230 | -------------------------------------------------------------------------------- /apps/CrossMap_Columns.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import time, argparse 4 | from multiprocessing import Pool 5 | from itertools import repeat 6 | 7 | from pandas import DataFrame, read_csv, concat 8 | from pyEDM import Simplex, sampleData 9 | from matplotlib import pyplot as plt 10 | 11 | #---------------------------------------------------------------------------- 12 | # 13 | #---------------------------------------------------------------------------- 14 | def CrossMap_Columns( data, target = None, E = 0, 15 | Tp = 1, tau = -1, exclusionRadius = 0, 16 | lib = None, pred = None, cores = 5, 17 | outputFile = None, noTime = False, 18 | verbose = False, plot = False ): 19 | 20 | '''Use multiprocessing Pool to process parallelise Simplex. 21 | The target (-t) argument specifies a column against which all 22 | other columns are cross mapped. 23 | Return dict '{columns[i]}:{target}' : Simplex DataFrame 24 | ''' 25 | 26 | startTime = time.time() 27 | 28 | if not target : 29 | raise( RuntimeError( 'target required' ) ) 30 | 31 | # If no lib and pred, create from full data span 32 | if not lib : 33 | lib = [ 1, data.shape[0] ] 34 | if not pred : 35 | pred = [ 1, data.shape[0] ] 36 | 37 | # Ignore first column, convert to list 38 | if not noTime : 39 | columns = data.columns[ 1 : len(data.columns) ].to_list() 40 | 41 | # Dictionary of arguments for Pool : SimplexFunc 42 | argsD = { 'lib' : lib, 'pred' : pred, 'E' : E, 43 | 'exclusionRadius' : exclusionRadius, 'Tp' : Tp, 44 | 'tau' : tau, 'target' : target, 'noTime' : noTime } 45 | 46 | # Create iterable for Pool.starmap, use repeated copies of argsD, data 47 | poolArgs = zip( columns, repeat( argsD ), repeat( data ) ) 48 | 49 | # Use pool.starmap to distribute among cores 50 | with Pool( processes = cores ) as pool : 51 | CMList = pool.starmap( SimplexFunc, poolArgs ) 52 | 53 | # Load CMList results into dictionary 54 | D = {} 55 | for i in range( len( columns ) ) : 56 | D[ f'{columns[i]}:{target}' ] = CMList[ i ] 57 | 58 | if verbose : 59 | print( "Elapsed time:", round( time.time() - startTime, 2 ) ) 60 | 61 | print( D.keys() ) 62 | 63 | if plot : 64 | df = D[ list( D.keys() )[-1] ] 65 | df.plot( df.columns[0], df.columns[1:3], linewidth = 3, 66 | ylabel = list( D.keys() )[-1] ) 67 | plt.show() 68 | 69 | if outputFile : 70 | df.to_csv( outputFile ) 71 | 72 | return D 73 | 74 | #---------------------------------------------------------------------------- 75 | #---------------------------------------------------------------------------- 76 | def SimplexFunc( column, argsD, data ): 77 | '''Call pyEDM Simplex using the column, args, and data''' 78 | 79 | df = Simplex( dataFrame = data, 80 | columns = column, 81 | target = argsD['target'], 82 | lib = argsD['lib'], 83 | pred = argsD['pred'], 84 | E = argsD['E'], 85 | exclusionRadius = argsD['exclusionRadius'], 86 | Tp = argsD['Tp'], 87 | tau = argsD['tau'], 88 | noTime = argsD['noTime'], 89 | showPlot = False ) 90 | 91 | return df 92 | 93 | #---------------------------------------------------------------------------- 94 | #---------------------------------------------------------------------------- 95 | def CrossMap_Columns_CmdLine(): 96 | '''Wrapper for CrossMap_Columns with command line parsing''' 97 | 98 | args = ParseCmdLine() 99 | 100 | # Read data 101 | # If -i input file: load it, else look for inputData in sampleData 102 | if args.inputFile: 103 | dataFrame = read_csv( args.inputFile ) 104 | elif args.inputData: 105 | dataFrame = sampleData[ args.inputData ] 106 | else: 107 | raise RuntimeError( "Invalid inputFile or inputData" ) 108 | 109 | # Call CrossMap_Columns() 110 | df = CrossMap_Columns( data = dataFrame, target = args.target, 111 | E = args.E, Tp = args.Tp, tau = args.tau, 112 | exclusionRadius = args.exclusionRadius, 113 | lib = args.lib, pred = args.pred, 114 | cores = args.cores, noTime = args.noTime, 115 | outputFile = args.outputFile, 116 | verbose = args.verbose, plot = args.Plot ) 117 | 118 | #---------------------------------------------------------------------------- 119 | #---------------------------------------------------------------------------- 120 | def ParseCmdLine(): 121 | 122 | parser = argparse.ArgumentParser( description = 'CrossMap Columns' ) 123 | 124 | parser.add_argument('-i', '--inputFile', 125 | dest = 'inputFile', type = str, 126 | action = 'store', 127 | default = None, 128 | help = 'Input data file.') 129 | 130 | parser.add_argument('-d', '--inputData', 131 | dest = 'inputData', type = str, 132 | action = 'store', 133 | default = 'Lorenz5D', 134 | help = 'Input data frame name.') 135 | 136 | parser.add_argument('-o', '--outputFile', 137 | dest = 'outputFile', type = str, 138 | action = 'store', 139 | default = None, 140 | help = 'Output file.') 141 | 142 | parser.add_argument('-E', '--E', 143 | dest = 'E', type = int, 144 | action = 'store', 145 | default = 0, 146 | help = 'E.') 147 | 148 | parser.add_argument('-x', '--exclusionRadius', 149 | dest = 'exclusionRadius', type = int, 150 | action = 'store', 151 | default = 0, 152 | help = 'Exclusion Radius.') 153 | 154 | parser.add_argument('-T', '--Tp', 155 | dest = 'Tp', type = int, 156 | action = 'store', 157 | default = 1, 158 | help = 'Tp.') 159 | 160 | parser.add_argument('-tau', '--tau', 161 | dest = 'tau', type = int, 162 | action = 'store', 163 | default = -1, 164 | help = 'tau.') 165 | 166 | parser.add_argument('-t', '--target', 167 | dest = 'target', type = str, 168 | action = 'store', 169 | default = 'V5', 170 | help = 'Data target name.') 171 | 172 | parser.add_argument('-l', '--lib', nargs = '*', 173 | dest = 'lib', type = int, 174 | action = 'store', 175 | default = [], 176 | help = 'library indices.') 177 | 178 | parser.add_argument('-p', '--pred', nargs = '*', 179 | dest = 'pred', type = int, 180 | action = 'store', 181 | default = [], 182 | help = 'prediction indices.') 183 | 184 | parser.add_argument('-C', '--cores', 185 | dest = 'cores', type = int, 186 | action = 'store', 187 | default = 5, 188 | help = 'Multiprocessing cores.') 189 | 190 | parser.add_argument('-nT', '--noTime', 191 | dest = 'noTime', 192 | action = 'store_true', 193 | default = False, 194 | help = 'noTime.') 195 | 196 | parser.add_argument('-v', '--verbose', 197 | dest = 'verbose', 198 | action = 'store_true', 199 | default = False, 200 | help = 'verbose.') 201 | 202 | parser.add_argument('-P', '--Plot', 203 | dest = 'Plot', 204 | action = 'store_true', 205 | default = False, 206 | help = 'Plot.') 207 | 208 | args = parser.parse_args() 209 | 210 | return args 211 | 212 | #---------------------------------------------------------------------------- 213 | # Provide for cmd line invocation and clean module loading 214 | if __name__ == "__main__": 215 | CrossMap_Columns_CmdLine() 216 | -------------------------------------------------------------------------------- /apps/CrossMap_Matrix.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import time, argparse 4 | from multiprocessing import Pool 5 | from itertools import repeat, product 6 | 7 | from numpy import full, nan 8 | from pandas import DataFrame, read_csv, concat 9 | from pyEDM import Simplex, sampleData, ComputeError 10 | from matplotlib import pyplot as plt 11 | 12 | #---------------------------------------------------------------------------- 13 | # 14 | #---------------------------------------------------------------------------- 15 | def CrossMap_Matrix( data, E = 0, Tp = 1, 16 | tau = -1, exclusionRadius = 0, 17 | lib = None, pred = None, cores = 5, 18 | returnValue = 'matrix', # or 'dict' 19 | outputFile = None, noTime = False, 20 | verbose = False, plot = False ): 21 | 22 | '''Use multiprocessing Pool to process parallelize Simplex. 23 | All dataFrame columns are cross mapped to all others. 24 | E is a vector of embedding dimension for each column. 25 | if E is single value it is repeated for all columns. 26 | if returnValue == 'matrix' : NxN ndarray 27 | if returnValue == 'dict' : { column i : vector column rho } 28 | ''' 29 | 30 | startTime = time.time() 31 | 32 | # If no lib and pred, create from full data span 33 | if not lib : 34 | lib = [ 1, data.shape[0] ] 35 | if not pred : 36 | pred = [ 1, data.shape[0] ] 37 | 38 | if noTime : 39 | columns = data.columns.to_list() 40 | else : 41 | # Ignore first column 42 | columns = data.columns[ 1 : len(data.columns) ].to_list() 43 | 44 | N = len( columns ) 45 | 46 | if isinstance( E, int ) : 47 | E = [ e for e in repeat( E, len( columns ) ) ] 48 | elif len( E ) == 1 : 49 | E = [ e for e in repeat( E[0], len( columns ) ) ] 50 | if len( E ) != N : 51 | msg = 'CrossMap_Matrix() E must be scalar or length of data columns.' 52 | raise RuntimeError( msg ) 53 | 54 | if 'matrix' in returnValue : 55 | # Allocate matrix for cross map rho 56 | CM_mat = full ( ( N, N ), nan ) 57 | else : 58 | CM_mat = None 59 | 60 | if plot : 61 | msg = "CrossMap_Matrix() set returnValue = 'matrix' for plot." 62 | raise RuntimeError( msg ) 63 | 64 | # Iterable of all columns x columns 65 | allPairs = list( product( columns, columns ) ) 66 | # Group column tuples into matrix column sets of N 67 | matColumns = [ allPairs[ i:(i+N) ] for i in range(0, len(allPairs), N) ] 68 | 69 | # Dictionary of arguments for Pool : SimplexFunc 70 | argsD = { 'lib' : lib, 'pred' : pred, 71 | 'exclusionRadius' : exclusionRadius, 'Tp' : Tp, 72 | 'tau' : tau, 'noTime' : noTime } 73 | 74 | # Create iterable for Pool.starmap, use repeated copies of argsD, data 75 | poolArgs = zip( matColumns, E, repeat( argsD ), repeat( data ) ) 76 | 77 | # Use pool.starmap to distribute among cores 78 | with Pool( processes = cores ) as pool : 79 | CMList = pool.starmap( SimplexFunc, poolArgs ) 80 | 81 | # Load CMList results into dictionary and matrix 82 | D = {} 83 | for i in range( len( matColumns ) ) : 84 | if 'dict' in returnValue : 85 | D[ i ] = CMList[ i ] 86 | else : 87 | CM_mat[ i, : ] = CMList[ i ] 88 | 89 | if verbose : 90 | print( "Elapsed time:", round( time.time() - startTime, 2 ) ) 91 | 92 | if plot : 93 | PlotMatrix( CM_mat, columns, figsize = (5,5), dpi = 150, 94 | title = None, plot = True, plotFile = None ) 95 | 96 | if outputFile : 97 | if 'dict' in returnValue : 98 | df = DataFrame( D, index = columns ) 99 | else : 100 | df = DataFrame( CM_mat, index = columns, columns = columns ) 101 | df.to_csv( outputFile, index_label = 'variable' ) 102 | 103 | if 'matrix' in returnValue : 104 | return CM_mat 105 | else : 106 | return D 107 | 108 | #---------------------------------------------------------------------------- 109 | #---------------------------------------------------------------------------- 110 | def SimplexFunc( matColumns, E, argsD, data ): 111 | '''Call pyEDM Simplex using the column, args, and data 112 | Return prediction correlation 113 | 114 | Each matColumn is a 1xN list of column tuples : for the matrix columns 115 | ''' 116 | 117 | N = len( matColumns ) 118 | rhoCol = full( N, nan ) 119 | 120 | for i in range( N ) : 121 | column, target = matColumns[i] 122 | 123 | df = Simplex( dataFrame = data, 124 | columns = column, 125 | target = target, 126 | lib = argsD['lib'], 127 | pred = argsD['pred'], 128 | E = E, 129 | exclusionRadius = argsD['exclusionRadius'], 130 | Tp = argsD['Tp'], 131 | tau = argsD['tau'], 132 | noTime = argsD['noTime'], 133 | showPlot = False ) 134 | 135 | rho = ComputeError( df['Observations'], df['Predictions'] )['rho'] 136 | rhoCol[ i ] = rho 137 | 138 | return rhoCol 139 | 140 | #---------------------------------------------------------------------------- 141 | #---------------------------------------------------------------------------- 142 | def CrossMap_Matrix_CmdLine(): 143 | '''Wrapper for CrossMap_Matrix with command line parsing''' 144 | 145 | args = ParseCmdLine() 146 | 147 | # Read data 148 | # If -i input file: load it, else look for inputData in sampleData 149 | if args.inputFile: 150 | dataFrame = read_csv( args.inputFile ) 151 | elif args.inputData: 152 | dataFrame = sampleData[ args.inputData ] 153 | else: 154 | raise RuntimeError( "Invalid inputFile or inputData" ) 155 | 156 | # Call CrossMap_Matrix() 157 | df = CrossMap_Matrix( data = dataFrame, 158 | E = args.E, Tp = args.Tp, tau = args.tau, 159 | exclusionRadius = args.exclusionRadius, 160 | lib = args.lib, pred = args.pred, 161 | cores = args.cores, returnValue = args.returnValue, 162 | noTime = args.noTime, outputFile = args.outputFile, 163 | verbose = args.verbose, plot = args.Plot ) 164 | 165 | #-------------------------------------------------------------- 166 | #-------------------------------------------------------------- 167 | def PlotMatrix( xm, columns, figsize = (5,5), dpi = 150, title = None, 168 | plot = True, plotFile = None ): 169 | ''' ''' 170 | 171 | fig = plt.figure( figsize = figsize, dpi = dpi ) 172 | ax = fig.add_subplot() 173 | 174 | #fig.suptitle( title ) 175 | ax.set( title = f'{title}' ) 176 | ax.xaxis.set_ticks( [x for x in range( len(columns) )] ) 177 | ax.yaxis.set_ticks( [x for x in range( len(columns) )] ) 178 | ax.set_xticklabels(columns, rotation = 90) 179 | ax.set_yticklabels(columns) 180 | 181 | cax = ax.matshow( xm ) 182 | fig.colorbar( cax ) 183 | 184 | if plotFile : 185 | fname = f'{plotFile}' 186 | plt.savefig( fname, dpi = 'figure', format = 'png' ) 187 | 188 | if plot : 189 | plt.show() 190 | 191 | #---------------------------------------------------------------------------- 192 | #---------------------------------------------------------------------------- 193 | def ParseCmdLine(): 194 | 195 | parser = argparse.ArgumentParser( description = 'CrossMap Columns' ) 196 | 197 | parser.add_argument('-i', '--inputFile', 198 | dest = 'inputFile', type = str, 199 | action = 'store', 200 | default = None, 201 | help = 'Input data file.') 202 | 203 | parser.add_argument('-d', '--inputData', 204 | dest = 'inputData', type = str, 205 | action = 'store', 206 | default = 'Lorenz5D', 207 | help = 'Input data frame name.') 208 | 209 | parser.add_argument('-o', '--outputFile', 210 | dest = 'outputFile', type = str, 211 | action = 'store', 212 | default = None, 213 | help = 'Output file.') 214 | 215 | parser.add_argument('-E', '--E', nargs = '*', 216 | dest = 'E', type = int, 217 | action = 'store', 218 | default = 0, 219 | help = 'E.') 220 | 221 | parser.add_argument('-x', '--exclusionRadius', 222 | dest = 'exclusionRadius', type = int, 223 | action = 'store', 224 | default = 0, 225 | help = 'Exclusion Radius.') 226 | 227 | parser.add_argument('-T', '--Tp', 228 | dest = 'Tp', type = int, 229 | action = 'store', 230 | default = 1, 231 | help = 'Tp.') 232 | 233 | parser.add_argument('-tau', '--tau', 234 | dest = 'tau', type = int, 235 | action = 'store', 236 | default = -1, 237 | help = 'tau.') 238 | 239 | parser.add_argument('-l', '--lib', nargs = '*', 240 | dest = 'lib', type = int, 241 | action = 'store', 242 | default = [], 243 | help = 'library indices.') 244 | 245 | parser.add_argument('-p', '--pred', nargs = '*', 246 | dest = 'pred', type = int, 247 | action = 'store', 248 | default = [], 249 | help = 'prediction indices.') 250 | 251 | parser.add_argument('-C', '--cores', 252 | dest = 'cores', type = int, 253 | action = 'store', 254 | default = 5, 255 | help = 'Multiprocessing cores.') 256 | 257 | parser.add_argument('-nT', '--noTime', 258 | dest = 'noTime', 259 | action = 'store_true', 260 | default = False, 261 | help = 'noTime.') 262 | 263 | parser.add_argument('-r', '--returnValue', 264 | dest = 'returnValue', 265 | action = 'store', 266 | default = 'matrix', 267 | help = 'returnValue.') 268 | 269 | parser.add_argument('-v', '--verbose', 270 | dest = 'verbose', 271 | action = 'store_true', 272 | default = False, 273 | help = 'verbose.') 274 | 275 | parser.add_argument('-P', '--Plot', 276 | dest = 'Plot', 277 | action = 'store_true', 278 | default = False, 279 | help = 'Plot.') 280 | 281 | args = parser.parse_args() 282 | 283 | return args 284 | 285 | #---------------------------------------------------------------------------- 286 | # Provide for cmd line invocation and clean module loading 287 | if __name__ == "__main__": 288 | CrossMap_Matrix_CmdLine() 289 | -------------------------------------------------------------------------------- /apps/EmbedDim_Columns.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | # Python distribution modules 4 | import argparse 5 | from time import time 6 | from pickle import dump 7 | from itertools import repeat 8 | from concurrent.futures import ProcessPoolExecutor 9 | 10 | # Community modules 11 | from pandas import DataFrame, read_csv 12 | from pyEDM import EmbedDimension, sampleData 13 | from matplotlib import pyplot as plt 14 | from numpy import greater 15 | from scipy.signal import argrelextrema 16 | 17 | #---------------------------------------------------------------------------- 18 | # 19 | #---------------------------------------------------------------------------- 20 | def EmbedDim_Columns( data, target = None, maxE = 15, 21 | lib = None, pred = None, Tp = 1, tau = -1, 22 | exclusionRadius = 0, firstMax = False, 23 | validLib = [], noTime = False, 24 | ignoreNan = True, cores = 2, EDimCores = 5, 25 | outputFile = None, verbose = False, plot = False ): 26 | 27 | '''Use multiprocessing Pool to process parallelise EmbedDimension. 28 | Note EmbedDimension is already multiprocessing but usually will 29 | not require more than a few processes, maxE at most. On platforms 30 | with many cores this application multiprocesses instances of 31 | EmbedDimension. There are two arguments to contol the number 32 | of cores used for each: 33 | -C args.cores is number of processors running EmbedDimFunc(). 34 | -EC args.EDimCores is number of processors for EmbedDimension(). 35 | The total should not exceed available capacity 36 | 37 | If target is not specified EmbedDimension is univariate where each 38 | embedding evaluation is of the data column itself. It target (-t) 39 | is specified it is a single column against which all other columns 40 | are cross mapped and evaluated against embedding dimension. 41 | 42 | If firstMax is True, return the intial (lowest E) maximum. 43 | 44 | Return : dict { 'column':column, 'target':target, 45 | 'maxE':maxE, 'maxRho':maxRho } 46 | ''' 47 | 48 | startTime = time() 49 | 50 | # If no lib and pred, create from full data span 51 | if lib is None : 52 | lib = [ 1, data.shape[0] ] 53 | if pred is None : 54 | pred = [ 1, data.shape[0] ] 55 | 56 | # Ignore first column, convert to list 57 | if noTime : 58 | columns = list( data.columns ) 59 | else : 60 | columns = list( data.columns[ 1 : ] ) 61 | 62 | N = len( columns ) 63 | 64 | # Dictionary of arguments for PoolExecutor : EmbedDimFunc 65 | argsD = { 'target' : target, 66 | 'maxE' : maxE, 67 | 'lib' : lib, 68 | 'pred' : pred, 69 | 'Tp' : Tp, 70 | 'tau' : tau, 71 | 'exclusionRadius' : exclusionRadius, 72 | 'firstMax' : firstMax, 73 | 'validLib' : validLib, 74 | 'noTime' : noTime, 75 | 'ignoreNan' : ignoreNan, 76 | 'EDimCores' : EDimCores } 77 | 78 | # ProcessPoolExecutor has no starmap(). Pass argument lists directly. 79 | with ProcessPoolExecutor( max_workers = cores ) as exe : 80 | EDim = exe.map(EmbedDimFunc, columns, repeat(data,N), repeat(argsD,N)) 81 | 82 | # EDim is a generator of dictionaries from EmbedDimFunc 83 | # Fill maxCols, targets and maxE arrays, dict 84 | maxCols = [None] * N 85 | targets = [None] * N 86 | maxRho = [0] * N 87 | maxE = [0] * N 88 | i = 0 89 | for edim in EDim : 90 | maxCols[i] = edim['column'] 91 | targets[i] = edim['target'] 92 | maxE[i] = edim['maxE'] 93 | maxRho[i] = edim['maxRho'] 94 | i = i + 1 95 | 96 | D = { 'column':maxCols, 'target':targets, 'E':maxE, 'rho':maxRho } 97 | 98 | if outputFile : 99 | with open( outputFile, 'wb' ) as fileObj: 100 | dump( D, fileObj ) 101 | 102 | if verbose : 103 | ET = round( time() - startTime, 2 ) 104 | print( f'Elapsed Time {ET}' ) 105 | 106 | print( DataFrame( D ) ) 107 | 108 | if plot : 109 | DataFrame( D ).plot( 'column', 'E' ) 110 | plt.show() 111 | 112 | return D 113 | 114 | #---------------------------------------------------------------------------- 115 | #---------------------------------------------------------------------------- 116 | def EmbedDimFunc( column, df, args ): 117 | '''Estimate optimal embedding dimension [1:maxE] 118 | If no target specified : univariate embedding of column''' 119 | 120 | if args['target'] : 121 | target = args['target'] 122 | else : 123 | target = column 124 | 125 | ed = EmbedDimension( dataFrame = df, 126 | columns = column, 127 | target = target, 128 | maxE = args['maxE'], 129 | lib = args['lib'], 130 | pred = args['pred'], 131 | Tp = args['Tp'], 132 | tau = args['tau'], 133 | exclusionRadius = args['exclusionRadius'], 134 | validLib = args['validLib'], 135 | noTime = args['noTime'], 136 | ignoreNan = args['ignoreNan'], 137 | verbose = False, 138 | numProcess = args['EDimCores'], 139 | showPlot = False ) 140 | 141 | # Find max E(rho) 142 | if args['firstMax'] : 143 | iMax = argrelextrema( ed['rho'].to_numpy(), greater )[0] # tuple 144 | 145 | if len( iMax ) : 146 | iMax = iMax[0] # first element of array 147 | else : 148 | iMax = len( ed['E'] ) - 1 # no local maxima, last element is max 149 | else : 150 | iMax = ed['rho'].round(4).argmax() # global maximum 151 | 152 | maxRho = ed['rho'].iloc[ iMax ].round(4) 153 | maxE = ed['E'].iloc[ iMax ] 154 | 155 | return { 'column':column, 'target':target, 156 | 'maxE':maxE, 'maxRho':maxRho } #, 'EDim':ed } 157 | 158 | #---------------------------------------------------------------------------- 159 | #---------------------------------------------------------------------------- 160 | def EmbedDim_Columns_CmdLine(): 161 | '''Wrapper for EmbedDim_Columns with command line parsing''' 162 | 163 | args = ParseCmdLine() 164 | 165 | # Read data 166 | # If -i input file: load it, else look for inputData in sampleData 167 | if args.inputFile: 168 | dataFrame = read_csv( args.inputFile ) 169 | elif args.inputData: 170 | dataFrame = sampleData[ args.inputData ] 171 | else: 172 | raise RuntimeError( "Invalid inputFile or inputData" ) 173 | 174 | # Call EmbedDim_Columns() 175 | D = EmbedDim_Columns( data = dataFrame, 176 | target = args.target, maxE = args.maxE, 177 | lib = args.lib, pred = args.pred, 178 | Tp = args.Tp, tau = args.tau, 179 | exclusionRadius = args.exclusionRadius, 180 | firstMax = args.firstMax, 181 | validLib = args.validLib, noTime = args.noTime, 182 | ignoreNan = args.ignoreNan, cores = args.cores, 183 | EDimCores = args.EDimCores, 184 | outputFile = args.outputFile, 185 | verbose = args.verbose, plot = args.Plot ) 186 | 187 | #---------------------------------------------------------------------------- 188 | #---------------------------------------------------------------------------- 189 | def ParseCmdLine(): 190 | 191 | parser = argparse.ArgumentParser( description = 'CrossMap Columns' ) 192 | 193 | parser.add_argument('-i', '--inputFile', 194 | dest = 'inputFile', type = str, 195 | action = 'store', 196 | default = None, 197 | help = 'Input data file.') 198 | 199 | parser.add_argument('-d', '--inputData', 200 | dest = 'inputData', type = str, 201 | action = 'store', 202 | default = 'Lorenz5D', 203 | help = 'Input data frame name.') 204 | 205 | parser.add_argument('-o', '--outputFile', 206 | dest = 'outputFile', type = str, 207 | action = 'store', 208 | default = None, 209 | help = 'Output file.') 210 | 211 | parser.add_argument('-t', '--target', 212 | dest = 'target', type = str, 213 | action = 'store', 214 | default = None, 215 | help = 'Data target name.') 216 | 217 | parser.add_argument('-maxE', '--maxE', 218 | dest = 'maxE', type = int, 219 | action = 'store', 220 | default = 15, 221 | help = 'maxE.') 222 | 223 | parser.add_argument('-l', '--lib', nargs = 2, 224 | dest = 'lib', type = int, 225 | action = 'store', default = None, 226 | help = 'lib') 227 | 228 | parser.add_argument('-pred', '--pred', nargs = 2, 229 | dest = 'pred', type = int, 230 | action = 'store', default = None, 231 | help = 'pred') 232 | 233 | parser.add_argument('-T', '--Tp', 234 | dest = 'Tp', type = int, 235 | action = 'store', 236 | default = 1, 237 | help = 'Tp.') 238 | 239 | parser.add_argument('-tau', '--tau', 240 | dest = 'tau', type = int, 241 | action = 'store', 242 | default = -1, 243 | help = 'tau.') 244 | 245 | parser.add_argument('-x', '--exclusionRadius', 246 | dest = 'exclusionRadius', type = int, 247 | action = 'store', 248 | default = 0, 249 | help = 'Exclusion Radius.') 250 | 251 | parser.add_argument('-f', '--firstMax', 252 | dest = 'firstMax', 253 | action = 'store_true', default = False, 254 | help = 'firstMax') 255 | 256 | parser.add_argument('-VL', '--validLib', 257 | dest = 'validLib', type = str, 258 | action = 'store', default = '', 259 | help = 'expression to eval for validLib') 260 | 261 | parser.add_argument('-noTime', '--noTime', 262 | dest = 'noTime', 263 | action = 'store_true', default = False, 264 | help = 'noTime') 265 | 266 | parser.add_argument('-in', '--ignoreNan', 267 | dest = 'ignoreNan', 268 | action = 'store_false', default = True, 269 | help = 'ignoreNan') 270 | 271 | parser.add_argument('-C', '--cores', 272 | dest = 'cores', type = int, 273 | action = 'store', 274 | default = 2, 275 | help = 'Multiprocessing cores.') 276 | 277 | parser.add_argument('-EC', '--EDimCores', 278 | dest = 'EDimCores', type = int, 279 | action = 'store', default = 5, 280 | help = 'EmbedDim multiprocessing cores.') 281 | 282 | parser.add_argument('-v', '--verbose', 283 | dest = 'verbose', 284 | action = 'store_true', 285 | default = False, 286 | help = 'verbose.') 287 | 288 | parser.add_argument('-P', '--Plot', 289 | dest = 'Plot', 290 | action = 'store_true', 291 | default = False, 292 | help = 'Plot.') 293 | 294 | args = parser.parse_args() 295 | 296 | return args 297 | 298 | #---------------------------------------------------------------------------- 299 | # Provide for cmd line invocation and clean module loading 300 | if __name__ == "__main__": 301 | EmbedDim_Columns_CmdLine() 302 | -------------------------------------------------------------------------------- /apps/Embedding.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import argparse 4 | 5 | from pyEDM import Embed 6 | from pandas import concat, read_csv 7 | 8 | #---------------------------------------------------------------------------- 9 | #---------------------------------------------------------------------------- 10 | def Embedding( data, columns = None, E = 2, tau = -1, 11 | outputFile = None, plusminus = False, verbose = False ): 12 | ''' 13 | EDM Embed wrapper 14 | Create time-delay embedding with time column for EDM. 15 | Useful to create mixed multivariate embeddings for SMap and 16 | embeddings with time-advanced vectors. 17 | 18 | Add Time column. Replace V(t+0) and V(t-0) with V. 19 | If args.plusminus create both time-delay and time-advanced columns, 20 | require args.tau < 0. 21 | ''' 22 | 23 | # Presume time is first column 24 | timeName = data.columns[0] 25 | timeSeries = data[ timeName ] 26 | 27 | # If no columns specified, use all except first 28 | if not columns : 29 | columns = data.columns[ 1: ] 30 | 31 | if verbose : 32 | print( "Input time column: ", timeName ) 33 | print( "Input columns: ", columns ) 34 | 35 | # Create embeddings of columns 36 | # There will be redundancies vis V1(t-0), V1(t+0) 37 | if plusminus : 38 | embed_minus = Embed( dataFrame = data, E = E, tau = tau, 39 | columns = columns ) 40 | embed_plus = Embed( dataFrame = data, E = E, tau = abs( tau ), 41 | columns = columns ) 42 | df = concat( [ timeSeries, embed_minus, embed_plus ], axis = 1 ) 43 | 44 | # Remove *(t+0) columns redundant with *(t-0) 45 | cols_tplus0 = [ c for c in df.columns if '(t+0)' in c ] 46 | df = df.drop( columns = cols_tplus0 ) 47 | 48 | else : 49 | embed_ = Embed( dataFrame = data, E = E, tau = tau, 50 | columns = columns ) 51 | df = concat( [ timeSeries, embed_ ], axis = 1 ) 52 | 53 | # Rename *(t+0) to original column names 54 | cols_tplus0 = [ c for c in df.columns if '(t+0)' in c ] 55 | cols_orig = [ c.replace( '(t+0)', '', 1 ) for c in cols_tplus0 ] 56 | df.rename( columns = dict( zip( cols_tplus0, cols_orig ) ), inplace = True ) 57 | 58 | # Rename *(t-0) to original column names 59 | cols_tminus0 = [ c for c in df.columns if '(t-0)' in c ] 60 | cols_orig = [ c.replace( '(t-0)', '', 1 ) for c in cols_tminus0 ] 61 | df.rename( columns = dict( zip( cols_tminus0, cols_orig ) ), inplace = True ) 62 | 63 | # Rename first column to original time column name 64 | df.rename( columns = { df.columns[0] : timeName }, inplace = True ) 65 | 66 | if verbose : 67 | print( "Columns:", df.columns, "\n-------------------------------" ) 68 | print( df.head( 4 ) ) 69 | print( df.tail( 4 ) ) 70 | 71 | if outputFile : 72 | df.to_csv( outputFile, index = False ) 73 | 74 | return df 75 | 76 | #---------------------------------------------------------------------------- 77 | #---------------------------------------------------------------------------- 78 | def Embedding_CmdLine(): 79 | '''Wrapper for Embedding with command line parsing''' 80 | 81 | args = ParseCmdLine() 82 | 83 | # Read data 84 | if not args.inputFile : 85 | raise( RuntimeError( '-i inputFile argument required to read .csv' ) ) 86 | 87 | dataFrame = read_csv( args.inputFile ) 88 | 89 | # Call Embedding() 90 | df = Embedding( data = dataFrame, columns = args.columns, 91 | E = args.E, tau = args.tau, plusminus = args.plusminus, 92 | verbose = args.verbose ) 93 | 94 | #---------------------------------------------------------------------------- 95 | #---------------------------------------------------------------------------- 96 | def ParseCmdLine(): 97 | 98 | parser = argparse.ArgumentParser( description = 'Time Delay Embed' ) 99 | 100 | parser.add_argument('-i', '--inputFile', 101 | dest = 'inputFile', type = str, 102 | action = 'store', default = '', 103 | help = 'Input file.') 104 | 105 | parser.add_argument('-o', '--outputFile', 106 | dest = 'outputFile', type = str, 107 | action = 'store', default = None, 108 | help = 'Output file name.') 109 | 110 | parser.add_argument('-p', '--plusminus', 111 | dest = 'plusminus', 112 | action = 'store_true', default = False, 113 | help = 'Both time-delay & time-advanced columns.') 114 | 115 | parser.add_argument('-c', '--columns', nargs = '*', 116 | dest = 'columns', type = str, 117 | action = 'store', default = [], 118 | help = 'columns.') 119 | 120 | parser.add_argument('-E', '--E', 121 | dest = 'E', type = int, 122 | action = 'store', default = 2, 123 | help = 'E.') 124 | 125 | parser.add_argument('-tau', '--tau', 126 | dest = 'tau', type = int, 127 | action = 'store', default = -1, 128 | help = 'tau.') 129 | 130 | parser.add_argument('-v', '--verbose', 131 | dest = 'verbose', 132 | action = 'store_true', default = False, 133 | help = 'verbose.') 134 | 135 | args = parser.parse_args() 136 | 137 | if args.plusminus and args.tau > 0 : 138 | print( 'tau changed to {} with --plusminus'.format( -args.tau ) ) 139 | args.tau = -args.tau 140 | 141 | return args 142 | 143 | #---------------------------------------------------------------------------- 144 | # Provide for cmd line invocation and clean module loading 145 | if __name__ == "__main__": 146 | Embedding_CmdLine() # Call CLI wrapper for Embedding() 147 | -------------------------------------------------------------------------------- /apps/SMap_Tp.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import time, argparse 4 | from multiprocessing import Pool 5 | from itertools import repeat 6 | 7 | from pandas import read_csv 8 | import matplotlib.pyplot as plt 9 | 10 | from pyEDM import SMap, sampleData 11 | 12 | #---------------------------------------------------------------------------- 13 | #---------------------------------------------------------------------------- 14 | def SMap_Tp( data, TpList = None, target = None, column = None, 15 | E = 2, tau = -1, theta = 0, exclusionRadius = 0, 16 | lib = None, pred = None, cores = 5, embedded = False, 17 | outputFile = None, noTime = False, 18 | verbose = False, plot = False ): 19 | 20 | '''Use multiprocessing Pool to process parallelise SMap. 21 | The TpList (-T) argument specifies a list of Tp. 22 | Return dict of Tp{Tp} : SMap dict 23 | ''' 24 | 25 | startTime = time.time() 26 | 27 | if not target : 28 | raise( RuntimeError( 'target required' ) ) 29 | if not column: 30 | raise( RuntimeError( 'column required' ) ) 31 | if not TpList: 32 | raise( RuntimeError( 'TpList required' ) ) 33 | 34 | # Dictionary of arguments for Pool : SMapTpFunc 35 | argsD = { 'target' : target, 'column' : column, 36 | 'lib' : lib, 'pred' : pred, 'theta' : theta, 37 | 'E' : E, 'tau' : tau, 'exclusionRadius' : exclusionRadius, 38 | 'embedded' : embedded, 'noTime' : noTime } 39 | 40 | # Create iterable for Pool.starmap, use repeated copies of args, data 41 | poolArgs = zip( TpList, repeat( argsD ), repeat( data ) ) 42 | 43 | # Process pool 44 | with Pool( processes = cores ) as pool : 45 | SMapList = pool.starmap( SMapTpFunc, poolArgs ) 46 | 47 | # SMapList is a list of SMap dictionaries : create dict with TpX keys 48 | keys = [ 'Tp' + str( k ) for k in TpList ] 49 | D = dict( zip( keys, SMapList ) ) 50 | 51 | if verbose : 52 | print( "Elapsed time:", round( time.time() - startTime, 2 ) ) 53 | 54 | print( D.keys() ) 55 | 56 | # if -P : Plot Tp0 coefficients and predictions 57 | if plot and 'Tp0' in D.keys() : 58 | coeff_df = D[ 'Tp0' ][ 'coefficients' ] 59 | coeff_df.plot( 'Time', coeff_df.columns[1:] ) 60 | 61 | pred_df = D[ 'Tp0' ][ 'predictions' ] 62 | pred_df.plot( 'Time', pred_df.columns[1:] ) 63 | 64 | plt.show() 65 | 66 | return D 67 | 68 | #---------------------------------------------------------------------------- 69 | #---------------------------------------------------------------------------- 70 | def SMapTpFunc( Tp, argsD, data ): 71 | '''Call pyEDM SMap using Tp, args, and data''' 72 | 73 | sm = SMap( dataFrame = data, 74 | columns = argsD['column'], 75 | target = argsD['target'], 76 | lib = argsD['lib'], 77 | pred = argsD['pred'], 78 | E = argsD['E'], 79 | Tp = Tp, # Single value of TpList 80 | theta = argsD['theta'], 81 | exclusionRadius = argsD['exclusionRadius'], 82 | embedded = argsD['embedded'], 83 | noTime = argsD['noTime'], 84 | showPlot = False ) 85 | 86 | return sm 87 | 88 | #---------------------------------------------------------------------------- 89 | #---------------------------------------------------------------------------- 90 | def SMap_Tp_CmdLine(): 91 | '''Wrapper for SMap_Tp with command line parsing''' 92 | 93 | args = ParseCmdLine() 94 | 95 | # Read data 96 | # If -i input file: load it, else look for inputData in sampleData 97 | if args.inputFile: 98 | dataFrame = read_csv( args.inputFile ) 99 | elif args.inputData: 100 | dataFrame = sampleData[ args.inputData ] 101 | else: 102 | raise RuntimeError( "Invalid inputFile or inputData" ) 103 | 104 | # Call SMap_Tp() 105 | D = SMap_Tp( data = dataFrame, TpList = args.TpList, 106 | target = args.target, column = args.column, 107 | E = args.E, tau = args.tau, theta = args.theta, 108 | exclusionRadius = args.exclusionRadius, 109 | lib = args.lib, pred = args.pred, 110 | embedded = args.embedded, cores = args.cores, 111 | outputFile = args.outputFile, noTime = args.noTime, 112 | verbose = args.verbose, plot = args.Plot ) 113 | 114 | #---------------------------------------------------------------------------- 115 | #---------------------------------------------------------------------------- 116 | def ParseCmdLine(): 117 | 118 | parser = argparse.ArgumentParser( description = 'SMap multiprocess Tp' ) 119 | 120 | parser.add_argument('-T', '--TpList', nargs = '+', 121 | dest = 'TpList', type = int, 122 | action = 'store', 123 | default = [-5,-4,-3,-2,-1,0,1,2,3,4,5], 124 | help = 'Prediction interval.') 125 | 126 | parser.add_argument('-i', '--inputFile', 127 | dest = 'inputFile', type = str, 128 | action = 'store', 129 | default = None, 130 | help = 'Input data file.') 131 | 132 | parser.add_argument('-d', '--inputData', 133 | dest = 'inputData', type = str, 134 | action = 'store', 135 | default = 'Lorenz5D', 136 | help = 'Input data frame in sampleData.') 137 | 138 | parser.add_argument('-o', '--outputFile', 139 | dest = 'outputFile', type = str, 140 | action = 'store', 141 | default = None, 142 | help = 'Output file.') 143 | 144 | parser.add_argument('-E', '--E', 145 | dest = 'E', type = int, 146 | action = 'store', 147 | default = 5, 148 | help = 'Embedding dimension E.') 149 | 150 | parser.add_argument('-tau', '--tau', 151 | dest = 'tau', type = int, 152 | action = 'store', 153 | default = -1, 154 | help = 'tau.') 155 | 156 | parser.add_argument('-x', '--exclusionRadius', 157 | dest = 'exclusionRadius', type = int, 158 | action = 'store', 159 | default = 0, 160 | help = 'Exclusion Radius.') 161 | 162 | parser.add_argument('-c', '--column', 163 | dest = 'column', type = str, 164 | action = 'store', 165 | default = 'V1', 166 | help = 'Input file data column name.') 167 | 168 | parser.add_argument('-t', '--target', 169 | dest = 'target', type = str, 170 | action = 'store', 171 | default = 'V3', 172 | help = 'Input file data target name.') 173 | 174 | parser.add_argument('-l', '--lib', 175 | dest = 'lib', type = str, 176 | action = 'store', 177 | default = '1 990', 178 | help = 'lib.') 179 | 180 | parser.add_argument('-p', '--pred', 181 | dest = 'pred', type = str, 182 | action = 'store', 183 | default = '501 990', 184 | help = 'pred.') 185 | 186 | parser.add_argument('-th', '--theta', 187 | dest = 'theta', type = float, 188 | action = 'store', 189 | default = 3.3, 190 | help = 'theta.') 191 | 192 | parser.add_argument('-e', '--embedded', 193 | dest = 'embedded', 194 | action = 'store_true', 195 | default = False, 196 | help = 'embedded flag.') 197 | 198 | parser.add_argument('-nT', '--noTime', 199 | dest = 'noTime', 200 | action = 'store_true', 201 | default = False, 202 | help = 'noTime.') 203 | 204 | parser.add_argument('-v', '--verbose', 205 | dest = 'verbose', 206 | action = 'store_true', 207 | default = False, 208 | help = 'verbose.') 209 | 210 | parser.add_argument('-C', '--cores', 211 | dest = 'cores', type = int, 212 | action = 'store', 213 | default = 4, 214 | help = 'Multiprocessing cores.') 215 | 216 | parser.add_argument('-P', '--Plot', 217 | dest = 'Plot', 218 | action = 'store_true', 219 | default = False, 220 | help = 'Plot results.') 221 | 222 | args = parser.parse_args() 223 | 224 | return args 225 | 226 | #---------------------------------------------------------------------------- 227 | # Provide for cmd line invocation and clean module loading 228 | if __name__ == "__main__": 229 | SMap_Tp_CmdLine() 230 | -------------------------------------------------------------------------------- /apps/SMap_theta.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import time, argparse 4 | from multiprocessing import Pool 5 | from itertools import repeat 6 | 7 | from pandas import read_csv 8 | import matplotlib.pyplot as plt 9 | 10 | from pyEDM import SMap, sampleData 11 | 12 | #---------------------------------------------------------------------------- 13 | #---------------------------------------------------------------------------- 14 | def SMap_theta( data, thetaList = None, target = None, column = None, 15 | E = 2, tau = -1, Tp = 1, exclusionRadius = 0, 16 | lib = None, pred = None, cores = 5, embedded = False, 17 | outputFile = None, noTime = False, 18 | verbose = False, plot = False ): 19 | 20 | '''Use multiprocessing Pool to process parallelise SMap. 21 | The thetaList (-th) argument specifies a list of theta. 22 | Returns dict of theta_{theta} : SMap dict 23 | ''' 24 | 25 | startTime = time.time() 26 | 27 | if not target : 28 | raise( RuntimeError( 'target required' ) ) 29 | if not column: 30 | raise( RuntimeError( 'column required' ) ) 31 | if not thetaList: 32 | raise( RuntimeError( 'thetaList required' ) ) 33 | 34 | # Dictionary of arguments for Pool : SMapFunc 35 | argsD = { 'target' : target, 'column' : column, 36 | 'lib' : lib, 'pred' : pred, 'Tp' : Tp, 37 | 'E' : E, 'tau' : tau, 'exclusionRadius' : exclusionRadius, 38 | 'embedded' : embedded, 'noTime' : noTime } 39 | 40 | # Create iterable for Pool.starmap, use repeated copies of args, data 41 | poolArgs = zip( thetaList, repeat( argsD ), repeat( data ) ) 42 | 43 | # Process pool 44 | with Pool( processes = cores ) as pool : 45 | SMapList = pool.starmap( SMapFunc, poolArgs ) 46 | 47 | # SMapList is a list of SMap dictionaries : create dict with theta keys 48 | keys = [ 'theta_' + str( t ) for t in thetaList ] 49 | D = dict( zip( keys, SMapList ) ) 50 | 51 | if verbose : 52 | print( "Elapsed time:", round( time.time() - startTime, 2 ) ) 53 | 54 | print( D.keys() ) 55 | 56 | # if -P : Plot Tp0 coefficients and predictions 57 | if plot and 'theta_4.0' in D.keys() : 58 | coeff_df = D[ 'theta_4.0' ][ 'coefficients' ] 59 | coeff_df.plot( 'Time', coeff_df.columns[1:] ) 60 | 61 | pred_df = D[ 'theta_4.0' ][ 'predictions' ] 62 | pred_df.plot( 'Time', pred_df.columns[1:] ) 63 | 64 | plt.show() 65 | 66 | return D 67 | 68 | #---------------------------------------------------------------------------- 69 | #---------------------------------------------------------------------------- 70 | def SMapFunc( theta, argsD, data ): 71 | '''Call pyEDM SMap using theta, args, and data''' 72 | 73 | sm = SMap( dataFrame = data, 74 | columns = argsD['column'], 75 | target = argsD['target'], 76 | lib = argsD['lib'], 77 | pred = argsD['pred'], 78 | E = argsD['E'], 79 | Tp = argsD['Tp'], 80 | theta = theta, 81 | exclusionRadius = argsD['exclusionRadius'], 82 | embedded = argsD['embedded'], 83 | noTime = argsD['noTime'], 84 | showPlot = False ) 85 | 86 | return sm 87 | 88 | #---------------------------------------------------------------------------- 89 | #---------------------------------------------------------------------------- 90 | def SMap_theta_CmdLine(): 91 | '''Wrapper for SMap_theta with command line parsing''' 92 | 93 | args = ParseCmdLine() 94 | 95 | # Read data 96 | # If -i input file: load it, else look for inputData in sampleData 97 | if args.inputFile: 98 | dataFrame = read_csv( args.inputFile ) 99 | elif args.inputData: 100 | dataFrame = sampleData[ args.inputData ] 101 | else: 102 | raise RuntimeError( "Invalid inputFile or inputData" ) 103 | 104 | # Call SMap_theta() 105 | D = SMap_theta( data = dataFrame, thetaList = args.thetaList, 106 | target = args.target, column = args.column, 107 | E = args.E, tau = args.tau, Tp = args.Tp, 108 | exclusionRadius = args.exclusionRadius, 109 | lib = args.lib, pred = args.pred, 110 | embedded = args.embedded, cores = args.cores, 111 | outputFile = args.outputFile, noTime = args.noTime, 112 | verbose = args.verbose, plot = args.Plot ) 113 | 114 | #---------------------------------------------------------------------------- 115 | #---------------------------------------------------------------------------- 116 | def ParseCmdLine(): 117 | 118 | parser = argparse.ArgumentParser( description = 'SMap multiprocess theta' ) 119 | 120 | parser.add_argument('-th', '--thetaList', nargs = '+', 121 | dest = 'thetaList', type = float, 122 | action = 'store', 123 | default = [0.01,0.1,0.3,0.5,1,1.5,2,3,4.,5,6,7,8,9], 124 | help = 'List of theta.') 125 | 126 | parser.add_argument('-i', '--inputFile', 127 | dest = 'inputFile', type = str, 128 | action = 'store', 129 | default = None, 130 | help = 'Input data file.') 131 | 132 | parser.add_argument('-d', '--inputData', 133 | dest = 'inputData', type = str, 134 | action = 'store', 135 | default = 'Lorenz5D', 136 | help = 'Input data frame in sampleData.') 137 | 138 | parser.add_argument('-o', '--outputFile', 139 | dest = 'outputFile', type = str, 140 | action = 'store', 141 | default = None, 142 | help = 'Output file.') 143 | 144 | parser.add_argument('-E', '--E', 145 | dest = 'E', type = int, 146 | action = 'store', 147 | default = 5, 148 | help = 'Embedding dimension E.') 149 | 150 | parser.add_argument('-tau', '--tau', 151 | dest = 'tau', type = int, 152 | action = 'store', 153 | default = -1, 154 | help = 'tau.') 155 | 156 | parser.add_argument('-x', '--exclusionRadius', 157 | dest = 'exclusionRadius', type = int, 158 | action = 'store', 159 | default = 0, 160 | help = 'Exclusion Radius.') 161 | 162 | parser.add_argument('-c', '--column', 163 | dest = 'column', type = str, 164 | action = 'store', 165 | default = 'V1', 166 | help = 'Input file data column name.') 167 | 168 | parser.add_argument('-t', '--target', 169 | dest = 'target', type = str, 170 | action = 'store', 171 | default = 'V3', 172 | help = 'Input file data target name.') 173 | 174 | parser.add_argument('-l', '--lib', 175 | dest = 'lib', type = str, 176 | action = 'store', 177 | default = '1 990', 178 | help = 'lib.') 179 | 180 | parser.add_argument('-p', '--pred', 181 | dest = 'pred', type = str, 182 | action = 'store', 183 | default = '501 990', 184 | help = 'pred.') 185 | 186 | parser.add_argument('-T', '--Tp', 187 | dest = 'Tp', type = int, 188 | action = 'store', 189 | default = 1, 190 | help = 'Tp.') 191 | 192 | parser.add_argument('-e', '--embedded', 193 | dest = 'embedded', 194 | action = 'store_true', 195 | default = False, 196 | help = 'embedded flag.') 197 | 198 | parser.add_argument('-nT', '--noTime', 199 | dest = 'noTime', 200 | action = 'store_true', 201 | default = False, 202 | help = 'noTime.') 203 | 204 | parser.add_argument('-v', '--verbose', 205 | dest = 'verbose', 206 | action = 'store_true', 207 | default = False, 208 | help = 'verbose.') 209 | 210 | parser.add_argument('-C', '--cores', 211 | dest = 'cores', type = int, 212 | action = 'store', 213 | default = 4, 214 | help = 'Multiprocessing cores.') 215 | 216 | parser.add_argument('-P', '--Plot', 217 | dest = 'Plot', 218 | action = 'store_true', 219 | default = False, 220 | help = 'Plot results.') 221 | 222 | args = parser.parse_args() 223 | 224 | return args 225 | 226 | #---------------------------------------------------------------------------- 227 | # Provide for cmd line invocation and clean module loading 228 | if __name__ == "__main__": 229 | SMap_theta_CmdLine() 230 | -------------------------------------------------------------------------------- /apps/tests/.gitignore: -------------------------------------------------------------------------------- 1 | .ipynb_checkpoints 2 | -------------------------------------------------------------------------------- /apps/tests/CLI_tests.py: -------------------------------------------------------------------------------- 1 | 2 | # CLI Tests 3 | # Default -d Lorenz5D 4 | 5 | ./Embedding.py -i ../src/pyEDM/data/LorenzData1000.csv -c V1 V3 -v 6 | ./Embedding.py -i ../src/pyEDM/data/LorenzData1000.csv -c V1 V3 -p -tau 2 -v 7 | 8 | ./EmbedDim_Columns.py -T 5 -tau -3 -v 9 | ./EmbedDim_Columns.py -l 1 500 -p 501 1000 -T 5 -tau -3 -v 10 | 11 | ./SMap_Tp.py -v -P 12 | ./SMap_Tp.py -th 3.3 -T 0 1 2 3 4 5 6 7 8 9 10 -tau -5 -v -P 13 | 14 | ./SMap_theta.py -P 15 | ./SMap_theta.py -th 0.01 0.05 0.08 0.1 0.5 0.75 1 2 3 4 5 6 7 8 9 -v -P 16 | 17 | ./CrossMap_Columns.py -t V1 -E 5 -l 1 500 -p 501 800 -v -P 18 | ./CrossMap_Columns.py -t V3 -E 5 -l 1 500 -p 801 1000 -tau -3 -v -P 19 | 20 | ./CrossMap_ColumnList.py -c V2 V3 V4 V5 -t V1 -E 1 -l 1 500 -p 501 800 -v -P 21 | 22 | ./CrossMap_Matrix.py -E 5 -v -P 23 | ./CrossMap_Matrix.py -i ~/Research/ZebrafishDynamics/data/t_e_v_p_r_l_dFF_100.csv -E 7 -C 5 -P 24 | 25 | ./CCM_Matrix.py -E 5 -P 26 | -------------------------------------------------------------------------------- /doc/pyEDM.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SugiharaLab/pyEDM/11bbebe323c74fc6765292bf7e5f53510bada9ce/doc/pyEDM.odt -------------------------------------------------------------------------------- /doc/pyEDM.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SugiharaLab/pyEDM/11bbebe323c74fc6765292bf7e5f53510bada9ce/doc/pyEDM.pdf -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools >= 61.0"] 3 | build-backend = "setuptools.build_meta" 4 | 5 | [project] 6 | name = "pyEDM" 7 | requires-python = ">=3.9" 8 | dynamic = ["version"] 9 | dependencies = [ "numpy>=1.26", 10 | "scipy>=1.11", 11 | "scikit-learn>=1.3", 12 | "pandas>=2.0", 13 | "matplotlib>=3.7", ] 14 | authors = [ 15 | {name = "Joseph Park", email = "JosephPark@IEEE.org"}, 16 | ] 17 | maintainers = [ 18 | {name = "Joseph Park", email = "JosephPark@IEEE.org"} 19 | ] 20 | description = "Python/Pandas toolset for Empirical Dynamic Modeling." 21 | readme = "README.md" 22 | license = {file = "LICENSE"} 23 | keywords = ['EDM', 'Empirical Dynamic Modeling', 'nonlinear dynamics', 24 | 'time series', 'state space' ] 25 | classifiers = [ 26 | "Programming Language :: Python :: 3", 27 | "Operating System :: OS Independent", 28 | ] 29 | 30 | [tool.setuptools.dynamic] 31 | version = {attr = "pyEDM.__version__"} 32 | 33 | [project.urls] 34 | Homepage = "https://deepeco.ucsd.edu/" 35 | Documentation = "https://sugiharalab.github.io/EDM_Documentation/" 36 | Repository = "https://github.com/SugiharaLab/pyEDM" 37 | "Bug Tracker" = "https://github.com/SugiharaLab/pyEDM/issues" 38 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | pyEDM.egg-info 2 | -------------------------------------------------------------------------------- /src/pyEDM/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | build 3 | tmp 4 | -------------------------------------------------------------------------------- /src/pyEDM/AuxFunc.py: -------------------------------------------------------------------------------- 1 | '''Examples, plot functions, IsIterable, ComputeError, SurrogateData''' 2 | 3 | # python modules 4 | from math import floor, pi, sqrt, cos 5 | from cmath import exp 6 | from random import sample, uniform, normalvariate 7 | 8 | # package modules 9 | from numpy import any, arange, corrcoef, fft, isfinite, mean 10 | from numpy import max, nan, ptp, std, sqrt, zeros 11 | from pandas import DataFrame, read_csv 12 | from scipy.interpolate import UnivariateSpline 13 | from matplotlib.pyplot import show, axhline 14 | 15 | import pyEDM.API as EDM 16 | from .LoadData import sampleData 17 | 18 | #------------------------------------------------------------------------ 19 | #------------------------------------------------------------------------ 20 | def Examples(): 21 | 22 | def RunEDM ( cmd ): 23 | print(cmd) 24 | print() 25 | df = eval( 'EDM.' + cmd ) 26 | return df 27 | 28 | sampleDataNames = \ 29 | ["TentMap","TentMapNoise","circle","block_3sp","sardine_anchovy_sst"] 30 | 31 | for dataName in sampleDataNames : 32 | if dataName not in sampleData: 33 | raise Exception( "Examples(): Failed to find sample data " + \ 34 | dataName + " in EDM package" ) 35 | 36 | #--------------------------------------------------------------- 37 | cmd = str().join(['EmbedDimension( dataFrame = sampleData["TentMap"],', 38 | ' columns = "TentMap", target = "TentMap",', 39 | ' lib = [1, 100], pred = [201, 500] )']) 40 | RunEDM( cmd ) 41 | 42 | #--------------------------------------------------------------- 43 | cmd = str().join(['PredictInterval( dataFrame = sampleData["TentMap"],', 44 | ' columns = "TentMap", target = "TentMap",' 45 | ' lib = [1, 100], pred = [201, 500], E = 2 )']) 46 | RunEDM( cmd ) 47 | 48 | #--------------------------------------------------------------- 49 | cmd = str().join( 50 | ['PredictNonlinear( dataFrame = sampleData["TentMapNoise"],', 51 | ' columns = "TentMap", target = "TentMap", ' 52 | ' lib = [1, 100], pred = [201, 500], E = 2 )']) 53 | RunEDM( cmd ) 54 | 55 | #--------------------------------------------------------------- 56 | # Tent map simplex : specify multivariable columns embedded = True 57 | cmd = str().join(['Simplex( dataFrame = sampleData["block_3sp"],', 58 | ' columns="x_t y_t z_t", target="x_t",' 59 | ' lib = [1, 99], pred = [100, 195],', 60 | ' E = 3, embedded = True, showPlot = True )']) 61 | RunEDM( cmd ) 62 | 63 | #--------------------------------------------------------------- 64 | # Tent map simplex : Embed column x_t to E=3, embedded = False 65 | cmd = str().join(['Simplex( dataFrame = sampleData["block_3sp"],', 66 | ' columns = "x_t", target = "x_t",', 67 | ' lib = [1, 99], pred = [105, 190],', 68 | ' E = 3, showPlot = True )']) 69 | RunEDM( cmd ) 70 | 71 | #--------------------------------------------------------------- 72 | cmd = str().join(['Multiview( dataFrame = sampleData["block_3sp"],', 73 | ' columns = "x_t y_t z_t", target = "x_t",', 74 | ' lib = [1, 100], pred = [101, 198],', 75 | ' D = 0, E = 3, Tp = 1, multiview = 0,', 76 | ' trainLib = False, showPlot = True ) ']) 77 | RunEDM( cmd ) 78 | 79 | #--------------------------------------------------------------- 80 | # S-map circle : specify multivariable columns embedded = True 81 | cmd = str().join(['SMap( dataFrame = sampleData["circle"],', 82 | ' columns = ["x", "y"], target = "x",' 83 | ' lib = [1, 100], pred = [110, 190], theta = 4, E = 2,', 84 | ' verbose = False, showPlot = True, embedded = True )']) 85 | RunEDM( cmd ) 86 | 87 | #--------------------------------------------------------------- 88 | cmd = str().join(['CCM( dataFrame = sampleData["sardine_anchovy_sst"],', 89 | ' columns = "anchovy", target = "np_sst",', 90 | ' libSizes = [10, 70, 10], sample = 50,', 91 | ' E = 3, Tp = 0, verbose = False, showPlot = True )']) 92 | RunEDM( cmd ) 93 | 94 | #------------------------------------------------------------------------ 95 | #------------------------------------------------------------------------ 96 | def PlotObsPred( df, dataName = "", E = 0, Tp = 0, block = True ): 97 | '''Plot observations and predictions''' 98 | 99 | # stats: {'MAE': 0., 'RMSE': 0., 'rho': 0. } 100 | stats = ComputeError( df['Observations'], df['Predictions' ] ) 101 | 102 | title = dataName + "\nE=" + str(E) + " Tp=" + str(Tp) +\ 103 | " ρ=" + str( round( stats['rho'], 3 ) ) +\ 104 | " RMSE=" + str( round( stats['RMSE'], 3 ) ) 105 | 106 | time_col = df.columns[0] 107 | 108 | df.plot( time_col, ['Observations', 'Predictions'], 109 | title = title, linewidth = 3 ) 110 | 111 | show( block = block ) 112 | 113 | #------------------------------------------------------------------------ 114 | #------------------------------------------------------------------------ 115 | def PlotCoeff( df, dataName = "", E = 0, Tp = 0, block = True ): 116 | '''Plot S-Map coefficients''' 117 | 118 | title = dataName + "\nE=" + str(E) + " Tp=" + str(Tp) +\ 119 | " S-Map Coefficients" 120 | 121 | time_col = df.columns[0] 122 | 123 | # Coefficient columns can be in any column 124 | coef_cols = [ x for x in df.columns if time_col not in x ] 125 | 126 | df.plot( time_col, coef_cols, title = title, linewidth = 3, 127 | subplots = True ) 128 | 129 | show( block = block ) 130 | 131 | #------------------------------------------------------------------------ 132 | #------------------------------------------------------------------------ 133 | def ComputeError( obs, pred, digits = 6 ): 134 | '''Pearson rho, RMSE, MAE 135 | Remove nan from obs, pred for corrcoeff. 136 | ''' 137 | 138 | notNan = isfinite( pred ) 139 | if any( ~notNan ) : 140 | pred = pred[ notNan ] 141 | obs = obs [ notNan ] 142 | 143 | notNan = isfinite( obs ) 144 | if any( ~notNan ) : 145 | pred = pred[ notNan ] 146 | obs = obs [ notNan ] 147 | 148 | if len( pred ) < 5 : 149 | msg = f'ComputeError(): Not enough data ({len(pred)}) to ' +\ 150 | ' compute error statistics.' 151 | print( msg ) 152 | return { 'rho' : nan, 'MAE' : nan, 'RMSE' : nan } 153 | 154 | rho = round( corrcoef( obs, pred )[0,1], digits ) 155 | err = obs - pred 156 | MAE = round( max( err ), digits ) 157 | RMSE = round( sqrt( mean( err**2 ) ), digits ) 158 | 159 | D = { 'rho' : rho, 'MAE' : MAE, 'RMSE' : RMSE } 160 | 161 | return D 162 | 163 | #------------------------------------------------------------------------ 164 | #------------------------------------------------------------------------ 165 | def Iterable( obj ): 166 | '''Is an object iterable?''' 167 | 168 | try: 169 | it = iter( obj ) 170 | except TypeError: 171 | return False 172 | return True 173 | 174 | #------------------------------------------------------------------------ 175 | #------------------------------------------------------------------------ 176 | def IsIterable( obj ): 177 | '''Is an object iterable and not a string?''' 178 | 179 | if Iterable( obj ) : 180 | if isinstance( obj, str ) : 181 | return False 182 | else : 183 | return True 184 | return False 185 | 186 | #------------------------------------------------------------------------ 187 | #------------------------------------------------------------------------ 188 | def SurrogateData( dataFrame = None, 189 | column = None, 190 | method = 'ebisuzaki', 191 | numSurrogates = 10, 192 | alpha = None, 193 | smooth = 0.8, 194 | outputFile = None ): 195 | '''Three methods: 196 | 197 | random_shuffle : 198 | Sample the data with a uniform distribution. 199 | 200 | ebisuzaki : 201 | Journal of Climate. A Method to Estimate the Statistical Significance 202 | of a Correlation When the Data Are Serially Correlated. 203 | https://doi.org/10.1175/1520-0442(1997)010<2147:AMTETS>2.0.CO;2 204 | 205 | Presumes data are serially correlated with low pass coherence. It is: 206 | "resampling in the frequency domain. This procedure will not preserve 207 | the distribution of values but rather the power spectrum (periodogram). 208 | The advantage of preserving the power spectrum is that resampled series 209 | retains the same autocorrelation as the original series." 210 | 211 | seasonal : 212 | Presume a smoothing spline represents the seasonal trend. 213 | Each surrogate is a summation of the trend, resampled residuals, 214 | and possibly additive Gaussian noise. Default noise has a standard 215 | deviation that is the data range / 5. 216 | ''' 217 | 218 | if dataFrame is None : 219 | raise RuntimeError( "SurrogateData() empty DataFrame." ) 220 | 221 | if column is None : 222 | raise RuntimeError( "SurrogateData() must specify column." ) 223 | 224 | # New dataFrame with initial time column 225 | df = DataFrame( dataFrame.iloc[ :,0 ] ) 226 | 227 | if method.lower() == "random_shuffle" : 228 | for s in range( numSurrogates ) : # use pandas sample 229 | surr = dataFrame[ column ].sample( 230 | n = dataFrame.shape[0] ).to_numpy() 231 | df[ s + 1 ] = surr 232 | 233 | elif method.lower() == "ebisuzaki" : 234 | data = dataFrame[ column ].to_numpy() 235 | n = dataFrame.shape[0] 236 | n2 = floor( n/2 ) 237 | mu = mean ( data ) 238 | sigma = std ( data ) 239 | a = fft.fft( data ) 240 | amplitudes = abs( a ) 241 | amplitudes[0] = 0 242 | 243 | for s in range( numSurrogates ) : 244 | thetas = [ 2 * pi * uniform( 0, 1 ) for x in range( n2 - 1 )] 245 | revThetas = thetas[::-1] 246 | negThetas = [ -x for x in revThetas ] 247 | angles = [0] + thetas + [0] + negThetas 248 | surrogate_z = [ A * exp( complex( 0, theta ) ) 249 | for A, theta in zip( amplitudes, angles ) ] 250 | 251 | if n % 2 == 0 : # even length 252 | surrogate_z[-1] = complex( sqrt(2) * amplitudes[-1] * 253 | cos( 2 * pi * uniform(0,1) ) ) 254 | 255 | ifft = fft.ifft( surrogate_z ) / n 256 | 257 | realifft = [ x.real for x in ifft ] 258 | sdevifft = std( realifft ) 259 | 260 | # adjust variance of surrogate time series to match original 261 | scaled = [ sigma * x / sdevifft for x in realifft ] 262 | 263 | df[ s + 1 ] = scaled 264 | 265 | elif method.lower() == "seasonal" : 266 | y = dataFrame[ column ].to_numpy() 267 | n = dataFrame.shape[0] 268 | 269 | # Presume a spline captures the seasonal cycle 270 | x = arange( n ) 271 | spline = UnivariateSpline( x, y ) 272 | spline.set_smoothing_factor( smooth ) 273 | y_spline = spline( x ) 274 | 275 | # Residuals of the smoothing 276 | residual = list( y - y_spline ) 277 | 278 | # spline plus shuffled residuals plus Gaussian noise 279 | noise = zeros( n ) 280 | 281 | # If no noise specified, set std dev to data range / 5 282 | if alpha is None : 283 | alpha = ptp( y ) / 5 284 | 285 | for s in range( numSurrogates ) : 286 | noise = [ normalvariate( 0, alpha ) for z in range( n ) ] 287 | 288 | df[ s + 1 ] = y_spline + sample( residual, n ) + noise 289 | 290 | else : 291 | raise RuntimeError( "SurrogateData() invalid method." ) 292 | 293 | df = df.round( 8 ) # Should be a parameter 294 | 295 | # Rename columns 296 | columnNames = [ column + "_" + str( c + 1 ) 297 | for c in range( numSurrogates ) ] 298 | 299 | columnNames.insert( 0, df.columns[0] ) # insert time column name 300 | 301 | df.columns = columnNames 302 | 303 | if outputFile : 304 | df.to_csv( outputFile, index = False ) 305 | 306 | return df 307 | -------------------------------------------------------------------------------- /src/pyEDM/Formatting.py: -------------------------------------------------------------------------------- 1 | # python modules 2 | import datetime as dt 3 | from warnings import warn 4 | 5 | # package modules 6 | from pandas import DataFrame 7 | from numpy import append, array, empty, floating, full, integer, nan 8 | 9 | #-------------------------------------------------------------------- 10 | # EDM Methods 11 | #------------------------------------------------------------------- 12 | def FormatProjection( self ) : 13 | #------------------------------------------------------------------- 14 | '''Create Projection, Coefficients, SingularValues DataFrames 15 | AddTime() attempts to extend forecast time if needed 16 | 17 | NOTE: self.pred_i had all nan removed for KDTree by RemoveNan(). 18 | self.predList only had leading/trailing embedding nan removed. 19 | Here we want to include any nan observation rows so we 20 | process predList & pred_i_all, not self.pred_i. 21 | ''' 22 | if self.verbose: 23 | print( f'{self.name}: FormatProjection()' ) 24 | 25 | if len( self.pred_i ) == 0 : 26 | msg = f'{self.name}: FormatProjection() No valid prediction indices.' 27 | warn( msg ) 28 | 29 | self.Projection = DataFrame({ 'Time': [], 'Observations': [], 30 | 'Predictions': [], 'Pred_Variance': [] }) 31 | return 32 | 33 | N_dim = self.E + 1 34 | Tp_magnitude = abs( self.Tp ) 35 | 36 | #---------------------------------------------------- 37 | # Observations: Insert target data in observations 38 | #---------------------------------------------------- 39 | outSize = 0 40 | 41 | # Create array of indices into self.targetVec for observations 42 | obs_i = array( [], dtype = int ) 43 | 44 | # Process each pred segment in self.predList 45 | for pred_i in self.predList : 46 | N_pred = len( pred_i ) 47 | outSize_i = N_pred + Tp_magnitude 48 | outSize = outSize + outSize_i 49 | append_i = array( [], dtype = int ) 50 | 51 | if N_pred == 0 : 52 | # No prediction made for this pred segment 53 | if self.verbose : 54 | msg = f'{self.name} FormatProjection(): No prediction made ' +\ 55 | f'for empty pred in {self.predList}. ' +\ 56 | 'Examine pred, E, tau, Tp parameters and/or nan.' 57 | print( msg ) 58 | continue 59 | 60 | if self.Tp == 0 : # Tp = 0 61 | append_i = pred_i.copy() 62 | 63 | elif self.Tp > 0 : # Positive Tp 64 | if pred_i[-1] + self.Tp < self.targetVec.shape[0] : 65 | # targetVec data available before end of targetVec 66 | append_i = append( append_i, pred_i ) 67 | Tp_i = [ i for i in range( append_i[-1] + 1, 68 | append_i[-1] + self.Tp + 1) ] 69 | append_i = append( append_i, array( Tp_i, dtype = int ) ) 70 | else : 71 | # targetVec data not available at prediction end 72 | append_i = append( append_i, pred_i ) 73 | 74 | else : # Negative Tp 75 | if pred_i[0] + self.Tp > -1 : 76 | # targetVec data available after begin of pred_i[0] 77 | append_i = append( append_i, pred_i ) 78 | Tp_i = [ i for i in range( pred_i[0] + self.Tp, 79 | pred_i[0] ) ] 80 | append_i = append( array( Tp_i, dtype = int ), append_i ) 81 | else : 82 | # targetVec data not available before pred_i[0] 83 | append_i = append( append_i, pred_i ) 84 | 85 | obs_i = append( obs_i, append_i ) 86 | 87 | observations = self.targetVec[ obs_i, 0 ] 88 | 89 | #---------------------------------------------------- 90 | # Projections & variance 91 | #---------------------------------------------------- 92 | # Define array's of indices predOut_i, obsOut_i for DataFrame vectors 93 | predOut_i = array( [], dtype = int ) 94 | predOut_0 = 0 95 | 96 | # Process each pred segment in self.predList for predOut_i 97 | for pred_i in self.predList : 98 | N_pred = len( pred_i ) 99 | outSize_i = N_pred + Tp_magnitude 100 | 101 | if N_pred == 0 : 102 | # No prediction made for this pred segment 103 | continue 104 | 105 | if self.Tp == 0 : 106 | Tp_i = [i for i in range( predOut_0, predOut_0 + N_pred )] 107 | predOut_i = append( predOut_i, array( Tp_i, dtype = int ) ) 108 | predOut_0 = predOut_i[-1] + 1 109 | 110 | elif self.Tp > 0 : # Positive Tp 111 | Tp_i = [i for i in range( predOut_0 + self.Tp, 112 | predOut_0 + self.Tp + N_pred ) ] 113 | predOut_i = append( predOut_i, array( Tp_i, dtype = int ) ) 114 | predOut_0 = predOut_i[-1] + 1 115 | 116 | else : # Negative Tp 117 | Tp_i = [i for i in range(predOut_0, predOut_0 + N_pred)] 118 | predOut_i = append( predOut_i, array( Tp_i, dtype = int ) ) 119 | predOut_0 = predOut_i[-1] + Tp_magnitude + 1 120 | 121 | # If nan are present, the foregoing can be wrong since it is not 122 | # known before prediction what lib vectors will produce pred 123 | # If len( pred_i ) != len( predOut_i ), nan resulted in missing pred 124 | # Create a map between pred_i_all : predOut_i to create a new/shorter 125 | # predOut_i mapping pred_i to the output vector predOut_i 126 | if len( self.pred_i ) != len( predOut_i ) : 127 | # Map the last predOut_i values since embed shift near data begining 128 | # can have (E-1)*tau na, but still listed in pred_i_all 129 | N_ = len( predOut_i ) 130 | 131 | if self.tau < 0 : 132 | D = dict( zip( self.pred_i_all[ -N_: ], predOut_i ) ) 133 | else : 134 | D = dict( zip( self.pred_i_all[ :N_ ], predOut_i ) ) 135 | 136 | # Reset predOut_i 137 | predOut_i = [ D[i] for i in self.pred_i ] 138 | 139 | # Create obsOut_i indices for output vectors in DataFrame 140 | if self.Tp > 0 : # Positive Tp 141 | if obs_i[-1] + self.Tp > self.Data.shape[0] - 1 : 142 | # Edge case of end of data with positive Tp 143 | obsOut_i = [ i for i in range( len(obs_i) ) ] 144 | else : 145 | obsOut_i = [ i for i in range( outSize ) ] 146 | 147 | elif self.Tp < 1 : # Negative or Zero Tp 148 | if self.pred_i[0] + self.Tp < 0 : 149 | # Edge case of start of data with negative Tp 150 | obsOut_i = [ i for i in range( len(obs_i) ) ] 151 | 152 | # Shift obsOut_i values based on leading nan 153 | shift = Tp_magnitude - self.pred_i[0] 154 | obsOut_i = obsOut_i + shift 155 | else : 156 | obsOut_i = [ i for i in range( len(obs_i) ) ] 157 | 158 | obsOut_i = array( obsOut_i, dtype = int ) 159 | 160 | # ndarray init to nan 161 | observationOut = full( outSize, nan ) 162 | projectionOut = full( outSize, nan ) 163 | varianceOut = full( outSize, nan ) 164 | 165 | # fill *Out with observed & projected values 166 | observationOut[ obsOut_i ] = observations 167 | projectionOut[ predOut_i ] = self.projection 168 | varianceOut [ predOut_i ] = self.variance 169 | 170 | #---------------------------------------------------- 171 | # Time 172 | #---------------------------------------------------- 173 | self.ConvertTime() 174 | 175 | if self.Tp == 0 or \ 176 | (self.Tp > 0 and (self.pred_i_all[-1] + self.Tp) < len(self.time)) or \ 177 | (self.Tp < 0 and (self.pred_i[0] + self.Tp >= 0)) : 178 | # All times present in self.time, copy them 179 | timeOut = empty( outSize, dtype = self.time.dtype ) 180 | timeOut[ obsOut_i ] = self.time[ obs_i ] 181 | else : 182 | # Need to pre/append additional times 183 | timeOut = self.AddTime( Tp_magnitude, outSize, obs_i, obsOut_i ) 184 | 185 | #---------------------------------------------------- 186 | # Output DataFrame 187 | #---------------------------------------------------- 188 | self.Projection = DataFrame( 189 | { 'Time' : timeOut, 190 | 'Observations' : observationOut, 191 | 'Predictions' : projectionOut, 192 | 'Pred_Variance' : varianceOut } ) 193 | 194 | #---------------------------------------------------- 195 | # SMap coefficients and singular values 196 | #---------------------------------------------------- 197 | if self.name == 'SMap' : 198 | # ndarray init to nan 199 | coefOut = full( (outSize, N_dim), nan ) 200 | SVOut = full( (outSize, N_dim), nan ) 201 | # fill coefOut, SVOut with projected values 202 | coefOut[ predOut_i, : ] = self.coefficients 203 | SVOut [ predOut_i, : ] = self.singularValues 204 | 205 | timeDF = DataFrame( { 'Time' : timeOut } ) 206 | 207 | colNames = [ 'C0' ] 208 | coefNames = [f'∂{self.target[0]}/∂{e}' for e in self.Embedding.columns] 209 | for c in coefNames : 210 | colNames.append( c ) 211 | coefDF = DataFrame( coefOut, columns = colNames ) 212 | 213 | colNames = [ f'C{i}' for i in range( N_dim ) ] 214 | SVDF = DataFrame( SVOut, columns = colNames ) 215 | 216 | self.Coefficients = timeDF.join( coefDF ) 217 | self.SingularValues = timeDF.join( SVDF ) 218 | 219 | #------------------------------------------------------------------- 220 | def ConvertTime( self ) : 221 | #------------------------------------------------------------------- 222 | '''Replace self.time with ndarray numerically operable values 223 | ISO 8601 formats are supported in the time & datetime modules 224 | ''' 225 | if self.verbose: 226 | print( f'{self.name}: ConvertTime()' ) 227 | 228 | time0 = self.time[0] 229 | 230 | # If times are numerically operable, nothing to do. 231 | if isinstance( time0, int ) or isinstance( time0, float ) or \ 232 | isinstance( time0, integer ) or isinstance( time0, floating ) or \ 233 | isinstance( time0, dt.time ) or isinstance( time0, dt.datetime ) : 234 | return 235 | 236 | # Local copy of time 237 | time_ = self.time.copy() # ndarray 238 | 239 | # If times are strings, try to parse into time or datetime 240 | # If success, replace time with parsed time or datetime array 241 | if isinstance( time0, str ) : 242 | try : 243 | t0 = dt.time.fromisoformat( time0 ) 244 | # Parsed t0 into dt.time OK. Parse the whole vector 245 | time_ = array( [ dt.time.fromisoformat(t) for t in time_ ] ) 246 | except ValueError : 247 | try: 248 | t0 = dt.datetime.fromisoformat( time0 ) 249 | # Parsed t0 into dt.datetime OK. Parse the whole vector 250 | time_ = array([ dt.datetime.fromisoformat(t) for t in time_ ]) 251 | except ValueError : 252 | msg = f'{self.name} ConvertTime(): Time values are strings '+\ 253 | 'but are not ISO 8601 recognized time or datetime.' 254 | raise RuntimeError( msg ) 255 | 256 | # If times were string they have been converted to time or datetime 257 | # Ensure times can be numerically manipulated, compute deltaT 258 | try : 259 | deltaT = time_[1] - time_[0] 260 | except TypeError : 261 | msg = f'{self.name} ConvertTime(): Time values not recognized.' +\ 262 | ' Accepted values are int, float, or string of ISO 8601' +\ 263 | ' compliant time or datetime.' 264 | raise RuntimeError( msg ) 265 | 266 | # Replace DataFrame derived time with converted time_ 267 | self.time = time_ 268 | 269 | #------------------------------------------------------------------- 270 | def AddTime( self, Tp_magnitude, outSize, obs_i, obsOut_i ) : 271 | #------------------------------------------------------------------- 272 | '''Prepend or append time values to self.time if needed 273 | Return timeOut vector with additional Tp points 274 | ''' 275 | if self.verbose: 276 | print( f'{self.name}: AddTime()' ) 277 | 278 | min_pred_i = self.pred_i[0] 279 | max_pred_i_all = self.pred_i_all[-1] 280 | deltaT = self.time[1] - self.time[0] 281 | 282 | # First, fill timeOut with times in time 283 | # timeOut should not be int (np.integer) since they cannot be nan 284 | time0 = self.time[0] 285 | if isinstance( time0, int ) or isinstance( time0, integer ) : 286 | time_dtype = float 287 | else : 288 | time_dtype = type( time0 ) 289 | 290 | timeOut = full( outSize, nan, dtype = time_dtype ) 291 | 292 | timeOut[ obsOut_i ] = self.time[ obs_i ] 293 | 294 | newTimes = full( Tp_magnitude, nan, dtype = time_dtype ) 295 | 296 | if self.Tp > 0 : 297 | # Tp introduces time values beyond the range of time 298 | # Generate future times 299 | lastTime = self.time[ max_pred_i_all ] 300 | newTimes[0] = lastTime + deltaT 301 | 302 | for i in range( 1, self.Tp ) : 303 | newTimes[ i ] = newTimes[ i-1 ] + deltaT 304 | 305 | timeOut[ -self.Tp : ] = newTimes 306 | 307 | else : 308 | # Tp introduces time values before the range of time 309 | # Generate past times 310 | newTimes[0] = self.time[ min_pred_i ] - deltaT 311 | for i in range( 1, Tp_magnitude ) : 312 | newTimes[ i ] = newTimes[ i-1 ] - deltaT 313 | 314 | newTimes = newTimes[::-1] # Reverse 315 | 316 | # Shift timeOut values based on leading nan 317 | shift = Tp_magnitude - self.pred_i[0] 318 | timeOut[ : Tp_magnitude ] = newTimes 319 | 320 | return timeOut 321 | -------------------------------------------------------------------------------- /src/pyEDM/LoadData.py: -------------------------------------------------------------------------------- 1 | '''Loading of example data.''' 2 | 3 | import importlib.resources # Get data file pathnames from EDM package 4 | 5 | from pandas import read_csv 6 | 7 | dataFileNames = [ ("TentMap.csv", "TentMap"), 8 | ("TentMapNoise.csv", "TentMapNoise"), 9 | ("circle.csv", "circle"), 10 | ("circle_noise.csv", "circleNoise"), 11 | ("circle_noTime.csv", "circle_noTime"), 12 | ("columnNameSpace.csv", "columnNameSpace"), 13 | ("block_3sp.csv", "block_3sp"), 14 | ("sardine_anchovy_sst.csv", "sardine_anchovy_sst"), 15 | ("LorenzData1000.csv", "Lorenz5D"), 16 | ("S12CD-S333-SumFlow_1980-2005.csv", "SumFlow_1980-2005") ] 17 | 18 | # Dictionary of module DataFrames so user can access sample data 19 | sampleData = {} 20 | 21 | for fileName, dataName in dataFileNames: 22 | 23 | filePath = "data/" + fileName 24 | 25 | ref = importlib.resources.files('pyEDM') / filePath 26 | 27 | with importlib.resources.as_file( ref ) as filePath_ : 28 | sampleData[ dataName ] = read_csv( filePath_ ) 29 | 30 | if not len( sampleData ) : 31 | raise Warning( "pyEDM: Failed to find sample data in pyEDM package." ) 32 | -------------------------------------------------------------------------------- /src/pyEDM/Multiview.py: -------------------------------------------------------------------------------- 1 | 2 | # python modules 3 | from multiprocessing import Pool 4 | from math import floor, sqrt 5 | from warnings import warn 6 | from itertools import combinations, repeat 7 | 8 | # package modules 9 | from numpy import argsort, array 10 | 11 | # local modules 12 | from .Simplex import Simplex as SimplexClass 13 | from .AuxFunc import ComputeError, IsIterable 14 | 15 | import pyEDM.API as API 16 | import pyEDM.PoolFunc as PoolFunc 17 | 18 | #------------------------------------------------------------------ 19 | class Multiview: 20 | '''Multiview class : Base class. Contains a Simplex instance 21 | 22 | D represents the number of variables to combine for each 23 | assessment, if not specified, it is the number of columns. 24 | 25 | E is the embedding dimension of each variable. 26 | If E = 1, no time delay embedding is done, but the variables 27 | in the embedding are named X(t-0), Y(t-0)... 28 | 29 | Simplex.Validate() sets knn equal to E+1 if knn not specified, 30 | so we need to explicitly set knn to D + 1. 31 | 32 | Parameter 'multiview' is the number of top-ranked D-dimensional 33 | predictions for the final prediction. Corresponds to parameter k 34 | in Ye & Sugihara with default k = sqrt(m) where m is the number 35 | of combinations C(n,D) available from the n = D * E columns 36 | taken D at-a-time. 37 | 38 | Ye H., and G. Sugihara, 2016. Information leverage in 39 | interconnected ecosystems: Overcoming the curse of dimensionality 40 | Science 353:922-925. 41 | 42 | NOTE: Multiview evaluates the top projections using in-sample 43 | library predictions. It can be shown that highly accurate 44 | in-sample predictions can be made from arbitrary non- 45 | constant, non-oscillatory vectors. Therefore, some attention 46 | may be warranted to filter prospective embedding vectors. 47 | The trainLib flag disables this default behavior (pred == lib) 48 | so that the top k rankings are done using the specified 49 | lib and pred. 50 | ''' 51 | 52 | def __init__( self, 53 | dataFrame = None, 54 | columns = "", 55 | target = "", 56 | lib = "", 57 | pred = "", 58 | D = 0, 59 | E = 1, 60 | Tp = 1, 61 | knn = 0, 62 | tau = -1, 63 | multiview = 0, 64 | exclusionRadius = 0, 65 | trainLib = True, 66 | excludeTarget = False, 67 | ignoreNan = True, 68 | verbose = False, 69 | numProcess = 4, 70 | returnObject = False ): 71 | '''Initialize Multiview.''' 72 | 73 | # Assign parameters from API arguments 74 | self.name = 'Multiview' 75 | self.Data = dataFrame 76 | self.columns = columns 77 | self.target = target 78 | self.lib = lib 79 | self.pred = pred 80 | self.D = D 81 | self.E = E 82 | self.Tp = Tp 83 | self.knn = knn 84 | self.tau = tau 85 | self.multiview = multiview 86 | self.exclusionRadius = exclusionRadius 87 | self.trainLib = trainLib 88 | self.excludeTarget = excludeTarget 89 | self.ignoreNan = ignoreNan 90 | self.verbose = verbose 91 | self.numProcess = numProcess 92 | 93 | self.Embedding = None # DataFrame 94 | self.View = None # DataFrame 95 | self.Projection = None # DataFrame 96 | 97 | self.combos = None # List of column combinations (tuples) 98 | self.topRankCombos = None # List of top columns (tuples) 99 | self.topRankProjections = None # dict of columns : DataFrame 100 | self.topRankStats = None # dict of columns : dict of stats 101 | 102 | # Setup 103 | self.Validate() # Multiview Method 104 | self.Setup() # Embed Data 105 | 106 | #------------------------------------------------------------------- 107 | # Methods 108 | #------------------------------------------------------------------- 109 | def Rank( self ) : 110 | '''Multiprocess to rank top multiview vectors''' 111 | 112 | if self.verbose: 113 | print( f'{self.name}: Rank()' ) 114 | 115 | args = { 'target' : self.target, 116 | 'lib' : self.lib, 117 | 'pred' : self.pred, 118 | 'E' : self.D, 119 | 'Tp' : self.Tp, 120 | 'tau' : self.tau, 121 | 'exclusionRadius' : self.exclusionRadius, 122 | 'embedded' : True, 123 | 'noTime' : True, 124 | 'ignoreNan' : self.ignoreNan } 125 | 126 | if self.trainLib : 127 | # Set pred = lib for in-sample training 128 | args['pred'] = self.lib 129 | 130 | # Create iterable for Pool.starmap, repeated copies of data, args 131 | poolArgs = zip( self.combos, repeat( self.Embedding ), repeat( args ) ) 132 | 133 | # Multiargument starmap : MultiviewSimplexRho in PoolFunc 134 | with Pool( processes = self.numProcess ) as pool : 135 | rhoList = pool.starmap( PoolFunc.MultiviewSimplexRho, poolArgs ) 136 | 137 | rhoVec = array( rhoList, dtype = float ) 138 | rank_i = argsort( rhoVec )[::-1] # Reverse results 139 | topRank_i = rank_i[ :self.multiview ] 140 | 141 | self.topRankCombos = [ self.combos[i] for i in topRank_i ] 142 | 143 | #------------------------------------------------------------------- 144 | # 145 | #------------------------------------------------------------------- 146 | def Project( self ) : 147 | '''Projection with top multiview vectors''' 148 | 149 | if self.verbose: 150 | print( f'{self.name}: Project()' ) 151 | 152 | args = { 'target' : self.target, 153 | 'lib' : self.lib, 154 | 'pred' : self.pred, 155 | 'E' : self.D, 156 | 'Tp' : self.Tp, 157 | 'tau' : self.tau, 158 | 'exclusionRadius' : self.exclusionRadius, 159 | 'embedded' : True, 160 | 'noTime' : True, 161 | 'ignoreNan' : self.ignoreNan } 162 | 163 | # Create iterable for Pool.starmap, repeated copies of data, args 164 | poolArgs = zip( self.topRankCombos, repeat( self.Embedding ), 165 | repeat( args ) ) 166 | 167 | # Multiargument starmap : MultiviewSimplexPred in PoolFunc 168 | with Pool( processes = self.numProcess ) as pool : 169 | dfList = pool.starmap( PoolFunc.MultiviewSimplexPred, poolArgs ) 170 | 171 | self.topRankProjections = dict( zip( self.topRankCombos, dfList ) ) 172 | 173 | #-------------------------------------------------------------------- 174 | def Setup( self ): 175 | #-------------------------------------------------------------------- 176 | '''Set D, lib, pred, combos. Embed Data. 177 | ''' 178 | if self.verbose: 179 | print( f'{self.name}: Setup()' ) 180 | 181 | # Set default lib & pred if not provided 182 | if self.trainLib : 183 | if not len( self.pred ) and not len( self.lib ) : 184 | # Set lib & pred for ranking : lib, pred = 1/2 data 185 | self.lib = [ 1, floor( self.Data.shape[0]/2 ) ] 186 | self.pred = [ floor( self.Data.shape[0]/2 ) + 1, 187 | self.Data.shape[0]] 188 | 189 | # Establish state-space dimension D 190 | # default to number of input columns (not embedding columns) 191 | if self.D == 0 : 192 | self.D = len( self.columns ) 193 | 194 | # Check D is not greater than number of embedding columns 195 | if self.D > len( self.columns ) * self.E : 196 | newD = len( self.columns ) * self.E 197 | msg = f'Validate() {self.name}: D = {self.D}' +\ 198 | ' exceeds number of columns in the embedding: {newD}.' +\ 199 | f' D set to {newD}' 200 | warn( msg ) 201 | 202 | self.D = newD 203 | 204 | # Remove target columns from potential combos 205 | if self.excludeTarget : 206 | comboCols = [col for col in self.columns if col not in self.target] 207 | else : 208 | comboCols = self.columns 209 | 210 | # Embed Data 211 | self.Embedding = API.Embed( self.Data, E = self.E, tau = self.tau, 212 | columns = comboCols ) 213 | 214 | # Combinations of possible embedding vectors, D at-a-time 215 | self.combos = list( combinations( self.Embedding.columns, self.D ) ) 216 | 217 | # Establish number of ensembles if not specified 218 | if self.multiview < 1 : 219 | # Ye & Sugihara suggest sqrt( m ) as number of embeddings to avg 220 | self.multiview = floor( sqrt( len( self.combos ) ) ) 221 | 222 | if self.verbose : 223 | msg = 'Validate() {self.name}:' +\ 224 | f' Set view sample size to {self.multiview}' 225 | print( msg, flush = True ) 226 | 227 | if self.multiview > len( self.combos ) : 228 | msg = 'Validate() {self.name}: multiview ensembles ' +\ 229 | f' {self.multiview} exceeds the number of available' +\ 230 | f' combinations: {len(combos)}. Set to {len(combos)}.' 231 | warn( msg ) 232 | 233 | self.multiview = len( self.combos ) 234 | 235 | #-------------------------------------------------------------------- 236 | def Validate( self ): 237 | #-------------------------------------------------------------------- 238 | if self.verbose: 239 | print( f'{self.name}: Validate()' ) 240 | 241 | if not self.columns : 242 | raise RuntimeError( f'Validate() {self.name}: columns required.' ) 243 | if not IsIterable( self.columns ) : 244 | self.columns = self.columns.split() 245 | 246 | if not self.target : 247 | raise RuntimeError( f'Validate() {self.name}: target required.' ) 248 | if not IsIterable( self.target ) : 249 | self.target = self.target.split() 250 | # Add (t-0) to target since Embedding columns are mapped 251 | self.target[0] = self.target[0] + '(t-0)' 252 | 253 | if not self.trainLib : 254 | if not len( self.lib ) : 255 | msg = f'{self.name}: Validate(): trainLib False requires' +\ 256 | ' lib specification.' 257 | raise RuntimeError( msg ) 258 | 259 | if not len( self.pred ) : 260 | msg = f'{self.name}: Validate(): trainLib False requires' +\ 261 | ' pred specification.' 262 | raise RuntimeError( msg ) 263 | -------------------------------------------------------------------------------- /src/pyEDM/PoolFunc.py: -------------------------------------------------------------------------------- 1 | 2 | # python modules 3 | 4 | # package modules 5 | 6 | # local modules 7 | import pyEDM.API as API 8 | from .AuxFunc import ComputeError 9 | 10 | #------------------------------------------------------ 11 | # Function to evaluate multiview predictions top combos 12 | #------------------------------------------------------ 13 | def MultiviewSimplexPred( combo, data, args ) : 14 | 15 | df = API.Simplex( dataFrame = data, 16 | columns = list( combo ), 17 | target = args['target'], 18 | lib = args['lib'], 19 | pred = args['pred'], 20 | E = args['E'], 21 | Tp = args['Tp'], 22 | tau = args['tau'], 23 | exclusionRadius = args['exclusionRadius'], 24 | embedded = args['embedded'], 25 | noTime = args['noTime'], 26 | ignoreNan = args['ignoreNan'] ) 27 | return df 28 | 29 | #---------------------------------------------------- 30 | # Function to evaluate combo rank (rho) 31 | #---------------------------------------------------- 32 | def MultiviewSimplexRho( combo, data, args ) : 33 | 34 | df = API.Simplex( dataFrame = data, 35 | columns = list( combo ), 36 | target = args['target'], 37 | lib = args['lib'], 38 | pred = args['pred'], 39 | E = args['E'], 40 | Tp = args['Tp'], 41 | tau = args['tau'], 42 | exclusionRadius = args['exclusionRadius'], 43 | embedded = args['embedded'], 44 | noTime = args['noTime'], 45 | ignoreNan = args['ignoreNan'] ) 46 | 47 | err = ComputeError( df['Observations'], df['Predictions'] ) 48 | return err['rho'] 49 | 50 | #---------------------------------------------------- 51 | # Function to evaluate Simplex in EmbedDimension Pool 52 | #---------------------------------------------------- 53 | def EmbedDimSimplexFunc( E, data, args ) : 54 | 55 | df = API.Simplex( dataFrame = data, 56 | columns = args['columns'], 57 | target = args['target'], 58 | lib = args['lib'], 59 | pred = args['pred'], 60 | E = E, 61 | Tp = args['Tp'], 62 | tau = args['tau'], 63 | exclusionRadius = args['exclusionRadius'], 64 | embedded = args['embedded'], 65 | validLib = args['validLib'], 66 | noTime = args['noTime'], 67 | ignoreNan = args['ignoreNan'] ) 68 | 69 | err = ComputeError( df['Observations'], df['Predictions'] ) 70 | return err['rho'] 71 | 72 | #----------------------------------------------------- 73 | # Function to evaluate Simplex in PredictInterval Pool 74 | #----------------------------------------------------- 75 | def PredictIntervalSimplexFunc( Tp, data, args ) : 76 | 77 | df = API.Simplex( dataFrame = data, 78 | columns = args['columns'], 79 | target = args['target'], 80 | lib = args['lib'], 81 | pred = args['pred'], 82 | E = args['E'], 83 | Tp = Tp, 84 | tau = args['tau'], 85 | exclusionRadius = args['exclusionRadius'], 86 | embedded = args['embedded'], 87 | validLib = args['validLib'], 88 | noTime = args['noTime'], 89 | ignoreNan = args['ignoreNan'] ) 90 | 91 | err = ComputeError( df['Observations'], df['Predictions'] ) 92 | return err['rho'] 93 | 94 | #----------------------------------------------------- 95 | # Function to evaluate SMap in PredictNonlinear Pool 96 | #----------------------------------------------------- 97 | def PredictNLSMapFunc( theta, data, args ) : 98 | 99 | S = API.SMap( dataFrame = data, 100 | columns = args['columns'], 101 | target = args['target'], 102 | lib = args['lib'], 103 | pred = args['pred'], 104 | E = args['E'], 105 | Tp = args['Tp'], 106 | tau = args['tau'], 107 | theta = theta, 108 | exclusionRadius = args['exclusionRadius'], 109 | solver = args['solver'], 110 | embedded = args['embedded'], 111 | validLib = args['validLib'], 112 | noTime = args['noTime'], 113 | ignoreNan = args['ignoreNan'] ) 114 | 115 | df = S['predictions'] 116 | err = ComputeError( df['Observations'], df['Predictions'] ) 117 | return err['rho'] 118 | -------------------------------------------------------------------------------- /src/pyEDM/Simplex.py: -------------------------------------------------------------------------------- 1 | 2 | # python modules 3 | 4 | # package modules 5 | from numpy import array, divide, exp, fmax, full, integer, nan 6 | from numpy import linspace, power, subtract, sum, zeros 7 | from pandas import DataFrame, Series, concat 8 | 9 | # local modules 10 | from .EDM import EDM as EDMClass 11 | 12 | #----------------------------------------------------------- 13 | class Simplex( EDMClass ): 14 | '''Simplex class : child of EDM 15 | CCM & Multiview inhereted from Simplex 16 | To Do : Neighbor ties''' 17 | 18 | def __init__( self, 19 | dataFrame = None, 20 | columns = "", 21 | target = "", 22 | lib = "", 23 | pred = "", 24 | E = 0, 25 | Tp = 1, 26 | knn = 0, 27 | tau = -1, 28 | exclusionRadius = 0, 29 | embedded = False, 30 | validLib = [], 31 | noTime = False, 32 | generateSteps = 0, 33 | generateConcat = False, 34 | ignoreNan = True, 35 | verbose = False ): 36 | '''Initialize Simplex as child of EDM. 37 | Set data object to dataFrame. 38 | Setup : Validate(), CreateIndices(), get targetVec, time''' 39 | 40 | # Instantiate EDM class: inheret EDM members to self 41 | super(Simplex, self).__init__( dataFrame, 'Simplex' ) 42 | 43 | # Assign parameters from API arguments 44 | self.columns = columns 45 | self.target = target 46 | self.lib = lib 47 | self.pred = pred 48 | self.E = E 49 | self.Tp = Tp 50 | self.knn = knn 51 | self.tau = tau 52 | self.exclusionRadius = exclusionRadius 53 | self.embedded = embedded 54 | self.validLib = validLib 55 | self.noTime = noTime 56 | self.generateSteps = generateSteps 57 | self.generateConcat = generateConcat 58 | self.ignoreNan = ignoreNan 59 | self.verbose = verbose 60 | 61 | # Prediction row accounting of library neighbor ties 62 | # self.anyTies = False 63 | # self.ties = None # (bool) true/false each prediction row 64 | # self.tieFirstIndex = None # (int) index in knn of first tie 65 | # self.tiePairs = None # vector of 2-tuples 66 | 67 | # Setup 68 | self.Validate() # EDM Method 69 | self.CreateIndices() # Generate lib_i & pred_i, validLib : EDM Method 70 | 71 | self.targetVec = self.Data[ [ self.target[0] ] ].to_numpy() 72 | 73 | if self.noTime : 74 | # Generate a time/index vector, store as ndarray 75 | timeIndex = [ i for i in range( 1, self.Data.shape[0] + 1 ) ] 76 | self.time = Series( timeIndex, dtype = int ).to_numpy() 77 | else : 78 | # 1st data column is time 79 | self.time = self.Data.iloc[ :, 0 ].to_numpy() 80 | 81 | #------------------------------------------------------------------- 82 | # Methods 83 | #------------------------------------------------------------------- 84 | def Run( self ) : 85 | #------------------------------------------------------------------- 86 | self.EmbedData() 87 | self.RemoveNan() 88 | self.FindNeighbors() 89 | self.Project() 90 | self.FormatProjection() 91 | 92 | #------------------------------------------------------------------- 93 | def Project( self ) : 94 | #------------------------------------------------------------------- 95 | '''Simplex Projection 96 | Sugihara & May (1990) doi.org/10.1038/344734a0''' 97 | if self.verbose: 98 | print( f'{self.name}: Project()' ) 99 | 100 | # First column of knn_distances is minimum distance of all N pred rows 101 | minDistances = self.knn_distances[:,0] 102 | # In case there is 0 in minDistances: minWeight = 1E-6 103 | minDistances = fmax( minDistances, 1E-6 ) 104 | 105 | # Divide each column of the N x k knn_distances matrix by N row 106 | # column vector minDistances 107 | scaledDistances = divide( self.knn_distances, minDistances[:,None] ) 108 | 109 | weights = exp( -scaledDistances ) # N x k 110 | weightRowSum = sum( weights, axis = 1 ) # N x 1 111 | 112 | # Matrix of knn_neighbors + Tp defines library target values 113 | # JP : Find optimal way to fill libTargetValues, for now: 114 | # Since number of knn is usually less than number of pred rows 115 | # loop over knn_neighbors_Tp columns to get target value column 116 | # vectors from the knn_neighbors_Tp row indices 117 | knn_neighbors_Tp = self.knn_neighbors + self.Tp # N x k 118 | libTargetValues = zeros( knn_neighbors_Tp.shape ) # N x k 119 | 120 | for j in range( knn_neighbors_Tp.shape[1] ) : # for each column j of k 121 | libTargetValues[ :, j ][ :, None ] = \ 122 | self.targetVec[ knn_neighbors_Tp[ :, j ] ] 123 | 124 | # Projection is average of weighted knn library target values 125 | self.projection = sum(weights * libTargetValues, axis=1) / weightRowSum 126 | 127 | # "Variance" estimate assuming weights are probabilities 128 | libTargetPredDiff = subtract( libTargetValues, self.projection[:,None] ) 129 | deltaSqr = power( libTargetPredDiff, 2 ) 130 | self.variance = sum( weights * deltaSqr, axis = 1 ) / weightRowSum 131 | 132 | #------------------------------------------------------------------- 133 | def Generate( self ) : 134 | #------------------------------------------------------------------- 135 | '''Simplex Generation 136 | Given lib: override pred for single prediction at end of lib 137 | Replace self.Projection with G.Projection 138 | 139 | Note: Generation with datetime time values fails: incompatible 140 | numpy.datetime64, timedelta64 and python datetime, timedelta 141 | ''' 142 | if self.verbose: 143 | print( f'{self.name}: Generate()' ) 144 | 145 | # Local references for convenience 146 | N = self.Data.shape[0] 147 | column = self.columns[0] 148 | target = self.target[0] 149 | lib = self.lib 150 | 151 | if self.verbose: 152 | print(f'\tData shape: {self.Data.shape} : ' +\ 153 | f'{self.Data.columns.to_list()}') 154 | print(self.Data.head(3)) 155 | print(f'\tlib: {lib}') 156 | 157 | # Override pred for single prediction at end of lib 158 | pred = [ lib[-1] - 1, lib[-1] ] 159 | if self.verbose: 160 | print(f'\tGenerate(): pred overriden to {pred}') 161 | 162 | # Output DataFrame to replace self.Projection 163 | if self.noTime : 164 | time_dtype = float # numpy int cannot represent nan, use float 165 | else : 166 | self.ConvertTime() 167 | 168 | time0 = self.time[0] 169 | if isinstance( time0, int ) or isinstance( time0, integer ) : 170 | time_dtype = float # numpy int cannot represent nan, use float 171 | else : 172 | time_dtype = type( time0 ) 173 | 174 | nOutRows = self.generateSteps 175 | generated = DataFrame({'Time' : full(nOutRows, nan, dtype = time_dtype), 176 | 'Observations' : full(nOutRows, nan), 177 | 'Predictions' : full(nOutRows, nan), 178 | 'Pred_Variance' : full(nOutRows, nan)}) 179 | 180 | # Allocate vector for univariate column data 181 | # At each iteration the prediction is stored in columnData 182 | # timeData and columnData are copied to newData for next iteration 183 | columnData = full( N + nOutRows, nan ) 184 | columnData[:N] = self.Data.loc[ :, column ] # First col only 185 | 186 | # Allocate output time vector & newData DataFrame 187 | timeData = full( N + nOutRows, nan, dtype = time_dtype ) 188 | if self.noTime : 189 | # If noTime create a time vector and join into self.Data 190 | timeData[:N] = linspace( 1, N, N ) 191 | timeDF = DataFrame( {'Time' : timeData[:N]} ) 192 | self.Data = timeDF.join( self.Data, lsuffix = '_' ) 193 | else : 194 | timeData[:N] = self.time 195 | 196 | newData = self.Data.copy() 197 | 198 | #------------------------------------------------------------------- 199 | # Loop for each feedback generation step 200 | #------------------------------------------------------------------- 201 | for step in range( self.generateSteps ) : 202 | if self.verbose : 203 | print( f'{self.name}: Generate(): step {step} {"="*50}') 204 | 205 | # Local SimplexClass for generation 206 | G = Simplex( dataFrame = newData, 207 | columns = column, 208 | target = target, 209 | lib = lib, 210 | pred = pred, 211 | E = self.E, 212 | Tp = self.Tp, 213 | knn = self.knn, 214 | tau = self.tau, 215 | exclusionRadius = self.exclusionRadius, 216 | embedded = self.embedded, 217 | validLib = self.validLib, 218 | noTime = self.noTime, 219 | generateSteps = self.generateSteps, 220 | generateConcat = self.generateConcat, 221 | ignoreNan = self.ignoreNan, 222 | verbose = self.verbose ) 223 | 224 | # 1) Generate prediction ---------------------------------- 225 | G.Run() 226 | 227 | if self.verbose : 228 | print( '1) G.Projection' ) 229 | print( G.Projection ); print() 230 | 231 | newPrediction = G.Projection['Predictions'].iat[-1] 232 | newTime = G.Projection.iloc[-1, 0] # Presume col 0 is time 233 | 234 | # 2) Save prediction in generated -------------------------- 235 | generated.iloc[ step, : ] = G.Projection.iloc[-1, :] 236 | 237 | if self.verbose : 238 | print( f'2) generated\n{generated}\n' ) 239 | 240 | # 3) Increment library by adding another row index --------- 241 | # Dynamic library not implemented 242 | 243 | # 4) Increment prediction indices -------------------------- 244 | pred = [ p + 1 for p in pred ] 245 | 246 | if self.verbose: 247 | print(f'4) pred {pred}') 248 | 249 | # 5) Add 1-step ahead projection to newData for next Project() 250 | columnData[ N + step ] = newPrediction 251 | timeData [ N + step ] = newTime 252 | 253 | # JP : for big data this is likely not efficient 254 | newData = DataFrame( { 'Time' : timeData [:(N + step + 1)], 255 | f'{column}' : columnData[:(N + step + 1)] } ) 256 | 257 | if self.verbose: 258 | print(f'5) newData: {newData.shape} newData.tail(4):') 259 | print( newData.tail(4) ) 260 | #^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 261 | # Loop for each feedback generation step 262 | #---------------------------------------------------------- 263 | 264 | # Replace self.Projection with Generated 265 | if self.generateConcat : 266 | # Join original data observations with generated predictions 267 | timeName = self.Data.columns[0] 268 | dataDF = self.Data.loc[ :, [timeName, column] ] 269 | dataDF.columns = [ 'Time', 'Observations' ] 270 | self.Projection = concat( [ dataDF, generated ], axis = 0 ) 271 | 272 | else : 273 | self.Projection = generated 274 | -------------------------------------------------------------------------------- /src/pyEDM/__init__.py: -------------------------------------------------------------------------------- 1 | '''Python tools for EDM''' 2 | # import EDM functions 3 | from .API import MakeBlock, Embed, Simplex, SMap, CCM, Multiview 4 | from .API import EmbedDimension, PredictInterval, PredictNonlinear 5 | from .AuxFunc import Examples, PlotObsPred, PlotCoeff, ComputeError 6 | from .AuxFunc import SurrogateData 7 | from .LoadData import sampleData 8 | 9 | __version__ = "2.2.2" 10 | __versionDate__ = "2025-02-23" 11 | -------------------------------------------------------------------------------- /src/pyEDM/data/circle.csv: -------------------------------------------------------------------------------- 1 | Time,x,y 2 | 1,0,1 3 | 2,0.0631,0.998 4 | 3,0.126,0.992 5 | 4,0.1883,0.9821 6 | 5,0.2499,0.9683 7 | 6,0.3105,0.9506 8 | 7,0.3699,0.9291 9 | 8,0.4278,0.9039 10 | 9,0.484,0.8751 11 | 10,0.5382,0.8428 12 | 11,0.5903,0.8072 13 | 12,0.6401,0.7683 14 | 13,0.6873,0.7264 15 | 14,0.7318,0.6815 16 | 15,0.7733,0.634 17 | 16,0.8118,0.5839 18 | 17,0.847,0.5316 19 | 18,0.8789,0.477 20 | 19,0.9072,0.4206 21 | 20,0.932,0.3625 22 | 21,0.953,0.303 23 | 22,0.9702,0.2423 24 | 23,0.9836,0.1806 25 | 24,0.993,0.1181 26 | 25,0.9985,0.0552 27 | 26,1,-0.0079 28 | 27,0.9975,-0.071 29 | 28,0.991,-0.1338 30 | 29,0.9806,-0.1961 31 | 30,0.9663,-0.2575 32 | 31,0.9481,-0.318 33 | 32,0.9261,-0.3772 34 | 33,0.9005,-0.4349 35 | 34,0.8712,-0.4909 36 | 35,0.8385,-0.5449 37 | 36,0.8025,-0.5967 38 | 37,0.7632,-0.6461 39 | 38,0.7209,-0.693 40 | 39,0.6758,-0.7371 41 | 40,0.6279,-0.7783 42 | 41,0.5775,-0.8164 43 | 42,0.5249,-0.8512 44 | 43,0.4701,-0.8826 45 | 44,0.4135,-0.9105 46 | 45,0.3552,-0.9348 47 | 46,0.2955,-0.9554 48 | 47,0.2346,-0.9721 49 | 48,0.1728,-0.985 50 | 49,0.1103,-0.9939 51 | 50,0.0473,-0.9989 52 | 51,-0.0158,-0.9999 53 | 52,-0.0789,-0.9969 54 | 53,-0.1416,-0.9899 55 | 54,-0.2038,-0.979 56 | 55,-0.2652,-0.9642 57 | 56,-0.3255,-0.9455 58 | 57,-0.3845,-0.9231 59 | 58,-0.442,-0.897 60 | 59,-0.4977,-0.8673 61 | 60,-0.5515,-0.8342 62 | 61,-0.603,-0.7977 63 | 62,-0.6521,-0.7581 64 | 63,-0.6987,-0.7154 65 | 64,-0.7424,-0.6699 66 | 65,-0.7832,-0.6217 67 | 66,-0.8209,-0.5711 68 | 67,-0.8553,-0.5181 69 | 68,-0.8863,-0.4631 70 | 69,-0.9138,-0.4063 71 | 70,-0.9376,-0.3478 72 | 71,-0.9577,-0.2879 73 | 72,-0.9739,-0.2269 74 | 73,-0.9863,-0.165 75 | 74,-0.9947,-0.1024 76 | 75,-0.9992,-0.0395 77 | 76,-0.9997,0.0237 78 | 77,-0.9962,0.0867 79 | 78,-0.9888,0.1494 80 | 79,-0.9774,0.2115 81 | 80,-0.9621,0.2728 82 | 81,-0.9429,0.3329 83 | 82,-0.9201,0.3918 84 | 83,-0.8935,0.4491 85 | 84,-0.8634,0.5046 86 | 85,-0.8298,0.558 87 | 86,-0.793,0.6093 88 | 87,-0.7529,0.6581 89 | 88,-0.7099,0.7043 90 | 89,-0.664,0.7477 91 | 90,-0.6155,0.7881 92 | 91,-0.5646,0.8254 93 | 92,-0.5113,0.8594 94 | 93,-0.4561,0.8899 95 | 94,-0.399,0.9169 96 | 95,-0.3404,0.9403 97 | 96,-0.2804,0.9599 98 | 97,-0.2192,0.9757 99 | 98,-0.1572,0.9876 100 | 99,-0.0946,0.9955 101 | 100,-0.0316,0.9995 102 | 101,0.0316,0.9995 103 | 102,0.0946,0.9955 104 | 103,0.1572,0.9876 105 | 104,0.2192,0.9757 106 | 105,0.2804,0.9599 107 | 106,0.3404,0.9403 108 | 107,0.399,0.9169 109 | 108,0.4561,0.8899 110 | 109,0.5113,0.8594 111 | 110,0.5646,0.8254 112 | 111,0.6155,0.7881 113 | 112,0.664,0.7477 114 | 113,0.7099,0.7043 115 | 114,0.7529,0.6581 116 | 115,0.793,0.6093 117 | 116,0.8298,0.558 118 | 117,0.8634,0.5046 119 | 118,0.8935,0.4491 120 | 119,0.9201,0.3918 121 | 120,0.9429,0.3329 122 | 121,0.9621,0.2728 123 | 122,0.9774,0.2115 124 | 123,0.9888,0.1494 125 | 124,0.9962,0.0867 126 | 125,0.9997,0.0237 127 | 126,0.9992,-0.0395 128 | 127,0.9947,-0.1024 129 | 128,0.9863,-0.165 130 | 129,0.9739,-0.2269 131 | 130,0.9577,-0.2879 132 | 131,0.9376,-0.3478 133 | 132,0.9138,-0.4063 134 | 133,0.8863,-0.4631 135 | 134,0.8553,-0.5181 136 | 135,0.8209,-0.5711 137 | 136,0.7832,-0.6217 138 | 137,0.7424,-0.6699 139 | 138,0.6987,-0.7154 140 | 139,0.6521,-0.7581 141 | 140,0.603,-0.7977 142 | 141,0.5515,-0.8342 143 | 142,0.4977,-0.8673 144 | 143,0.442,-0.897 145 | 144,0.3845,-0.9231 146 | 145,0.3255,-0.9455 147 | 146,0.2652,-0.9642 148 | 147,0.2038,-0.979 149 | 148,0.1416,-0.9899 150 | 149,0.0789,-0.9969 151 | 150,0.0158,-0.9999 152 | 151,-0.0473,-0.9989 153 | 152,-0.1103,-0.9939 154 | 153,-0.1728,-0.985 155 | 154,-0.2346,-0.9721 156 | 155,-0.2955,-0.9554 157 | 156,-0.3552,-0.9348 158 | 157,-0.4135,-0.9105 159 | 158,-0.4701,-0.8826 160 | 159,-0.5249,-0.8512 161 | 160,-0.5775,-0.8164 162 | 161,-0.6279,-0.7783 163 | 162,-0.6758,-0.7371 164 | 163,-0.7209,-0.693 165 | 164,-0.7632,-0.6461 166 | 165,-0.8025,-0.5967 167 | 166,-0.8385,-0.5449 168 | 167,-0.8712,-0.4909 169 | 168,-0.9005,-0.4349 170 | 169,-0.9261,-0.3772 171 | 170,-0.9481,-0.318 172 | 171,-0.9663,-0.2575 173 | 172,-0.9806,-0.1961 174 | 173,-0.991,-0.1338 175 | 174,-0.9975,-0.071 176 | 175,-1,-0.0079 177 | 176,-0.9985,0.0552 178 | 177,-0.993,0.1181 179 | 178,-0.9836,0.1806 180 | 179,-0.9702,0.2423 181 | 180,-0.953,0.303 182 | 181,-0.932,0.3625 183 | 182,-0.9072,0.4206 184 | 183,-0.8789,0.477 185 | 184,-0.847,0.5316 186 | 185,-0.8118,0.5839 187 | 186,-0.7733,0.634 188 | 187,-0.7318,0.6815 189 | 188,-0.6873,0.7264 190 | 189,-0.6401,0.7683 191 | 190,-0.5903,0.8072 192 | 191,-0.5382,0.8428 193 | 192,-0.484,0.8751 194 | 193,-0.4278,0.9039 195 | 194,-0.3699,0.9291 196 | 195,-0.3105,0.9506 197 | 196,-0.2499,0.9683 198 | 197,-0.1883,0.9821 199 | 198,-0.126,0.992 200 | 199,-0.0631,0.998 201 | 200,0,1 202 | -------------------------------------------------------------------------------- /src/pyEDM/data/circle_noTime.csv: -------------------------------------------------------------------------------- 1 | x,y 2 | 0,1 3 | 0.0631,0.998 4 | 0.126,0.992 5 | 0.1883,0.9821 6 | 0.2499,0.9683 7 | 0.3105,0.9506 8 | 0.3699,0.9291 9 | 0.4278,0.9039 10 | 0.484,0.8751 11 | 0.5382,0.8428 12 | 0.5903,0.8072 13 | 0.6401,0.7683 14 | 0.6873,0.7264 15 | 0.7318,0.6815 16 | 0.7733,0.634 17 | 0.8118,0.5839 18 | 0.847,0.5316 19 | 0.8789,0.477 20 | 0.9072,0.4206 21 | 0.932,0.3625 22 | 0.953,0.303 23 | 0.9702,0.2423 24 | 0.9836,0.1806 25 | 0.993,0.1181 26 | 0.9985,0.0552 27 | 1,-0.0079 28 | 0.9975,-0.071 29 | 0.991,-0.1338 30 | 0.9806,-0.1961 31 | 0.9663,-0.2575 32 | 0.9481,-0.318 33 | 0.9261,-0.3772 34 | 0.9005,-0.4349 35 | 0.8712,-0.4909 36 | 0.8385,-0.5449 37 | 0.8025,-0.5967 38 | 0.7632,-0.6461 39 | 0.7209,-0.693 40 | 0.6758,-0.7371 41 | 0.6279,-0.7783 42 | 0.5775,-0.8164 43 | 0.5249,-0.8512 44 | 0.4701,-0.8826 45 | 0.4135,-0.9105 46 | 0.3552,-0.9348 47 | 0.2955,-0.9554 48 | 0.2346,-0.9721 49 | 0.1728,-0.985 50 | 0.1103,-0.9939 51 | 0.0473,-0.9989 52 | -0.0158,-0.9999 53 | -0.0789,-0.9969 54 | -0.1416,-0.9899 55 | -0.2038,-0.979 56 | -0.2652,-0.9642 57 | -0.3255,-0.9455 58 | -0.3845,-0.9231 59 | -0.442,-0.897 60 | -0.4977,-0.8673 61 | -0.5515,-0.8342 62 | -0.603,-0.7977 63 | -0.6521,-0.7581 64 | -0.6987,-0.7154 65 | -0.7424,-0.6699 66 | -0.7832,-0.6217 67 | -0.8209,-0.5711 68 | -0.8553,-0.5181 69 | -0.8863,-0.4631 70 | -0.9138,-0.4063 71 | -0.9376,-0.3478 72 | -0.9577,-0.2879 73 | -0.9739,-0.2269 74 | -0.9863,-0.165 75 | -0.9947,-0.1024 76 | -0.9992,-0.0395 77 | -0.9997,0.0237 78 | -0.9962,0.0867 79 | -0.9888,0.1494 80 | -0.9774,0.2115 81 | -0.9621,0.2728 82 | -0.9429,0.3329 83 | -0.9201,0.3918 84 | -0.8935,0.4491 85 | -0.8634,0.5046 86 | -0.8298,0.558 87 | -0.793,0.6093 88 | -0.7529,0.6581 89 | -0.7099,0.7043 90 | -0.664,0.7477 91 | -0.6155,0.7881 92 | -0.5646,0.8254 93 | -0.5113,0.8594 94 | -0.4561,0.8899 95 | -0.399,0.9169 96 | -0.3404,0.9403 97 | -0.2804,0.9599 98 | -0.2192,0.9757 99 | -0.1572,0.9876 100 | -0.0946,0.9955 101 | -0.0316,0.9995 102 | 0.0316,0.9995 103 | 0.0946,0.9955 104 | 0.1572,0.9876 105 | 0.2192,0.9757 106 | 0.2804,0.9599 107 | 0.3404,0.9403 108 | 0.399,0.9169 109 | 0.4561,0.8899 110 | 0.5113,0.8594 111 | 0.5646,0.8254 112 | 0.6155,0.7881 113 | 0.664,0.7477 114 | 0.7099,0.7043 115 | 0.7529,0.6581 116 | 0.793,0.6093 117 | 0.8298,0.558 118 | 0.8634,0.5046 119 | 0.8935,0.4491 120 | 0.9201,0.3918 121 | 0.9429,0.3329 122 | 0.9621,0.2728 123 | 0.9774,0.2115 124 | 0.9888,0.1494 125 | 0.9962,0.0867 126 | 0.9997,0.0237 127 | 0.9992,-0.0395 128 | 0.9947,-0.1024 129 | 0.9863,-0.165 130 | 0.9739,-0.2269 131 | 0.9577,-0.2879 132 | 0.9376,-0.3478 133 | 0.9138,-0.4063 134 | 0.8863,-0.4631 135 | 0.8553,-0.5181 136 | 0.8209,-0.5711 137 | 0.7832,-0.6217 138 | 0.7424,-0.6699 139 | 0.6987,-0.7154 140 | 0.6521,-0.7581 141 | 0.603,-0.7977 142 | 0.5515,-0.8342 143 | 0.4977,-0.8673 144 | 0.442,-0.897 145 | 0.3845,-0.9231 146 | 0.3255,-0.9455 147 | 0.2652,-0.9642 148 | 0.2038,-0.979 149 | 0.1416,-0.9899 150 | 0.0789,-0.9969 151 | 0.0158,-0.9999 152 | -0.0473,-0.9989 153 | -0.1103,-0.9939 154 | -0.1728,-0.985 155 | -0.2346,-0.9721 156 | -0.2955,-0.9554 157 | -0.3552,-0.9348 158 | -0.4135,-0.9105 159 | -0.4701,-0.8826 160 | -0.5249,-0.8512 161 | -0.5775,-0.8164 162 | -0.6279,-0.7783 163 | -0.6758,-0.7371 164 | -0.7209,-0.693 165 | -0.7632,-0.6461 166 | -0.8025,-0.5967 167 | -0.8385,-0.5449 168 | -0.8712,-0.4909 169 | -0.9005,-0.4349 170 | -0.9261,-0.3772 171 | -0.9481,-0.318 172 | -0.9663,-0.2575 173 | -0.9806,-0.1961 174 | -0.991,-0.1338 175 | -0.9975,-0.071 176 | -1,-0.0079 177 | -0.9985,0.0552 178 | -0.993,0.1181 179 | -0.9836,0.1806 180 | -0.9702,0.2423 181 | -0.953,0.303 182 | -0.932,0.3625 183 | -0.9072,0.4206 184 | -0.8789,0.477 185 | -0.847,0.5316 186 | -0.8118,0.5839 187 | -0.7733,0.634 188 | -0.7318,0.6815 189 | -0.6873,0.7264 190 | -0.6401,0.7683 191 | -0.5903,0.8072 192 | -0.5382,0.8428 193 | -0.484,0.8751 194 | -0.4278,0.9039 195 | -0.3699,0.9291 196 | -0.3105,0.9506 197 | -0.2499,0.9683 198 | -0.1883,0.9821 199 | -0.126,0.992 200 | -0.0631,0.998 201 | 0,1 202 | -------------------------------------------------------------------------------- /src/pyEDM/data/circle_noise.csv: -------------------------------------------------------------------------------- 1 | Time,x,y 2 | 1,-0.0375,1.0968 3 | 2,0.0647,0.8452 4 | 3,0.289,1.0555 5 | 4,0.1232,0.8745 6 | 5,0.294,0.8512 7 | 6,0.1713,0.8986 8 | 7,0.3124,0.8462 9 | 8,0.4319,0.9397 10 | 9,0.5738,0.8418 11 | 10,0.6857,0.9748 12 | 11,0.6468,0.6051 13 | 12,0.7122,0.6941 14 | 13,0.6392,0.643 15 | 14,0.6799,0.7143 16 | 15,0.8636,0.6958 17 | 16,0.7822,0.5151 18 | 17,0.9024,0.523 19 | 18,0.8706,0.6077 20 | 19,1.1238,0.3357 21 | 20,0.9088,0.3406 22 | 21,0.9365,0.2561 23 | 22,1.0107,0.2619 24 | 23,1.0495,0.0116 25 | 24,1.1021,0.1101 26 | 25,0.8736,0.0323 27 | 26,0.973,-0.1148 28 | 27,0.9664,-0.1336 29 | 28,0.9386,-0.2208 30 | 29,0.9092,-0.2295 31 | 30,0.8594,-0.3808 32 | 31,0.8327,-0.2443 33 | 32,0.9127,-0.357 34 | 33,0.8724,-0.4806 35 | 34,0.8535,-0.4953 36 | 35,0.8549,-0.4628 37 | 36,0.7674,-0.4984 38 | 37,0.7168,-0.5849 39 | 38,0.8297,-0.7174 40 | 39,0.6386,-0.7994 41 | 40,0.7664,-0.7372 42 | 41,0.5577,-0.7098 43 | 42,0.4773,-0.83 44 | 43,0.5936,-1.0376 45 | 44,0.5111,-0.9458 46 | 45,0.5359,-0.9493 47 | 46,0.3639,-0.9289 48 | 47,0.3114,-0.8918 49 | 48,0.3811,-0.8182 50 | 49,0.0709,-1.1227 51 | 50,0.1354,-0.9522 52 | 51,-0.0181,-1.0827 53 | 52,-0.1448,-0.988 54 | 53,0.0383,-1.0369 55 | 54,-0.3315,-0.9735 56 | 55,-0.2279,-0.8602 57 | 56,-0.2647,-1.0732 58 | 57,-0.1676,-0.9251 59 | 58,-0.279,-0.7829 60 | 59,-0.458,-0.7437 61 | 60,-0.7338,-0.8348 62 | 61,-0.4884,-0.9794 63 | 62,-0.7515,-0.692 64 | 63,-0.8885,-0.7225 65 | 64,-0.6685,-0.808 66 | 65,-0.72,-0.7234 67 | 66,-0.7909,-0.5645 68 | 67,-1.0954,-0.5424 69 | 68,-0.9375,-0.542 70 | 69,-0.9585,-0.4097 71 | 70,-0.8346,-0.2558 72 | 71,-0.931,-0.1718 73 | 72,-0.7881,-0.2022 74 | 73,-0.8719,-0.0888 75 | 74,-0.9905,-0.1067 76 | 75,-1.0533,-0.0347 77 | 76,-0.9828,0.0666 78 | 77,-1.0341,0.2283 79 | 78,-0.9962,0.3978 80 | 79,-0.9414,0.1646 81 | 80,-1.0853,0.3357 82 | 81,-0.9607,0.2908 83 | 82,-0.865,0.5232 84 | 83,-0.954,0.4036 85 | 84,-0.7374,0.4437 86 | 85,-1.0151,0.5289 87 | 86,-0.7632,0.528 88 | 87,-0.8404,0.5514 89 | 88,-0.6798,0.5505 90 | 89,-0.5631,0.6615 91 | 90,-0.632,0.7189 92 | 91,-0.6293,0.8097 93 | 92,-0.4548,0.9471 94 | 93,-0.6347,1.0325 95 | 94,-0.4192,0.9904 96 | 95,-0.3747,0.8738 97 | 96,-0.2402,0.8917 98 | 97,-0.1682,0.9183 99 | 98,-0.1877,0.9391 100 | 99,-0.2416,1.1643 101 | 100,-0.0122,1.1891 102 | 101,0.1306,0.9602 103 | 102,0.0246,1.0539 104 | 103,0.1315,1.1033 105 | 104,0.0614,1.0491 106 | 105,0.2861,0.9978 107 | 106,0.37,0.8586 108 | 107,0.3812,0.8076 109 | 108,0.4945,0.8496 110 | 109,0.5357,0.8544 111 | 110,0.661,0.9558 112 | 111,0.7718,0.7827 113 | 112,0.6518,0.7709 114 | 113,0.7019,0.6609 115 | 114,0.6514,0.631 116 | 115,0.6808,0.6025 117 | 116,0.9826,0.6209 118 | 117,0.9673,0.5913 119 | 118,0.9301,0.5197 120 | 119,0.8753,0.157 121 | 120,0.8007,0.3973 122 | 121,0.9256,0.2826 123 | 122,0.9936,0.1428 124 | 123,0.9639,0.0935 125 | 124,1.0488,0.0489 126 | 125,0.9388,0.1204 127 | 126,1.0345,-0.1097 128 | 127,1.0356,-0.0253 129 | 128,0.951,-0.132 130 | 129,0.9173,-0.4671 131 | 130,0.9694,-0.3349 132 | 131,0.8007,-0.4909 133 | 132,1.0289,-0.3779 134 | 133,0.8771,-0.4593 135 | 134,0.7553,-0.2789 136 | 135,0.8426,-0.5773 137 | 136,0.7936,-0.674 138 | 137,0.7067,-0.7234 139 | 138,0.6326,-0.8764 140 | 139,0.6847,-0.6906 141 | 140,0.5037,-0.6354 142 | 141,0.3786,-0.8038 143 | 142,0.4123,-0.9995 144 | 143,0.4515,-0.961 145 | 144,0.3934,-0.9869 146 | 145,0.2582,-1.0034 147 | 146,0.3436,-1.0773 148 | 147,0.2413,-0.8864 149 | 148,0.1925,-1.1033 150 | 149,-0.025,-0.7975 151 | 150,0.1759,-0.9935 152 | 151,-0.113,-0.9978 153 | 152,-0.2245,-0.8318 154 | 153,-0.1516,-0.8069 155 | 154,-0.3276,-1.0484 156 | 155,-0.3302,-0.8569 157 | 156,-0.3593,-1.0379 158 | 157,-0.575,-0.7682 159 | 158,-0.6723,-0.8916 160 | 159,-0.6121,-0.6864 161 | 160,-0.5022,-0.7562 162 | 161,-0.5645,-0.7699 163 | 162,-0.7462,-0.6635 164 | 163,-0.8527,-0.7161 165 | 164,-0.8518,-0.6734 166 | 165,-0.7915,-0.6032 167 | 166,-0.8572,-0.6229 168 | 167,-0.9731,-0.2526 169 | 168,-0.8026,-0.5407 170 | 169,-1.1528,-0.4416 171 | 170,-0.9261,-0.1198 172 | 171,-0.9328,-0.2845 173 | 172,-0.9808,-0.1607 174 | 173,-0.8869,-0.0541 175 | 174,-0.9785,-0.0468 176 | 175,-0.9356,0.0102 177 | 176,-1.0912,-0.0921 178 | 177,-1.1086,0.1423 179 | 178,-1.0305,0.3167 180 | 179,-0.8689,0.117 181 | 180,-0.9775,0.3546 182 | 181,-0.9023,0.3047 183 | 182,-0.8564,0.4318 184 | 183,-0.8892,0.5104 185 | 184,-0.7061,0.5221 186 | 185,-0.8778,0.6154 187 | 186,-0.6592,0.7363 188 | 187,-0.6716,0.797 189 | 188,-0.6632,0.8569 190 | 189,-0.804,0.7403 191 | 190,-0.655,0.779 192 | 191,-0.4274,0.7646 193 | 192,-0.5113,0.8365 194 | 193,-0.4166,0.9062 195 | 194,-0.5166,0.8696 196 | 195,-0.3028,0.9986 197 | 196,-0.3282,0.9871 198 | 197,-0.2661,1.0658 199 | 198,-0.0598,0.9111 200 | 199,-0.0052,1.1798 201 | 200,-0.0274,0.9932 202 | -------------------------------------------------------------------------------- /src/pyEDM/data/columnNameSpace.csv: -------------------------------------------------------------------------------- 1 | Time,Var 1,Var 2,Var3,Var 4 A,Var 5 1 2 | 10.0000,2.4873,1.0490,3.4093,8.6502,-2.4232 3 | 10.0500,3.5108,2.2832,4.0464,7.8964,-2.1931 4 | 10.1000,4.1666,3.7791,4.7456,6.8123,-1.8866 5 | 10.1500,4.4836,5.4255,5.2821,5.3070,-1.6077 6 | 10.2000,4.5246,7.0599,5.3571,3.4137,-1.3198 7 | 10.2500,4.3996,8.4636,4.6880,1.4224,-0.9423 8 | 10.3000,4.2834,9.4393,3.1935,-0.1486,-0.5056 9 | 10.3500,4.3073,9.8903,1.1267,-0.8165,-0.1553 10 | 10.4000,4.4727,9.8108,-0.9880,-0.4087,0.0987 11 | 10.4500,4.7750,9.2343,-2.6227,0.8390,0.5478 12 | 10.5000,5.2694,8.1564,-3.5549,2.3684,1.5622 13 | 10.5500,5.8840,6.4730,-3.9150,3.5582,3.2580 14 | 10.6000,6.2747,4.0804,-3.9256,3.9698,5.3755 15 | 10.6500,5.9798,1.1828,-3.6515,3.4702,7.3548 16 | 10.7000,4.8229,-1.5331,-3.0541,2.3313,8.6562 17 | 10.7500,3.1194,-3.3321,-2.2364,1.1273,9.1889 18 | 10.8000,1.3612,-3.9845,-1.4564,0.3045,9.2723 19 | 10.8500,-0.1160,-3.7001,-0.8990,-0.0616,9.2205 20 | 10.9000,-1.1470,-2.8043,-0.5533,-0.1029,9.1611 21 | 10.9500,-1.6706,-1.6010,-0.2858,0.0596,9.1057 22 | 11.0000,-1.7193,-0.3557,0.0287,0.3794,9.0351 23 | 11.0500,-1.4171,0.7312,0.4408,0.8467,8.9310 24 | 11.1000,-0.9447,1.5593,0.9428,1.4513,8.7813 25 | 11.1500,-0.4833,2.1310,1.5163,2.1765,8.5727 26 | 11.2000,-0.1712,2.5180,2.1634,3.0042,8.2731 27 | 11.2500,-0.0800,2.8143,2.9131,3.9106,7.8129 28 | 11.3000,-0.2043,3.0919,3.8121,4.8445,7.0745 29 | 11.3500,-0.4558,3.3637,4.9019,5.6909,5.9108 30 | 11.4000,-0.6691,3.5753,6.1693,6.2319,4.2228 31 | 11.4500,-0.6551,3.6687,7.4890,6.1556,2.1102 32 | 11.5000,-0.3438,3.7049,8.6398,5.1820,-0.0129 33 | 11.5500,0.0721,3.8562,9.4183,3.2690,-1.5430 34 | 11.6000,0.2719,4.1705,9.7019,0.7431,-2.0048 35 | 11.6500,0.2453,4.5032,9.4438,-1.7504,-1.2694 36 | 11.7000,0.4567,4.8154,8.6786,-3.5679,0.3507 37 | 11.7500,1.4043,5.2452,7.4276,-4.4855,2.1613 38 | 11.8000,3.1508,5.7590,5.6035,-4.7268,3.4247 39 | 11.8500,5.2766,6.0012,3.1470,-4.5951,3.6950 40 | 11.9000,7.1091,5.5794,0.3417,-4.1856,2.9408 41 | 11.9500,8.1517,4.4745,-2.1384,-3.4571,1.5714 42 | 12.0000,8.4443,3.0595,-3.7288,-2.4716,0.2430 43 | 12.0500,8.3848,1.6978,-4.3566,-1.4446,-0.5674 44 | 12.1000,8.2949,0.5253,-4.2545,-0.6003,-0.7672 45 | 12.1500,8.2687,-0.4507,-3.6663,-0.0443,-0.5179 46 | 12.2000,8.2672,-1.2258,-2.7571,0.2623,-0.0327 47 | 12.2500,8.2292,-1.7673,-1.6480,0.4537,0.5427 48 | 12.3000,8.1135,-2.0491,-0.4604,0.6836,1.1576 49 | 12.3500,7.8931,-2.0921,0.6805,1.0652,1.8202 50 | 12.4000,7.5370,-1.9712,1.6733,1.6522,2.5461 51 | 12.4500,6.9967,-1.7855,2.4634,2.4543,3.3242 52 | 12.5000,6.2014,-1.6136,3.0387,3.4580,4.0994 53 | 12.5500,5.0760,-1.4770,3.4044,4.6271,4.7596 54 | 12.6000,3.5989,-1.3272,3.5685,5.8826,5.1285 55 | 12.6500,1.8906,-1.0787,3.5654,7.0895,4.9966 56 | 12.7000,0.2564,-0.6981,3.4985,8.0907,4.2129 57 | 12.7500,-0.9107,-0.2798,3.5126,8.7724,2.7926 58 | 12.8000,-1.3123,0.0230,3.6762,9.0833,0.9622 59 | 12.8500,-0.8653,0.2023,3.9451,9.0087,-0.8906 60 | 12.9000,0.2582,0.4946,4.2866,8.5548,-2.3714 61 | 12.9500,1.6621,1.2152,4.7464,7.7137,-3.2800 62 | 13.0000,2.8722,2.5121,5.3179,6.4143,-3.6765 63 | 13.0500,3.5139,4.2590,5.8040,4.5557,-3.7360 64 | 13.1000,3.4142,6.0832,5.8602,2.1825,-3.5519 65 | 13.1500,2.6736,7.5249,5.2268,-0.3191,-3.0988 66 | 13.2000,1.6784,8.3393,3.9664,-2.3406,-2.3916 67 | 13.2500,0.8730,8.6445,2.4020,-3.4743,-1.6045 68 | 13.3000,0.4617,8.7053,0.8579,-3.7001,-0.9625 69 | 13.3500,0.3872,8.6893,-0.4510,-3.2108,-0.5622 70 | 13.4000,0.5144,8.6439,-1.3878,-2.2395,-0.3279 71 | 13.4500,0.7685,8.5669,-1.8826,-1.0196,-0.1021 72 | 13.5000,1.1444,8.4458,-1.9544,0.2243,0.2407 73 | 13.5500,1.6540,8.2653,-1.7130,1.3160,0.7457 74 | 13.6000,2.2915,8.0039,-1.3185,2.1680,1.4006 75 | 13.6500,3.0306,7.6268,-0.9254,2.7828,2.1824 76 | 13.7000,3.8270,7.0748,-0.6388,3.2168,3.0843 77 | 13.7500,4.6051,6.2629,-0.4903,3.5348,4.1136 78 | 13.8000,5.2323,5.1053,-0.4307,3.7759,5.2679 79 | 13.8500,5.5015,3.5885,-0.3466,3.9535,6.4968 80 | 13.9000,5.1640,1.8718,-0.1244,4.1004,7.6775 81 | 13.9500,4.0419,0.3219,0.2392,4.3123,8.6365 82 | 14.0000,2.1766,-0.6144,0.5950,4.6856,9.1986 83 | 14.0500,-0.0862,-0.6322,0.8223,5.1964,9.2140 84 | 14.1000,-2.1936,0.2438,1.0998,5.7541,8.5816 85 | 14.1500,-3.6997,1.5712,1.8471,6.3451,7.2397 86 | 14.2000,-4.4966,2.6264,3.2892,6.9081,5.1089 87 | 14.2500,-4.6571,2.7715,5.1113,7.1247,2.2047 88 | 14.3000,-4.1610,1.8723,6.5860,6.6282,-1.0241 89 | 14.3500,-2.9785,0.5213,7.2304,5.4477,-3.7272 90 | 14.4000,-1.3859,-0.3750,7.2799,3.9256,-5.3338 91 | 14.4500,0.0508,-0.3573,7.2344,2.2696,-5.8842 92 | 14.5000,0.8421,0.3782,7.2629,0.4986,-5.6675 93 | 14.5500,0.8699,1.3096,7.2362,-1.3184,-4.8707 94 | 14.6000,0.4312,2.0095,7.0367,-2.9361,-3.5570 95 | 14.6500,0.0453,2.4035,6.6736,-4.0598,-1.8403 96 | 14.7000,0.1333,2.6900,6.1907,-4.5597,0.0002 97 | 14.7500,0.8256,3.0496,5.5779,-4.5304,1.6105 98 | 14.8000,2.0047,3.4827,4.7767,-4.1853,2.7363 99 | 14.8500,3.4387,3.8536,3.7343,-3.7203,3.2977 100 | 14.9000,4.8791,3.9968,2.4676,-3.2374,3.3521 101 | 14.9500,6.1180,3.7996,1.1058,-2.7505,3.0370 -------------------------------------------------------------------------------- /src/pyEDM/data/sardine_anchovy_sst.csv: -------------------------------------------------------------------------------- 1 | year,anchovy,sardine,sio_sst,np_sst 2 | 1929,-0.00759874,1.77009,-0.352393,-0.347846 3 | 1930,-0.00960162,-1.15152,0.00114945,0.328734 4 | 1931,-0.00844418,-1.42068,1.06822,1.61027 5 | 1932,-0.0083536,0.112222,0.531857,1.26534 6 | 1933,-0.00774971,1.51555,-0.552058,0.0400459 7 | 1934,-0.00953117,2.98987,-1.1433,-0.691345 8 | 1935,-0.00996395,-0.526375,-0.899012,-0.586502 9 | 1936,-0.00780004,0.977476,0.287626,0.665017 10 | 1937,-0.00745783,-0.451011,-0.00236032,0.421038 11 | 1938,0.00347246,0.362572,-0.0221091,0.551965 12 | 1939,0.0241555,1.72261,-0.2779,0.441628 13 | 1940,0.0872412,-1.88412,-0.0873968,0.777714 14 | 1941,-0.0587879,2.70938,0.506725,1.63382 15 | 1942,-0.0633271,-2.169,0.396365,1.59282 16 | 1943,-0.0109906,0.0495487,0.179806,1.38009 17 | 1944,0.044919,1.34507,-0.528392,0.331645 18 | 1945,-0.060197,-2.23971,-0.769858,-0.0138251 19 | 1946,-0.00119757,-2.48136,-0.866112,-0.117138 20 | 1947,0.381222,-1.88732,-0.625578,0.35607 21 | 1948,-0.193595,0.831004,-0.951725,-0.0844464 22 | 1949,-0.180078,2.06942,-1.13892,-0.525395 23 | 1950,0.0274466,0.640328,-1.43184,-1.14218 24 | 1951,0.0393331,-2.86702,-1.09406,-1.04257 25 | 1952,1.10901,-2.33408,-1.24445,-1.48325 26 | 1953,0.67943,-0.00517327,-1.32792,-1.70846 27 | 1954,-1.00173,0.967301,-1.19216,-2.21847 28 | 1955,0.0440333,0.117133,-1.06348,-2.19432 29 | 1956,0.271627,-0.540868,-0.992674,-2.07212 30 | 1957,-0.382782,-0.147428,-0.685711,-1.10831 31 | 1958,-0.670421,1.24474,0.121972,0.268469 32 | 1959,-0.109504,-0.969354,1.3294,1.61014 33 | 1960,-0.0565636,-0.0958967,0.878909,1.44651 34 | 1961,0.052538,-0.0773374,0.0902889,0.477878 35 | 1962,-0.12137,-0.17878,-1.20107,-0.701946 36 | 1963,0.0331634,-0.0308182,-0.99483,-0.407587 37 | 1964,0.00109718,0.075727,-1.05289,-0.383447 38 | 1965,0.00917916,-0.0536651,-0.880291,-0.0187285 39 | 1966,1.28563,0.0227362,-0.849092,-0.0329409 40 | 1967,0.159526,0.0251115,-0.545753,0.337691 41 | 1968,-0.889802,0.0304055,-0.298203,0.304107 42 | 1969,2.37595,0.0304559,-0.515937,0.051485 43 | 1970,1.30074,0.033123,-0.695732,-0.294818 44 | 1971,-2.35977,0.0295098,-1.14774,-0.772071 45 | 1972,1.10143,0.0311503,-1.0074,-0.708921 46 | 1973,2.89919,0.0289361,-1.11969,-0.712736 47 | 1974,-2.29245,0.0295601,-0.945348,-0.637847 48 | 1975,3.46014,0.0305263,-1.76611,-1.38128 49 | 1976,-1.5453,0.0306773,-1.27539,-0.838455 50 | 1977,-0.623298,0.0305062,-0.807816,-0.305491 51 | 1978,-4.53241,0.0305766,0.335739,0.907717 52 | 1979,1.88048,0.0307377,0.083236,0.29779 53 | 1980,-0.307508,0.030788,-0.303445,-0.102225 54 | 1981,0.454131,0.0304861,-0.183788,-0.296162 55 | 1982,-0.510584,0.0303754,-0.011892,-0.043215 56 | 1983,-1.91097,0.0305766,0.805306,1.01859 57 | 1984,-0.0857413,0.0306068,1.2229,1.67348 58 | 1985,-0.071862,0.0306672,1.27494,1.67402 59 | 1986,-0.0127418,0.0369376,1.12799,1.20355 60 | 1987,-0.0155096,0.0314422,0.675791,0.713725 61 | 1988,-0.00372382,0.0429965,0.542603,0.77306 62 | 1989,0.0408327,0.0247693,0.220706,0.73088 63 | 1990,0.0301138,0.0443049,0.424563,0.718023 64 | 1991,0.0324589,0.128718,0.404044,0.501144 65 | 1992,-0.15393,0.20211,1.04246,0.897233 66 | 1993,0.0338881,-0.0124098,1.26228,1.28284 67 | 1994,-0.0168885,-0.0307276,1.89996,1.96306 68 | 1995,-0.00304948,0.503347,1.62217,0.791977 69 | 1996,0.119509,-0.095776,1.44455,-0.307302 70 | 1997,0.0573892,0.208441,2.16463,-0.0387739 71 | 1998,-0.223024,0.0285335,2.39785,0.444062 72 | 1999,0.179937,0.295893,1.5104,-0.230065 73 | 2000,0.323007,-0.060791,0.593168,-1.33349 74 | 2001,0.367091,-9.05826e-05,0.113693,-2.19937 75 | 2002,-0.741992,0.138018,0.658063,-1.18642 76 | 2003,-0.157825,-0.360649,0.634573,-1.34262 77 | 2004,0.249897,0.189861,1.2198,-0.530206 78 | 2005,0.213121,-0.130771,1.74945,-0.757965 79 | 2006,0.0730902,0.229798,2.02861,-0.583363 80 | -------------------------------------------------------------------------------- /src/pyEDM/tests/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | -------------------------------------------------------------------------------- /src/pyEDM/tests/examples.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import pyEDM as EDM 4 | 5 | #------------------------------------------------------------ 6 | #------------------------------------------------------------ 7 | def main(): 8 | '''pyEDM examples.''' 9 | 10 | df = EDM.EmbedDimension( dataFrame = EDM.sampleData["TentMap"], 11 | columns = "TentMap", target = "TentMap", 12 | lib = [1, 100], pred = [201, 500], maxE = 10, 13 | Tp = 1, tau = -1, exclusionRadius = 0, 14 | validLib = [], numProcess = 4 ) 15 | 16 | df = EDM.PredictInterval( dataFrame = EDM.sampleData["TentMap"], 17 | columns = "TentMap", target = "TentMap", 18 | lib = [1, 100], pred = [201, 500], maxTp = 10, 19 | E = 2, tau = -1, exclusionRadius = 0, 20 | validLib = [], numProcess = 4 ); 21 | 22 | df = EDM.PredictNonlinear( dataFrame = EDM.sampleData[ "TentMapNoise" ], 23 | columns = "TentMap", target = "TentMap", 24 | lib = [1, 100], pred = [201, 500], E = 2, 25 | Tp = 1, knn = 0, tau = -1, 26 | validLib = [], numProcess = 4 ) 27 | 28 | # Tent map simplex : specify multivariable columns embedded = True 29 | S = EDM.Simplex( dataFrame = EDM.sampleData[ "block_3sp" ], 30 | columns = "x_t y_t z_t", target = "x_t", 31 | lib = [1, 99], pred = [100, 198], E = 3, Tp = 1, 32 | knn = 0, tau = -1, exclusionRadius = 0, 33 | embedded = True, showPlot = True, validLib = [] ) 34 | 35 | # Tent map simplex : Embed column x_t to E=3, embedded = False 36 | S = EDM.Simplex( dataFrame = EDM.sampleData[ "block_3sp" ], 37 | columns = "x_t", target = "x_t", 38 | lib = [1, 99], pred = [100, 198], E = 3, Tp = 1, 39 | knn = 0, tau = -1, exclusionRadius = 0, 40 | embedded = False, showPlot = True, validLib = [] ) 41 | 42 | M = EDM.Multiview( dataFrame = EDM.sampleData[ "block_3sp" ], 43 | columns = ["x_t", "y_t", "z_t"], target = "x_t", 44 | lib = [1, 100], pred = [101, 198], 45 | D = 0, E = 3, Tp = 1, knn = 0, tau = -1, 46 | multiview = 0, exclusionRadius = 0, 47 | trainLib = False, excludeTarget = False, 48 | numProcess = 4, showPlot = True ) 49 | 50 | # S-map circle : specify multivariable columns embedded = True 51 | S = EDM.SMap( dataFrame = EDM.sampleData[ "circle" ], 52 | columns = ["x", "y"], target = "x", 53 | lib = [1, 100], pred = [101, 198], 54 | E = 2, Tp = 1, knn = 0, tau = -1, 55 | theta = 4, exclusionRadius = 0, 56 | solver = None, embedded = True, validLib = [] ) 57 | 58 | CM = EDM.CCM( dataFrame = EDM.sampleData[ "sardine_anchovy_sst" ], 59 | columns = "anchovy", target = "np_sst", 60 | E = 3, Tp = 0, knn = 0, tau = -1, exclusionRadius = 0, 61 | libSizes = [10, 70, 10], sample = 100, 62 | seed = 0, verbose = False, showPlot = True ) 63 | 64 | #------------------------------------------------------------ 65 | #------------------------------------------------------------ 66 | if __name__ == '__main__': 67 | main() 68 | -------------------------------------------------------------------------------- /src/pyEDM/tests/smapSolverTest.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | from sklearn.linear_model import LinearRegression, Ridge, Lasso, ElasticNet 4 | from sklearn.linear_model import SGDRegressor, Lars, LassoLars 5 | from sklearn.linear_model import RidgeCV, LassoCV, ElasticNetCV 6 | 7 | import pyEDM as EDM 8 | 9 | #------------------------------------------------------------ 10 | #------------------------------------------------------------ 11 | def main(): 12 | '''Test sklearn.linear_model solvers''' 13 | 14 | circle = EDM.sampleData['circle'] 15 | 16 | lmSolvers = { 17 | 'SVD' : None, 18 | 'LinearRegression' : LinearRegression(), 19 | 'SGDRegressor' : SGDRegressor( alpha = 0.005 ), 20 | 'Ridge' : Ridge( alpha = 0.05 ), 21 | 'Lasso' : Lasso( alpha = 0.005 ), 22 | 'Lars' : Lars(), 23 | 'LassoLars' : LassoLars( alpha = 0.005 ), 24 | 'ElasticNet' : ElasticNet( alpha = 0.001, l1_ratio = 0.001 ), 25 | 'RidgeCV' : RidgeCV(), 26 | 'LassoCV' : LassoCV( cv = 5 ), 27 | 'ElasticNetCV' : ElasticNetCV(l1_ratio = [.05,0.2,.5,.9,1], cv = 5) 28 | } 29 | 30 | smapResults = {} 31 | 32 | for solverName in lmSolvers.keys() : 33 | print( solverName ) 34 | result = EDM.SMap( dataFrame = circle, columns = "x y", target = "x", 35 | lib = [1, 100], pred = [101, 198], 36 | embedded = True, E = 2, theta = 3.14, 37 | solver = lmSolvers[ solverName ], showPlot = True ) 38 | smapResults[ solverName ] = result 39 | 40 | #------------------------------------------------------------ 41 | #------------------------------------------------------------ 42 | if __name__ == '__main__': 43 | main() 44 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/CCM_Lorenz5D_MV_Space_valid.csv: -------------------------------------------------------------------------------- 1 | LibSize,Var 1:Var 2,Var 2:Var 1 2 | 20,0.84044,0.6186 3 | 50,0.94841,0.85879 4 | 90,0.97777,0.9335 5 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/CCM_Lorenz5D_MV_valid.csv: -------------------------------------------------------------------------------- 1 | LibSize,V3:V1,V1:V3 2 | 20,0.809932,0.688898 3 | 200,0.925599,0.902587 4 | 500,0.950089,0.941246 5 | 950,0.966031,0.956352 6 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/CCM_anch_sst_valid.csv: -------------------------------------------------------------------------------- 1 | LibSize,anchovy:np_sst,np_sst:anchovy 2 | 10,0.098804,-0.040094 3 | 20,0.139367,-0.05509 4 | 30,0.156736,-0.041033 5 | 40,0.187037,-0.057155 6 | 50,0.197761,-0.036879 7 | 60,0.207197,-0.070234 8 | 70,0.212679,-0.062409 9 | 75,0.212084,-0.058386 10 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/CCM_nan_valid.csv: -------------------------------------------------------------------------------- 1 | LibSize,x:y,y:x 2 | 10,0.200164,0.153248 3 | 20,0.262148,0.257981 4 | 30,0.347673,0.297502 5 | 40,0.430703,0.364082 6 | 50,0.475335,0.455843 7 | 60,0.544126,0.512746 8 | 70,0.616292,0.558568 9 | 80,0.644944,0.626748 10 | 90,0.692886,0.720044 11 | 100,0.753128,0.774864 12 | 110,0.801299,0.815377 13 | 120,0.838953,0.866247 14 | 130,0.886724,0.88144 15 | 140,0.911475,0.925402 16 | 150,0.930632,0.942109 17 | 160,0.946946,0.96399 18 | 170,0.966898,0.974602 19 | 180,0.979926,0.983914 20 | 190,0.98598,0.99303 21 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/EmbedDim_valid.csv: -------------------------------------------------------------------------------- 1 | E,rho 2 | 1,0.443663 3 | 2,0.83914 4 | 3,0.92997 5 | 4,0.958567 6 | 5,0.958582 7 | 6,0.948973 8 | 7,0.940099 9 | 8,0.943473 10 | 9,0.942536 11 | 10,0.93859 12 | 11,0.933548 13 | 12,0.931267 14 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/Multiview_combos_valid.csv: -------------------------------------------------------------------------------- 1 | Columns,rho,MAE,RMSE 2 | "('x_t(t-0)', 'x_t(t-1)', 'x_t(t-2)')",0.93411,0.692234,0.289511 3 | "('x_t(t-0)', 'z_t(t-0)', 'x_t(t-1)')",0.926895,0.641525,0.305985 4 | "('x_t(t-0)', 'x_t(t-1)', 'z_t(t-1)')",0.904013,0.698145,0.346842 5 | "('x_t(t-0)', 'x_t(t-1)', 'y_t(t-1)')",0.900053,1.067862,0.35787 6 | "('x_t(t-0)', 'z_t(t-0)', 'z_t(t-2)')",0.897006,0.886854,0.357714 7 | "('x_t(t-0)', 'x_t(t-1)', 'z_t(t-2)')",0.88934,0.645831,0.369976 8 | "('x_t(t-0)', 'y_t(t-1)', 'x_t(t-2)')",0.889027,0.954226,0.371859 9 | "('x_t(t-0)', 'z_t(t-1)', 'x_t(t-2)')",0.888154,1.034906,0.378713 10 | "('x_t(t-0)', 'z_t(t-0)', 'y_t(t-2)')",0.884414,1.039255,0.379156 11 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/Multiview_pred_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions 2 | 101,0.439401, 3 | 102,-0.119384,0.225291 4 | 103,1.455259,0.927032 5 | 104,-1.452182,-1.271598 6 | 105,-0.2129,0.038349 7 | 106,1.14032,0.892435 8 | 107,-1.152276,-1.487097 9 | 108,0.585776,0.412378 10 | 109,0.022673,0.10992 11 | 110,0.877471,0.877063 12 | 111,-0.519152,-0.854973 13 | 112,1.139551,1.277633 14 | 113,-1.461834,-1.324674 15 | 114,0.34191,0.323376 16 | 115,0.791469,0.433462 17 | 116,-0.769432,-0.455399 18 | 117,0.811908,0.955992 19 | 118,-0.712428,-0.754844 20 | 119,1.4832,1.005436 21 | 120,-1.362758,-1.284099 22 | 121,0.240616,0.278155 23 | 122,0.768334,0.534228 24 | 123,-0.532668,-0.309715 25 | 124,1.417437,1.066813 26 | 125,-1.263871,-1.370564 27 | 126,0.516907,0.557102 28 | 127,0.476685,0.225501 29 | 128,0.168093,0.244101 30 | 129,0.515825,0.673303 31 | 130,0.10683,-0.16076 32 | 131,0.939276,0.777015 33 | 132,-0.969807,-0.611189 34 | 133,0.816908,0.883452 35 | 134,-0.870545,-0.572171 36 | 135,1.342763,0.89083 37 | 136,-1.39021,-1.022017 38 | 137,0.028155,0.326952 39 | 138,1.273938,0.887574 40 | 139,-0.949077,-1.161655 41 | 140,1.098185,0.819272 42 | 141,-0.474253,-0.323236 43 | 142,1.296011,1.056029 44 | 143,-1.317141,-1.225848 45 | 144,0.5317,0.478692 46 | 145,0.497327,0.32997 47 | 146,0.101539,0.149805 48 | 147,1.004527,0.792035 49 | 148,-0.71312,-0.939104 50 | 149,1.18961,1.106057 51 | 150,-1.330637,-1.136128 52 | 151,0.537157,0.431573 53 | 152,0.357393,0.207488 54 | 153,0.172334,0.355164 55 | 154,0.400227,0.600082 56 | 155,0.469071,0.235136 57 | 156,0.473999,0.241674 58 | 157,0.486857,0.156283 59 | 158,-0.352559,0.253934 60 | 159,0.74429,0.994485 61 | 160,-1.130676,-0.815316 62 | 161,0.44383,0.721101 63 | 162,0.532299,0.21112 64 | 163,0.700969,0.15339 65 | 164,-0.361181,-0.156441 66 | 165,1.3866,1.171543 67 | 166,-1.191276,-1.337219 68 | 167,0.357612,0.58638 69 | 168,0.259412,0.297401 70 | 169,0.376768,0.283541 71 | 170,0.254832,0.313507 72 | 171,0.186317,0.504831 73 | 172,0.894118,0.548153 74 | 173,-0.026881,-0.342529 75 | 174,1.163051,0.814704 76 | 175,-1.274744,-0.979708 77 | 176,0.17991,0.498621 78 | 177,0.474507,0.446484 79 | 178,-0.133309,0.056447 80 | 179,1.000607,0.904133 81 | 180,-0.744674,-0.938237 82 | 181,0.993397,1.067398 83 | 182,-1.322475,-0.478761 84 | 183,0.535779,0.558172 85 | 184,0.490292,0.123181 86 | 185,0.518592,0.114295 87 | 186,0.56421,0.145837 88 | 187,0.148809,0.163742 89 | 188,0.626932,0.653891 90 | 189,0.111045,-0.169387 91 | 190,0.896599,0.798425 92 | 191,-0.759573,-0.876567 93 | 192,0.784424,1.129326 94 | 193,-1.277411,-0.609369 95 | 194,0.558733,0.476991 96 | 195,0.633977,0.201524 97 | 196,0.020644,-0.006408 98 | 197,0.548923,0.911676 99 | 198,0.040304,-0.195443 100 | 199,,0.863096 101 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/PredictInterval_valid.csv: -------------------------------------------------------------------------------- 1 | Tp,rho 2 | 1,0.896937 3 | 2,0.773489 4 | 3,0.424721 5 | 4,0.159457 6 | 5,0.128462 7 | 6,0.113561 8 | 7,0.080873 9 | 8,-0.059586 10 | 9,-0.078689 11 | 10,0.16565 12 | 11,0.289692 13 | 12,0.015064 14 | 13,-0.090439 15 | 14,-0.035344 16 | 15,-0.065192 17 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/PredictNonlinear_valid.csv: -------------------------------------------------------------------------------- 1 | theta,rho 2 | 0.01,0.769971 3 | 0.1,0.773355 4 | 0.3,0.780578 5 | 0.5,0.787476 6 | 0.75,0.79573 7 | 1.0,0.803598 8 | 1.5,0.817884 9 | 2.0,0.829619 10 | 3.0,0.844902 11 | 4.0,0.851079 12 | 5.0,0.851446 13 | 6.0,0.848859 14 | 7.0,0.84472 15 | 8.0,0.839694 16 | 9.0,0.834131 17 | 10.0,0.828232 18 | 15.0,0.796299 19 | 20.0,0.765249 20 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/SMap_circle_E2_embd_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions,Pred_Variance 2 | 1,0.0,, 3 | 2,0.0631,0.063108,0.241006 4 | 3,0.126,0.12595,0.240427 5 | 4,0.1883,0.188353,0.239472 6 | 5,0.2499,0.249901,0.238161 7 | 6,0.3105,0.310508,0.236514 8 | 7,0.3699,0.369865,0.23455 9 | 8,0.4278,0.427792,0.232306 10 | 9,0.484,0.483985,0.229816 11 | 10,0.5382,0.538262,0.227122 12 | 11,0.5903,0.590313,0.224262 13 | 12,0.6401,0.640059,0.221293 14 | 13,0.6873,0.68731,0.218248 15 | 14,0.7318,0.731769,0.215186 16 | 15,0.7733,0.773353,0.212136 17 | 16,0.8118,0.811766,0.20917 18 | 17,0.847,0.847033,0.206329 19 | 18,0.8789,0.878857,0.203667 20 | 19,0.9072,0.907255,0.201204 21 | 20,0.932,0.93193,0.198976 22 | 21,0.953,0.953021,0.197073 23 | 22,0.9702,0.970225,0.195461 24 | 23,0.9836,0.983554,0.194189 25 | 24,0.993,0.993038,0.193304 26 | 25,0.9985,0.99847,0.192752 27 | 26,1.0,0.999992,0.192619 28 | 27,0.9975,0.997509,0.192864 29 | 28,0.991,0.991035,0.193485 30 | 29,0.9806,0.980581,0.194469 31 | 30,0.9663,0.96627,0.195834 32 | 31,0.9481,0.948126,0.197526 33 | 32,0.9261,0.926144,0.199525 34 | 33,0.9005,0.900444,0.201785 35 | 34,0.8712,0.871262,0.204321 36 | 35,0.8385,0.838482,0.207028 37 | 36,0.8025,0.802437,0.209904 38 | 37,0.7632,0.763249,0.212896 39 | 38,0.7209,0.720909,0.215929 40 | 39,0.6758,0.675728,0.218997 41 | 40,0.6279,0.627943,0.222038 42 | 41,0.5775,0.577539,0.224988 43 | 42,0.5249,0.524826,0.22781 44 | 43,0.4701,0.470143,0.230459 45 | 44,0.4135,0.413464,0.232888 46 | 45,0.3552,0.35522,0.235067 47 | 46,0.2955,0.295501,0.236957 48 | 47,0.2346,0.23462,0.238529 49 | 48,0.1728,0.172784,0.239753 50 | 49,0.1103,0.110294,0.240613 51 | 50,0.0473,0.047361,0.241096 52 | 51,-0.0158,-0.015836,0.241194 53 | 52,-0.0789,-0.078868,0.240903 54 | 53,-0.1416,-0.14166,0.240231 55 | 54,-0.2038,-0.203787,0.239185 56 | 55,-0.2652,-0.265174,0.237785 57 | 56,-0.3255,-0.32552,0.236053 58 | 57,-0.3845,-0.384519,0.234012 59 | 58,-0.442,-0.441985,0.231703 60 | 59,-0.4977,-0.497726,0.229156 61 | 60,-0.5515,-0.551433,0.22641 62 | 61,-0.603,-0.603044,0.223526 63 | 62,-0.6521,-0.652139,0.220521 64 | 63,-0.6987,-0.698634,0.217468 65 | 64,-0.7424,-0.742455,0.214405 66 | 65,-0.7832,-0.783194,0.211375 67 | 66,-0.8209,-0.82087,0.208435 68 | 67,-0.8553,-0.855305,0.205654 69 | 68,-0.8863,-0.886293,0.203021 70 | 69,-0.9138,-0.913757,0.200624 71 | 70,-0.9376,-0.937622,0.198507 72 | 71,-0.9577,-0.957679,0.196647 73 | 72,-0.9739,-0.973963,0.195124 74 | 73,-0.9863,-0.986274,0.193917 75 | 74,-0.9947,-0.994749,0.193118 76 | 75,-0.9992,-0.999178,0.19266 77 | 76,-0.9997,-0.999702,0.192624 78 | 77,-0.9962,-0.996213,0.192963 79 | 78,-0.9888,-0.98874,0.193674 80 | 79,-0.9774,-0.977402,0.19479 81 | 80,-0.9621,-0.962104,0.19623 82 | 81,-0.9429,-0.942972,0.198005 83 | 82,-0.9201,-0.920005,0.200038 84 | 83,-0.8935,-0.893543,0.202423 85 | 84,-0.8634,-0.863375,0.204983 86 | 85,-0.8298,-0.829838,0.207753 87 | 86,-0.793,-0.792927,0.210632 88 | 87,-0.7529,-0.752973,0.213665 89 | 88,-0.7099,-0.709865,0.216705 90 | 89,-0.664,-0.664041,0.219775 91 | 90,-0.6155,-0.615491,0.222786 92 | 91,-0.5646,-0.564535,0.225707 93 | 92,-0.5113,-0.511396,0.228495 94 | 93,-0.4561,-0.456046,0.231089 95 | 94,-0.399,-0.399038,0.233457 96 | 95,-0.3404,-0.34034,0.235564 97 | 96,-0.2804,-0.280382,0.237377 98 | 97,-0.2192,-0.219271,0.238862 99 | 98,-0.1572,-0.157191,0.239996 100 | 99,-0.0946,-0.094561,0.240761 101 | 100,-0.0316,-0.031588,0.241149 102 | 101,0.0316,0.031534,0.24115 103 | 102,0.0946,0.094613,0.240764 104 | 103,0.1572,0.157235,0.239996 105 | 104,0.2192,0.21921,0.238861 106 | 105,0.2804,0.28033,0.237378 107 | 106,0.3404,0.340417,0.235567 108 | 107,0.399,0.399063,0.233461 109 | 108,0.4561,0.456062,0.231083 110 | 109,0.5113,0.51135,0.228487 111 | 110,0.5646,0.564505,0.225708 112 | 111,0.6155,0.615566,0.222792 113 | 112,0.664,0.664008,0.219769 114 | 113,0.7099,0.709859,0.216708 115 | 114,0.7529,0.752934,0.213655 116 | 115,0.793,0.792925,0.210638 117 | 116,0.8298,0.829876,0.207755 118 | 117,0.8634,0.863357,0.204963 119 | 118,0.8935,0.893525,0.202423 120 | 119,0.9201,0.920058,0.200072 121 | 120,0.9429,0.942999,0.198015 122 | 121,0.9621,0.962024,0.196194 123 | 122,0.9774,0.977399,0.194791 124 | 123,0.9888,0.988798,0.1937 125 | 124,0.9962,0.996261,0.192984 126 | 125,0.9997,0.999684,0.192618 127 | 126,0.9992,0.999203,0.192672 128 | 127,0.9947,0.994717,0.193107 129 | 128,0.9863,0.986253,0.193907 130 | 129,0.9739,0.973926,0.19511 131 | 130,0.9577,0.957636,0.196623 132 | 131,0.9376,0.937624,0.198497 133 | 132,0.9138,0.913779,0.200637 134 | 133,0.8863,0.886339,0.203048 135 | 134,0.8553,0.855307,0.205648 136 | 135,0.8209,0.820899,0.208445 137 | 136,0.7832,0.783226,0.211391 138 | 137,0.7424,0.742407,0.214398 139 | 138,0.6987,0.698644,0.217464 140 | 139,0.6521,0.652169,0.220525 141 | 140,0.603,0.602959,0.223523 142 | 141,0.5515,0.551458,0.226412 143 | 142,0.4977,0.497765,0.229158 144 | 143,0.442,0.441976,0.231699 145 | 144,0.3845,0.384515,0.234012 146 | 145,0.3255,0.325479,0.23605 147 | 146,0.2652,0.265182,0.237782 148 | 147,0.2038,0.203825,0.239184 149 | 148,0.1416,0.141612,0.240229 150 | 149,0.0789,0.078842,0.240902 151 | 150,0.0158,0.015832,0.241194 152 | 151,-0.0473,-0.047336,0.241096 153 | 152,-0.1103,-0.11024,0.240615 154 | 153,-0.1728,-0.172803,0.239753 155 | 154,-0.2346,-0.234618,0.23853 156 | 155,-0.2955,-0.295477,0.23696 157 | 156,-0.3552,-0.355203,0.235073 158 | 157,-0.4135,-0.413481,0.232891 159 | 158,-0.4701,-0.470135,0.230457 160 | 159,-0.5249,-0.524856,0.227806 161 | 160,-0.5775,-0.577573,0.224991 162 | 161,-0.6279,-0.627863,0.222037 163 | 162,-0.6758,-0.675759,0.219003 164 | 163,-0.7209,-0.720971,0.21594 165 | 164,-0.7632,-0.763193,0.21288 166 | 165,-0.8025,-0.802448,0.209889 167 | 166,-0.8385,-0.838561,0.207037 168 | 167,-0.8712,-0.871218,0.204315 169 | 168,-0.9005,-0.900441,0.201793 170 | 169,-0.9261,-0.926157,0.19953 171 | 170,-0.9481,-0.948056,0.197509 172 | 171,-0.9663,-0.966276,0.195832 173 | 172,-0.9806,-0.980624,0.19448 174 | 173,-0.991,-0.991021,0.19348 175 | 174,-0.9975,-0.997465,0.192844 176 | 175,-1.0,-0.999992,0.192617 177 | 176,-0.9985,-0.998506,0.192767 178 | 177,-0.993,-0.99303,0.193295 179 | 178,-0.9836,-0.983567,0.194189 180 | 179,-0.9702,-0.970246,0.195478 181 | 180,-0.953,-0.952972,0.197067 182 | 181,-0.932,-0.931977,0.198993 183 | 182,-0.9072,-0.907271,0.201209 184 | 183,-0.8789,-0.878844,0.203649 185 | 184,-0.847,-0.847049,0.206335 186 | 185,-0.8118,-0.811761,0.209178 187 | 186,-0.7733,-0.773336,0.212132 188 | 187,-0.7318,-0.731744,0.215171 189 | 188,-0.6873,-0.687336,0.218241 190 | 189,-0.6401,-0.640088,0.221295 191 | 190,-0.5903,-0.590344,0.224267 192 | 191,-0.5382,-0.538184,0.227125 193 | 192,-0.484,-0.483939,0.229815 194 | 193,-0.4278,-0.427815,0.232305 195 | 194,-0.3699,-0.369908,0.234549 196 | 195,-0.3105,-0.310535,0.236512 197 | 196,-0.2499,-0.249892,0.238163 198 | 197,-0.1883,-0.188297,0.239475 199 | 198,-0.126,-0.125946,0.240425 200 | 199,-0.0631,-0.063152,0.241003 201 | 200,0.0,7e-06,0.241198 202 | 201,,0.063107,0.230591 203 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/SMap_circle_E4_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions,Pred_Variance 2 | 110,0.5646,, 3 | 111,0.6155,0.615563,0.119682 4 | 112,0.664,0.66403,0.113945 5 | 113,0.7099,0.709878,0.108862 6 | 114,0.7529,0.752889,0.104581 7 | 115,0.793,0.792948,0.10128 8 | 116,0.8298,0.829864,0.099042 9 | 117,0.8634,0.863393,0.097887 10 | 118,0.8935,0.893521,0.097806 11 | 119,0.9201,0.920036,0.098658 12 | 120,0.9429,0.942999,0.100327 13 | 121,0.9621,0.962057,0.102497 14 | 122,0.9774,0.97737,0.104984 15 | 123,0.9888,0.988766,0.107442 16 | 124,0.9962,0.996308,0.109576 17 | 125,0.9997,0.999698,0.110913 18 | 126,0.9992,0.999173,0.111177 19 | 127,0.9947,0.994683,0.10999 20 | 128,0.9863,0.986263,0.107124 21 | 129,0.9739,0.973905,0.102654 22 | 130,0.9577,0.957649,0.097063 23 | 131,0.9376,0.937636,0.091044 24 | 132,0.9138,0.913798,0.085219 25 | 133,0.8863,0.886374,0.080199 26 | 134,0.8553,0.855309,0.076437 27 | 135,0.8209,0.820896,0.074327 28 | 136,0.7832,0.783194,0.074118 29 | 137,0.7424,0.742404,0.075952 30 | 138,0.6987,0.698637,0.079847 31 | 139,0.6521,0.652133,0.085686 32 | 140,0.603,0.602983,0.093241 33 | 141,0.5515,0.551467,0.102138 34 | 142,0.4977,0.497733,0.111926 35 | 143,0.442,0.442022,0.122084 36 | 144,0.3845,0.384497,0.132116 37 | 145,0.3255,0.325465,0.141544 38 | 146,0.2652,0.26518,0.150028 39 | 147,0.2038,0.203832,0.157408 40 | 148,0.1416,0.141626,0.163631 41 | 149,0.0789,0.078838,0.168661 42 | 150,0.0158,0.015809,0.172303 43 | 151,-0.0473,-0.047295,0.174051 44 | 152,-0.1103,-0.11024,0.172951 45 | 153,-0.1728,-0.172787,0.167551 46 | 154,-0.2346,-0.23463,0.15931 47 | 155,-0.2955,-0.295502,0.149552 48 | 156,-0.3552,-0.355196,0.140195 49 | 157,-0.4135,-0.413483,0.132195 50 | 158,-0.4701,-0.470148,0.125465 51 | 159,-0.5249,-0.524877,0.119577 52 | 160,-0.5775,-0.577554,0.114217 53 | 161,-0.6279,-0.627871,0.109233 54 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/SMap_nan_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions,Pred_Variance 2 | 2,0.998,, 3 | 3,0.992,0.991677,2.020588 4 | 4,0.9821,0.983173,2.041972 5 | 5,0.9683,0.967194,2.155542 6 | 6,0.9506,0.950835,2.336261 7 | 7,0.9291,, 8 | 8,0.9039,, 9 | 9,0.8751,, 10 | 10,0.8428,0.84271,2.477758 11 | 11,,0.805951,1.975079 12 | 12,,0.767629,1.79885 13 | 13,0.7264,0.727135,1.863485 14 | 14,0.6815,, 15 | 15,0.634,, 16 | 16,0.5839,0.582624,1.065331 17 | 17,0.5316,0.532382,0.862988 18 | 18,,0.476331,0.629846 19 | 19,0.4206,0.421436,0.549451 20 | 20,0.3625,0.361239,0.426706 21 | 21,0.303,0.304188,0.336224 22 | 22,0.2423,0.241757,0.261577 23 | 23,0.1806,0.180075,0.204345 24 | 24,0.1181,0.11893,0.161609 25 | 25,0.0552,0.054569,0.130228 26 | 26,-0.0079,-0.007448,0.111232 27 | 27,-0.071,-0.070887,0.101837 28 | 28,-0.1338,-0.133934,0.10104 29 | 29,-0.1961,-0.196629,0.109041 30 | 30,-0.2575,-0.257191,0.126606 31 | 31,-0.318,-0.317469,0.154746 32 | 32,-0.3772,-0.37753,0.193914 33 | 33,-0.4349,-0.435619,0.242858 34 | 34,-0.4909,-0.489765,0.298577 35 | 35,-0.5449,-0.546034,0.362724 36 | 36,-0.5967,-0.59646,0.424372 37 | 37,-0.6461,-0.645051,0.489314 38 | 38,-0.693,-0.694049,0.562388 39 | 39,-0.7371,-0.737341,0.603536 40 | 40,-0.7783,-0.776916,0.615013 41 | 41,-0.8164,-0.817197,0.661648 42 | 42,-0.8512,-0.851956,0.712641 43 | 43,-0.8826,-0.881184,0.7284 44 | 44,-0.9105,-0.911558,0.802915 45 | 45,-0.9348,-0.934069,0.882691 46 | 46,-0.9554,-0.95571,0.948277 47 | 47,-0.9721,-0.97202,1.108455 48 | 48,-0.985,-0.985384,1.368009 49 | 49,-0.9939,-0.993619,1.648975 50 | 50,-0.9989,-0.999006,1.907265 51 | 51,-0.9999,-1.000949,1.855146 52 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/SMap_noTime_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions,Pred_Variance 2 | 101,0.9995,, 3 | 102,0.9955,0.996528,1.975426 4 | 103,0.9876,0.987347,1.918505 5 | 104,0.9757,0.975175,1.860616 6 | 105,0.9599,0.959884,1.798894 7 | 106,0.9403,0.941376,1.731343 8 | 107,0.9169,0.916649,1.651537 9 | 108,0.8899,0.888946,1.56548 10 | 109,0.8594,0.859872,1.476388 11 | 110,0.8254,0.824681,1.377037 12 | 111,0.7881,0.789602,1.279409 13 | 112,0.7477,0.746747,1.172157 14 | 113,0.7043,0.704161,1.069806 15 | 114,0.6581,0.6587,0.968644 16 | 115,0.6093,0.608788,0.867979 17 | 116,0.558,0.559136,0.775263 18 | 117,0.5046,0.503455,0.68366 19 | 118,0.4491,0.449661,0.603313 20 | 119,0.3918,0.391459,0.527898 21 | 120,0.3329,0.333587,0.462721 22 | 121,0.2728,0.271334,0.404337 23 | 122,0.2115,0.212594,0.358644 24 | 123,0.1494,0.149467,0.320526 25 | 124,0.0867,0.086712,0.292802 26 | 125,0.0237,0.022758,0.274453 27 | 126,-0.0395,-0.039248,0.265465 28 | 127,-0.1024,-0.102457,0.264421 29 | 128,-0.165,-0.165286,0.271121 30 | 129,-0.2269,-0.226167,0.285553 31 | 130,-0.2879,-0.288253,0.309182 32 | 131,-0.3478,-0.346811,0.340682 33 | 132,-0.4063,-0.406579,0.382516 34 | 133,-0.4631,-0.462849,0.432025 35 | 134,-0.5181,-0.518766,0.491172 36 | 135,-0.5711,-0.571192,0.557099 37 | 136,-0.6217,-0.621736,0.630662 38 | 137,-0.6699,-0.670356,0.711442 39 | 138,-0.7154,-0.715519,0.797018 40 | 139,-0.7581,-0.757286,0.886432 41 | 140,-0.7977,-0.798728,0.983004 42 | 141,-0.8342,-0.83358,1.07681 43 | 142,-0.8673,-0.866706,1.173126 44 | 143,-0.897,-0.897993,1.270361 45 | 144,-0.9231,-0.922744,1.35882 46 | 145,-0.9455,-0.945754,1.443733 47 | 146,-0.9642,-0.963841,1.517213 48 | 147,-0.979,-0.978661,1.579184 49 | 148,-0.9899,-0.990245,1.626802 50 | 149,-0.9969,-0.997007,1.654356 51 | 150,-0.9999,-0.99891,1.659233 52 | 151,-0.9989,-0.999296,1.646614 53 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/Smplx_DateTime_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions,Pred_Variance 2 | 1995-02-04,2980.0,, 3 | 1995-02-11,2800.0,3229.695719,423779.151051 4 | 1995-02-18,2531.4,2959.716305,279109.84602 5 | 1995-02-25,2397.1,2563.25062,20772.253557 6 | 1995-03-04,2131.9,2275.332317,101407.441869 7 | 1995-03-11,2027.0,2052.383643,4266.649627 8 | 1995-03-18,2041.6,1791.140445,26322.726577 9 | 1995-03-25,2083.9,2018.879388,4876.778322 10 | 1995-04-01,1918.1,2111.257941,2959.511775 11 | 1995-04-08,1779.3,1918.736914,16331.233568 12 | 1995-04-15,1600.8,1631.407291,43644.784278 13 | 1995-04-22,1305.7,1052.049909,236673.99765 14 | 1995-04-29,1088.5,1220.174639,70.476099 15 | 1995-05-06,1050.4,942.454824,20708.480823 16 | 1995-05-13,1039.6,1105.830023,18540.673417 17 | 1995-05-20,954.8,1174.670268,29065.175896 18 | 1995-05-27,976.0,625.394307,122492.103539 19 | 1995-06-03,769.5,890.794548,200489.785425 20 | 1995-06-10,726.2,616.755796,6395.859065 21 | 1995-06-17,746.9,684.845789,7033.833848 22 | 1995-06-24,700.9,747.40036,11306.573835 23 | 1995-07-01,863.3,686.316308,285.354335 24 | 1995-07-08,983.6,794.764161,166980.453972 25 | 1995-07-15,961.7,975.990729,60606.558722 26 | 1995-07-22,1030.6,1110.176324,40348.263293 27 | 1995-07-29,1021.9,905.08634,165965.939294 28 | 1995-08-05,912.0,588.698542,142049.328196 29 | 1995-08-12,1145.9,803.864593,16286.431648 30 | 1995-08-19,1428.7,1235.026674,32938.899482 31 | 1995-08-26,1680.7,1553.159848,56830.593358 32 | 1995-09-02,1953.6,1640.904868,65387.392638 33 | 1995-09-09,2297.1,1898.045049,7808.335973 34 | 1995-09-16,2581.4,2386.599636,78769.472542 35 | 1995-09-23,2748.6,2624.580085,71962.324076 36 | 1995-09-30,2858.6,2749.718255,44237.500445 37 | 1995-10-07,2898.6,2907.421429,10712.925475 38 | 1995-10-14,3028.8,3041.239417,144202.184109 39 | 1995-10-21,3423.9,3304.78571,275075.661047 40 | 1995-10-28,3503.2,3386.303067,290563.07129 41 | 1995-11-04,3365.0,3628.657272,185266.648484 42 | 1995-11-11,3203.2,3972.450464,26572.668812 43 | 1995-11-18,2994.3,3644.127605,390703.051754 44 | 1995-11-25,2742.9,3055.238035,306233.730181 45 | 1995-12-02,2585.7,2870.686558,221805.221668 46 | 1995-12-09,2444.3,2561.166504,7535.115821 47 | 1995-12-16,2205.6,2278.798253,97107.152515 48 | 1995-12-23,1981.6,2032.813845,5237.071639 49 | 1995-12-30,1808.7,1896.86912,31864.170785 50 | 1995-12-31,239.1,1784.382243,66821.014158 51 | 1996-01-07,1671.3,289.289789,45155.50714 52 | 1996-01-14,1617.9,1244.186408,60899.567589 53 | 1996-01-21,1495.7,1675.095867,376938.360042 54 | 1996-01-28,1434.3,1273.730039,45862.551148 55 | 1996-02-04,1332.8,1328.605495,9075.784633 56 | 1996-02-11,916.8,1058.48038,46898.431412 57 | 1996-02-18,557.7,798.906402,102518.456416 58 | 1996-02-25,485.7,656.166119,18853.930942 59 | 1996-03-03,442.4,467.412134,4227.161476 60 | 1996-03-10,416.8,292.032791,14779.169293 61 | 1996-03-17,416.9,198.188311,23704.661615 62 | 1996-03-24,404.0,354.486383,140.653436 63 | 1996-03-31,416.6,371.821891,3581.344261 64 | 1996-04-07,393.2,391.115449,3879.791783 65 | 1996-04-14,360.0,370.757488,4360.072159 66 | 1996-04-21,393.8,216.398657,7328.652406 67 | 1996-04-28,451.7,516.765102,53014.752795 68 | 1996-05-05,440.3,439.243242,3671.786431 69 | 1996-05-12,385.1,328.687341,7115.659643 70 | 1996-05-19,477.8,408.720131,19933.611994 71 | 1996-05-26,324.4,422.595009,5632.640606 72 | 1996-06-02,311.8,427.716607,44080.007582 73 | 1996-06-09,488.9,355.128771,2203.538089 74 | 1996-06-16,749.7,671.678808,29186.174596 75 | 1996-06-23,1086.6,884.533253,14932.036616 76 | 1996-06-30,1164.6,1094.953016,79830.623137 77 | 1996-07-07,1156.7,956.490829,27007.520706 78 | 1996-07-14,1089.0,1056.005593,43634.865207 79 | 1996-07-21,1139.9,772.80785,15822.110691 80 | 1996-07-28,1492.2,878.844212,7432.252044 81 | 1996-08-04,1552.8,1601.375569,129394.599746 82 | 1996-08-11,1546.5,1448.787066,31526.143749 83 | 1996-08-18,1491.3,1465.169505,28676.144437 84 | 1996-08-25,1577.8,1381.693769,2186.153714 85 | 1996-09-01,1847.3,1392.11866,2505.976499 86 | 1996-09-08,1537.1,1842.076434,34634.216965 87 | 1996-09-15,1303.5,1297.83029,23913.208364 88 | 1996-09-22,1088.9,1250.719122,16499.327444 89 | 1996-09-29,1020.4,886.672952,74442.950967 90 | 1996-10-06,994.1,1102.741032,16210.358806 91 | 1996-10-13,1162.6,956.70844,51600.202031 92 | 1996-10-20,1355.9,1193.435313,32544.395574 93 | 1996-10-27,1342.7,1530.455475,74389.649618 94 | 1996-11-03,1322.0,1541.347936,95539.088722 95 | 1996-11-10,1349.3,1205.186475,2458.811686 96 | 1996-11-17,1360.1,1203.593895,2080.522527 97 | 1996-11-24,1590.0,1276.054064,8422.207097 98 | 1996-12-01,1504.9,1548.877725,7626.146944 99 | 1996-12-08,1357.3,1424.240375,70019.941327 100 | 1996-12-15,988.1,1139.804545,8116.905163 101 | 1996-12-22,504.6,744.033741,123411.914142 102 | 1996-12-29,413.4,641.817343,19297.916992 103 | 1996-12-31,115.5,430.017612,6969.534218 104 | 1997-01-07,306.6,241.929043,11489.731077 105 | 1997-01-14,277.6,262.545758,2139.040687 106 | 1997-01-21,253.2,253.129409,3412.332904 107 | 1997-01-28,288.9,314.859898,5247.387435 108 | 1997-02-04,295.4,269.751655,7746.938844 109 | 1997-02-11,291.3,271.580503,2477.54076 110 | 1997-02-18,259.0,288.677417,3898.04245 111 | 1997-02-25,205.0,293.292568,2813.0223 112 | 1997-03-04,196.4,186.331201,94.072532 113 | 1997-03-11,216.2,212.381291,16170.228523 114 | 1997-03-18,212.7,220.333256,38.847401 115 | 1997-03-25,210.6,274.425155,27870.359479 116 | 1997-04-01,309.2,469.476956,62794.47657 117 | 1997-04-08,319.5,335.004182,11439.766167 118 | 1997-04-15,266.3,274.414156,723.059717 119 | 1997-04-22,272.1,235.907359,1506.197048 120 | 1997-04-29,394.4,348.869413,1520.379506 121 | 1997-05-06,397.1,430.769451,34487.817319 122 | 1997-05-13,480.3,398.904102,2476.742985 123 | 1997-05-20,559.7,475.120599,3039.712698 124 | 1997-05-27,521.4,553.972906,1441.096227 125 | 1997-06-03,537.1,580.506826,14493.155498 126 | 1997-06-10,577.7,556.725716,1619.728729 127 | 1997-06-17,619.1,570.472629,2567.399281 128 | 1997-06-24,850.9,616.039293,4692.100868 129 | 1997-07-01,840.1,887.020867,55567.648938 130 | 1997-07-08,1011.7,681.281616,31914.981399 131 | 1997-07-15,1310.3,982.956757,65861.87204 132 | 1997-07-22,1336.6,1477.030033,190034.717317 133 | 1997-07-29,1215.0,1604.509625,89069.314169 134 | 1997-08-05,1281.9,1101.474806,12305.858015 135 | 1997-08-12,1566.8,1080.762147,13825.340278 136 | 1997-08-19,1507.7,1622.738717,103956.903175 137 | 1997-08-26,1465.0,1344.955689,43341.526417 138 | 1997-09-02,1456.1,1381.48585,1362.476679 139 | 1997-09-09,1474.1,1292.794734,16254.281385 140 | 1997-09-16,1541.1,1331.802326,19472.043554 141 | 1997-09-23,1499.0,1399.219791,13345.324566 142 | 1997-09-30,1453.9,1401.854117,4101.337129 143 | 1997-10-07,1579.1,1383.035152,1570.239017 144 | 1997-10-14,1425.1,1397.372515,4515.449836 145 | 1997-10-21,1302.1,1260.909778,70896.160298 146 | 1997-10-28,1154.0,1126.205427,3940.39318 147 | 1997-11-04,1133.3,1064.79567,9430.01099 148 | 1997-11-11,1271.0,1087.016121,13676.504585 149 | 1997-11-18,1478.3,1425.007406,49612.554271 150 | 1997-11-25,1005.3,1978.164665,99090.657899 151 | 1997-12-02,653.1,797.925756,95628.839021 152 | 1997-12-09,183.6,661.14631,54490.587678 153 | 1997-12-16,1130.6,359.250134,44583.861393 154 | 1997-12-23,682.3,1089.808055,110934.516478 155 | 1997-12-30,1061.7,847.187182,219388.079647 156 | 1997-12-31,153.9,1046.651129,41955.99892 157 | 1998-01-07,1076.1,382.502089,119677.788141 158 | 1998-01-14,1102.4,786.006332,12154.99595 159 | 1998-01-21,1349.5,1074.16455,222408.908184 160 | 1998-01-28,1356.5,1443.199023,19568.609855 161 | 1998-02-04,1247.0,1634.17506,88471.591643 162 | 1998-02-11,1036.1,1167.663093,3470.27334 163 | 1998-02-18,996.9,1104.828917,12617.956 164 | 1998-02-25,1095.3,1031.672666,9805.832378 165 | 1998-03-04,1100.9,1230.631204,27915.661385 166 | 1998-03-11,1151.7,1046.133304,104088.303521 167 | 1998-03-18,1145.7,1168.411248,32823.721932 168 | 1998-03-25,1081.7,1051.411,44423.679947 169 | 1998-04-01,1087.2,774.076497,15191.875366 170 | 1998-04-08,1447.5,956.344262,38841.939667 171 | 1998-04-15,1741.7,1393.174598,17591.980545 172 | 1998-04-22,1869.5,1690.349334,63691.628669 173 | 1998-04-29,1580.3,1917.004049,35182.429841 174 | 1998-05-06,1504.2,1364.326453,4454.706656 175 | 1998-05-13,1404.4,1201.438464,65090.650843 176 | 1998-05-20,1141.9,1268.82111,11846.946012 177 | 1998-05-27,688.1,1017.317353,5203.302649 178 | 1998-06-03,622.0,617.209337,38544.990362 179 | 1998-06-10,297.4,522.015304,5891.998215 180 | 1998-06-17,212.8,306.443115,2552.985493 181 | 1998-06-24,91.5,376.92463,73691.627113 182 | 1998-07-01,0.0,40.160302,2285.869731 183 | 1998-07-08,0.0,9.122059,332.238194 184 | 1998-07-15,0.0,0.0,0.0 185 | 1998-07-22,0.0,6.825,139.741875 186 | 1998-07-29,53.6,6.825,139.741875 187 | 1998-08-05,502.3,175.774503,344.532755 188 | 1998-08-12,255.1,595.023666,67353.209573 189 | 1998-08-19,620.8,333.997522,1899.975413 190 | 1998-08-26,765.2,988.932629,57331.286558 191 | 1998-09-02,774.9,873.140977,42777.820027 192 | 1998-09-09,719.1,668.453145,4466.226357 193 | 1998-09-16,392.0,730.537574,6064.855169 194 | 1998-09-23,452.7,393.472807,6874.989141 195 | 1998-09-30,933.7,276.322933,30444.998455 196 | 1998-10-07,1003.0,1283.917048,63368.536348 197 | 1998-10-14,1151.4,1284.442655,199616.058163 198 | 1998-10-21,1247.7,1095.340344,36203.96612 199 | 1998-10-28,1381.8,1244.79886,57052.448175 200 | 1998-11-04,1346.7,1625.86005,152320.689227 201 | 1998-11-11,1328.9,1291.101712,17557.761511 202 | 1998-11-18,1303.6,1216.021015,3127.887451 203 | 1998-11-25,1336.6,1192.136786,2519.843418 204 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/Smplx_E3_block_3sp_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions,Pred_Variance 2 | 103,0.439401,, 3 | 104,-0.119384,0.312495,0.07265 4 | 105,1.455259,0.872122,0.01207 5 | 106,-1.452182,-1.19063,0.025804 6 | 107,-0.2129,0.13608,0.273584 7 | 108,1.14032,0.829999,0.071708 8 | 109,-1.152276,-1.690308,0.169022 9 | 110,0.585776,0.70337,0.091298 10 | 111,0.022673,0.208247,0.107307 11 | 112,0.877471,0.909316,0.031823 12 | 113,-0.519152,-1.033484,0.126869 13 | 114,1.139551,1.32244,0.003766 14 | 115,-1.461834,-1.249684,0.014054 15 | 116,0.34191,0.435675,0.031192 16 | 117,0.791469,0.624699,0.058995 17 | 118,-0.769432,-0.477056,0.642204 18 | 119,0.811908,1.241751,0.027334 19 | 120,-0.712428,-0.793893,0.30812 20 | 121,1.4832,0.971219,0.115819 21 | 122,-1.362758,-1.292564,0.021035 22 | 123,0.240616,0.328377,0.034656 23 | 124,0.768334,0.66114,0.062935 24 | 125,-0.532668,-0.279589,0.21855 25 | 126,1.417437,1.30669,0.002826 26 | 127,-1.263871,-1.308893,0.031365 27 | 128,0.516907,0.446052,0.039351 28 | 129,0.476685,0.359973,0.062626 29 | 130,0.168093,0.121156,0.018847 30 | 131,0.515825,0.718614,0.128959 31 | 132,0.10683,-0.032383,0.080979 32 | 133,0.939276,0.756666,0.003561 33 | 134,-0.969807,-0.986055,0.054887 34 | 135,0.816908,0.930707,1e-06 35 | 136,-0.870545,-0.659001,0.35806 36 | 137,1.342763,0.75677,0.036222 37 | 138,-1.39021,-1.097964,0.128582 38 | 139,0.028155,0.17591,0.011989 39 | 140,1.273938,0.83757,0.087308 40 | 141,-0.949077,-1.458495,0.177418 41 | 142,1.098185,0.797492,0.010202 42 | 143,-0.474253,-0.135063,0.296955 43 | 144,1.296011,1.148936,0.072573 44 | 145,-1.317141,-1.363904,0.034985 45 | 146,0.5317,0.508931,0.023551 46 | 147,0.497327,0.413842,0.028668 47 | 148,0.101539,0.074165,0.005088 48 | 149,1.004527,1.005559,0.080573 49 | 150,-0.71312,-1.165255,0.014643 50 | 151,1.18961,1.228193,0.049887 51 | 152,-1.330637,-1.252076,0.013066 52 | 153,0.537157,0.368783,0.038423 53 | 154,0.357393,0.430478,0.048248 54 | 155,0.172334,0.266746,0.031962 55 | 156,0.400227,0.577582,0.136404 56 | 157,0.469071,0.301466,0.071523 57 | 158,0.473999,0.434803,0.082845 58 | 159,0.486857,0.376018,0.075023 59 | 160,-0.352559,0.122518,0.196897 60 | 161,0.74429,1.236238,0.008567 61 | 162,-1.130676,-1.199192,0.18715 62 | 163,0.44383,0.722512,0.04152 63 | 164,0.532299,0.099536,0.045629 64 | 165,0.700969,0.046293,0.053335 65 | 166,-0.361181,-0.046738,0.090186 66 | 167,1.3866,1.227001,0.010138 67 | 168,-1.191276,-1.228233,0.061138 68 | 169,0.357612,0.656893,0.067984 69 | 170,0.259412,0.604982,0.059193 70 | 171,0.376768,0.183526,0.150814 71 | 172,0.254832,0.446164,0.063935 72 | 173,0.186317,0.688344,0.003713 73 | 174,0.894118,0.547967,0.047314 74 | 175,-0.026881,-0.031524,0.081155 75 | 176,1.163051,0.882091,0.035424 76 | 177,-1.274744,-1.103473,0.072915 77 | 178,0.17991,0.567546,0.0762 78 | 179,0.474507,0.615513,0.062255 79 | 180,-0.133309,-0.047666,0.07978 80 | 181,1.000607,1.014553,0.038292 81 | 182,-0.744674,-1.325645,0.08613 82 | 183,0.993397,1.172379,0.037147 83 | 184,-1.322475,-0.813118,0.369498 84 | 185,0.535779,0.468926,0.029627 85 | 186,0.490292,0.507958,0.010405 86 | 187,0.518592,0.10518,0.011301 87 | 188,0.56421,0.075348,0.21992 88 | 189,0.148809,0.063354,0.193863 89 | 190,0.626932,0.740482,0.144754 90 | 191,0.111045,-0.018126,0.1292 91 | 192,0.896599,0.862238,0.029142 92 | 193,-0.759573,-0.673451,0.277201 93 | 194,0.784424,1.246769,0.031095 94 | 195,-1.277411,-0.789428,0.320412 95 | 196,0.558733,0.554425,0.000188 96 | 197,0.633977,-0.058257,0.004971 97 | 198,0.020644,0.105558,0.024143 98 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/Smplx_E3_embd_block_3sp_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions,Pred_Variance 2 | 102,-1.287707,, 3 | 103,0.439401,0.829063,0.020217 4 | 104,-0.119384,0.196982,0.078427 5 | 105,1.455259,0.545527,0.31858 6 | 106,-1.452182,-0.794887,0.736492 7 | 107,-0.2129,-0.258057,0.71827 8 | 108,1.14032,0.771362,0.109602 9 | 109,-1.152276,-0.30637,1.044731 10 | 110,0.585776,0.603787,0.501692 11 | 111,0.022673,0.300106,0.083803 12 | 112,0.877471,0.606366,0.051205 13 | 113,-0.519152,-0.425105,0.361534 14 | 114,1.139551,1.125457,0.089874 15 | 115,-1.461834,0.198527,0.079024 16 | 116,0.34191,0.63071,0.07875 17 | 117,0.791469,0.335528,0.053157 18 | 118,-0.769432,-0.820353,0.958235 19 | 119,0.811908,1.082197,0.026211 20 | 120,-0.712428,-0.377258,0.271406 21 | 121,1.4832,0.966208,0.04639 22 | 122,-1.362758,-0.719837,0.304146 23 | 123,0.240616,0.225179,0.927137 24 | 124,0.768334,0.468664,0.261899 25 | 125,-0.532668,-0.271879,1.109875 26 | 126,1.417437,0.949503,0.054813 27 | 127,-1.263871,-0.92158,0.262257 28 | 128,0.516907,0.481278,0.067774 29 | 129,0.476685,0.413071,0.029967 30 | 130,0.168093,0.718476,0.084027 31 | 131,0.515825,0.227145,0.294255 32 | 132,0.10683,0.057861,0.0125 33 | 133,0.939276,0.917632,0.073626 34 | 134,-0.969807,-0.510907,0.691523 35 | 135,0.816908,0.680033,0.019985 36 | 136,-0.870545,-0.005392,0.308581 37 | 137,1.342763,0.865512,0.020572 38 | 138,-1.39021,-1.144423,0.093422 39 | 139,0.028155,0.180229,0.131446 40 | 140,1.273938,0.581523,0.264337 41 | 141,-0.949077,-1.290937,0.218512 42 | 142,1.098185,0.954446,0.081137 43 | 143,-0.474253,-1.359503,0.276023 44 | 144,1.296011,1.12002,0.05798 45 | 145,-1.317141,-1.132882,0.009884 46 | 146,0.5317,0.34968,0.967621 47 | 147,0.497327,0.319764,0.22482 48 | 148,0.101539,0.654692,0.199498 49 | 149,1.004527,0.212658,0.073278 50 | 150,-0.71312,-0.991807,0.217938 51 | 151,1.18961,1.00942,0.113121 52 | 152,-1.330637,-0.094237,0.11997 53 | 153,0.537157,0.825983,0.019784 54 | 154,0.357393,0.175399,0.403643 55 | 155,0.172334,0.5077,0.141902 56 | 156,0.400227,0.457644,0.105768 57 | 157,0.469071,0.322488,0.033183 58 | 158,0.473999,-0.603825,0.322879 59 | 159,0.486857,0.322089,0.035608 60 | 160,-0.352559,0.201328,0.008457 61 | 161,0.74429,1.216603,0.023439 62 | 162,-1.130676,-0.52322,0.328118 63 | 163,0.44383,0.927132,0.047772 64 | 164,0.532299,0.308226,0.089083 65 | 165,0.700969,0.695778,0.125299 66 | 166,-0.361181,-0.387008,0.33664 67 | 167,1.3866,0.920763,0.013198 68 | 168,-1.191276,-1.313802,0.020293 69 | 169,0.357612,0.812185,0.031662 70 | 170,0.259412,0.37853,0.051286 71 | 171,0.376768,0.4982,0.046543 72 | 172,0.254832,-0.251675,0.978574 73 | 173,0.186317,0.708145,0.028992 74 | 174,0.894118,0.3529,0.369285 75 | 175,-0.026881,-0.629205,0.500807 76 | 176,1.163051,0.927145,0.089689 77 | 177,-1.274744,-0.670344,0.533708 78 | 178,0.17991,0.827329,0.020358 79 | 179,0.474507,0.521291,0.001192 80 | 180,-0.133309,0.309088,0.17194 81 | 181,1.000607,0.86459,0.184044 82 | 182,-0.744674,-1.318343,0.086447 83 | 183,0.993397,0.829169,0.020643 84 | 184,-1.322475,-0.718911,0.124755 85 | 185,0.535779,0.029605,0.268637 86 | 186,0.490292,0.406547,0.21314 87 | 187,0.518592,-0.956726,0.130205 88 | 188,0.56421,0.067803,0.100392 89 | 189,0.148809,0.459917,0.064257 90 | 190,0.626932,0.809719,0.130996 91 | 191,0.111045,-1.231647,0.145281 92 | 192,0.896599,0.783882,0.010525 93 | 193,-0.759573,-1.358483,0.236706 94 | 194,0.784424,0.722976,0.069653 95 | 195,-1.277411,-0.705869,0.622008 96 | 196,0.558733,0.711675,0.02858 97 | 197,0.633977,0.37228,0.082721 98 | 198,0.020644,0.155835,0.122911 99 | 199,0.548923,0.660286,0.058801 100 | 200,0.040304,-0.870751,0.293291 101 | 201,,0.911501,0.136825 102 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/Smplx_disjointLib_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions,Pred_Variance 2 | 80,-0.9621,, 3 | 81,-0.9429,-0.951636,0.000523 4 | 82,-0.9201,-0.929642,0.000753 5 | 83,-0.8935,-0.904166,0.001008 6 | 84,-0.8634,-0.874905,0.001297 7 | 85,-0.8298,-0.842219,0.001601 8 | 86,-0.793,-0.806197,0.001927 9 | 87,-0.7529,-0.767103,0.002263 10 | 88,-0.7099,-0.724807,0.00261 11 | 89,-0.664,-0.679713,0.002953 12 | 90,-0.6155,-0.631978,0.003291 13 | 91,-0.5646,-0.581588,0.003629 14 | 92,-0.5113,-0.529123,0.003942 15 | 93,-0.4561,-0.474303,0.004246 16 | 94,-0.399,-0.417761,0.004511 17 | 95,-0.3404,-0.359555,0.004757 18 | 96,-0.2804,-0.299839,0.004976 19 | 97,-0.2192,-0.239054,0.005153 20 | 98,-0.1572,-0.177173,0.005291 21 | 99,-0.0946,-0.11467,0.005382 22 | 100,-0.0316,-0.051748,0.005443 23 | 101,0.0316,0.011417,0.005457 24 | 102,0.0946,0.074583,0.00542 25 | 103,0.1572,0.178554,0.004523 26 | 104,0.2192,0.236799,0.001842 27 | 105,0.2804,0.289658,0.001251 28 | 106,0.3404,0.349517,0.001199 29 | 107,0.399,0.407948,0.001139 30 | 108,0.4561,0.464721,0.001071 31 | 109,0.5113,0.519713,0.000997 32 | 110,0.5646,0.572523,0.000919 33 | 111,0.6155,0.623145,0.000837 34 | 112,0.664,0.671271,0.000752 35 | 113,0.7099,0.716659,0.000666 36 | 114,0.7529,0.75931,0.000579 37 | 115,0.793,0.79879,0.000496 38 | 116,0.8298,0.835173,0.000414 39 | 117,0.8634,0.868188,0.000338 40 | 118,0.8935,0.897741,0.000265 41 | 119,0.9201,0.923734,0.000201 42 | 120,0.9429,0.946034,0.000144 43 | 121,0.9621,0.964503,9.5e-05 44 | 122,0.9774,0.979155,5.6e-05 45 | 123,0.9888,0.989886,2.7e-05 46 | 124,0.9962,0.996574,8e-06 47 | 125,0.9997,0.999285,0.0 48 | 126,0.9992,0.99789,4e-06 49 | 127,0.9947,0.992617,1.7e-05 50 | 128,0.9863,0.987208,3.3e-05 51 | 129,0.9739,0.976337,6.4e-05 52 | 130,0.9577,0.96092,0.000106 53 | 131,0.9376,0.941518,0.000157 54 | 132,0.9138,0.917101,0.000244 55 | 133,0.8863,0.889876,0.000317 56 | 134,0.8553,0.859159,0.000397 57 | 135,0.8209,0.825024,0.000479 58 | 136,0.7832,0.787591,0.000569 59 | 137,0.7424,0.747025,0.000663 60 | 138,0.6987,0.703511,0.000751 61 | 139,0.6521,0.657206,0.000845 62 | 140,0.603,0.608226,0.00094 63 | 141,0.5515,0.58596,0.000455 64 | 142,0.4977,0.623766,0.00417 65 | 143,0.442,0.650428,0.003596 66 | 144,0.3845,0.663747,0.00037 67 | 145,0.3255,0.615224,0.000412 68 | 146,0.2652,0.564266,0.00045 69 | 147,0.2038,0.511038,0.000487 70 | 148,0.1416,0.455812,0.000524 71 | 149,0.0789,0.398718,0.000556 72 | 150,0.0158,0.340063,0.000585 73 | 151,-0.0473,0.087158,0.051937 74 | 152,-0.1103,-0.138582,0.031479 75 | 153,-0.1728,-0.213035,0.000601 76 | 154,-0.2346,-0.240354,0.001379 77 | 155,-0.2955,-0.301146,0.001331 78 | 156,-0.3552,-0.360738,0.001272 79 | 157,-0.4135,-0.418902,0.001207 80 | 158,-0.4701,-0.475388,0.001134 81 | 159,-0.5249,-0.52997,0.001054 82 | 160,-0.5775,-0.582472,0.000966 83 | 161,-0.6279,-0.632565,0.000879 84 | 162,-0.6758,-0.680191,0.000788 85 | 163,-0.7209,-0.72515,0.000694 86 | 164,-0.7632,-0.767074,0.000604 87 | 165,-0.8025,-0.806074,0.000513 88 | 166,-0.8385,-0.841861,0.000426 89 | 167,-0.8712,-0.874184,0.000345 90 | 168,-0.9005,-0.903098,0.00027 91 | 169,-0.9261,-0.928414,0.000201 92 | 170,-0.9481,-0.949931,0.000141 93 | 171,-0.9663,-0.967678,9e-05 94 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/Smplx_disjointPred_nan_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions,Pred_Variance 2 | 10.2,7.0599,, 3 | 10.25,8.4636,, 4 | 10.3,9.4393,5.11301,17.98271 5 | 10.35,9.8903,, 6 | 10.4,,9.26678,0.99701 7 | 10.45,9.2343,, 8 | 10.5,8.1564,, 9 | 10.55,6.473,, 10 | 17.5,-0.312,, 11 | 17.55,0.3423,, 12 | 17.6,1.0903,0.87853,0.17898 13 | 17.65,1.6711,1.91313,1.04335 14 | 17.7,2.0953,3.04205,0.96814 15 | 17.75,2.5106,5.00111,0.54732 16 | 17.8,3.0047,5.96726,2.99411 17 | 37.5,0.1798,, 18 | 37.55,1.1517,, 19 | 37.6,1.9295,2.32714,0.99734 20 | 37.65,2.5209,2.78731,0.20917 21 | 37.7,2.9693,2.80316,0.10518 22 | 37.75,3.3173,3.0927,0.14482 23 | 37.8,3.5785,3.55718,0.32698 24 | 54.0,-0.8324,, 25 | 54.05,-0.6025,, 26 | 54.1,-0.3383,1.69422,1.85725 27 | 54.15,0.0761,2.13681,2.60184 28 | 54.2,0.6633,1.10912,1.39857 29 | 54.25,1.391,1.46232,0.6502 30 | 54.3,2.2281,2.34526,0.43732 31 | 59.5,-1.5218,, 32 | 59.55,-2.58,, 33 | 59.6,-3.0068,-2.73811,0.65755 34 | 59.65,-2.9803,-2.25793,0.81284 35 | 59.7,-2.7444,-2.19974,0.67819 36 | 59.75,-2.4508,-1.99461,1.88155 37 | 59.8,-2.1097,-2.61172,1.25028 38 | 59.85,-1.6804,-2.02162,0.98826 39 | 59.9,-1.2133,-1.38417,0.93814 40 | 59.95,-0.8408,-0.92873,1.07194 41 | 60.0,,0.20708,2.07095 42 | 60.05,,0.07412,0.34372 43 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/Smplx_exclRadius_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions,Pred_Variance 2 | 21,0.303,, 3 | 22,0.2423,-0.387607,0.002034 4 | 23,0.1806,-0.327352,0.002167 5 | 24,0.1181,-0.305358,0.00196 6 | 25,0.0552,-0.346352,0.001552 7 | 26,-0.0079,-0.415057,0.00186 8 | 27,-0.071,-0.221136,0.124514 9 | 28,-0.1338,0.065093,0.112738 10 | 29,-0.1961,0.219297,0.002083 11 | 30,-0.2575,0.144913,0.001567 12 | 31,-0.318,0.117072,0.002294 13 | 32,-0.3772,0.181113,0.002242 14 | 33,-0.4349,0.243737,0.002173 15 | 34,-0.4909,0.305099,0.002092 16 | 35,-0.5449,0.36498,0.001997 17 | 36,-0.5967,0.423319,0.001892 18 | 37,-0.6461,0.479881,0.001773 19 | 38,-0.693,0.534448,0.001644 20 | 39,-0.7371,0.586839,0.001506 21 | 40,-0.7783,0.636804,0.001366 22 | 41,-0.8164,0.68424,0.001223 23 | 42,-0.8512,0.728936,0.001078 24 | 43,-0.8826,0.770707,0.000933 25 | 44,-0.9105,0.80933,0.000792 26 | 45,-0.9348,0.844729,0.000658 27 | 46,-0.9554,0.876739,0.000532 28 | 47,-0.9721,0.905252,0.000415 29 | 48,-0.985,0.93014,0.00031 30 | 49,-0.9939,0.951307,0.000218 31 | 50,-0.9989,0.968645,0.00014 32 | 51,-0.9999,0.982099,7.9e-05 33 | 52,-0.9969,0.985612,6.8e-05 34 | 53,-0.9899,0.995699,1.1e-05 35 | 54,-0.979,0.99658,1.6e-05 36 | 55,-0.9642,0.994923,2e-05 37 | 56,-0.9455,0.987343,5.6e-05 38 | 57,-0.9231,0.975807,0.000109 39 | 58,-0.897,0.960358,0.000178 40 | 59,-0.8673,0.941048,0.000263 41 | 60,-0.8342,0.91798,0.000362 42 | 61,-0.7977,0.891239,0.000472 43 | 62,-0.7581,0.860946,0.000594 44 | 63,-0.7154,0.827214,0.000727 45 | 64,-0.6699,0.790091,0.000865 46 | 65,-0.6217,0.749831,0.001006 47 | 66,-0.5711,0.706539,0.001154 48 | 67,-0.5181,0.660376,0.001297 49 | 68,-0.4631,0.611531,0.001444 50 | 69,-0.4063,0.560153,0.001581 51 | 70,-0.3478,0.506409,0.001716 52 | 71,-0.2879,0.450523,0.00184 53 | 72,-0.2269,0.392557,0.001962 54 | 73,-0.165,0.33254,0.00206 55 | 74,-0.1024,0.307148,0.001649 56 | 75,-0.0395,0.364472,0.001685 57 | 76,0.0237,0.430845,0.001873 58 | 77,0.0867,0.204949,0.132066 59 | 78,0.1494,-0.086925,0.097776 60 | 79,0.2115,-0.201357,0.002006 61 | 80,0.2728,-0.129514,0.00153 62 | 81,0.3329,-0.111516,0.002411 63 | 82,0.3918,-0.175724,0.002327 64 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/Smplx_nan2_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions,Pred_Variance 2 | 2,0.0631,, 3 | 3,0.126,0.109745,0.001357 4 | 4,0.1883,0.169949,0.001299 5 | 5,0.2499,0.235085,0.001293 6 | 6,,0.297277,0.001246 7 | 7,,, 8 | 8,0.4278,, 9 | 9,0.484,0.473238,0.001055 10 | 10,0.5382,0.528154,0.000983 11 | 11,0.5903,0.580859,0.000902 12 | 12,0.6401,, 13 | 13,,, 14 | 14,0.7318,, 15 | 15,0.7733,0.556728,0.258742 16 | 16,0.8118,0.805068,0.000478 17 | 17,0.847,0.840855,0.000398 18 | 18,0.8789,0.873289,0.000322 19 | 19,0.9072,, 20 | 20,0.932,, 21 | 21,0.953,0.66913,0.438666 22 | 22,0.9702,0.967074,8.6e-05 23 | 23,0.9836,0.981047,4.9e-05 24 | 24,0.993,0.991089,2.2e-05 25 | 25,0.9985,0.997172,6e-06 26 | 26,1.0,0.999302,0.0 27 | 27,0.9975,0.997425,5e-06 28 | 28,0.991,0.988956,2.8e-05 29 | 29,0.9806,0.977936,5.7e-05 30 | 30,0.9663,0.963002,9.7e-05 31 | 31,0.9481,0.944233,0.000146 32 | 32,0.9261,0.921691,0.000203 33 | 33,0.9005,0.895431,0.000269 34 | 34,0.8712,0.865609,0.00034 35 | 35,0.8385,0.832329,0.000416 36 | 36,0.8025,0.795683,0.000499 37 | 37,0.7632,0.755894,0.000583 38 | 38,0.7209,0.713141,0.000667 39 | 39,0.6758,0.667466,0.000756 40 | 40,0.6279,0.619106,0.00084 41 | 41,0.5775,0.56833,0.000922 42 | 42,0.5249,0.515163,0.001002 43 | 43,0.4701,0.459925,0.001074 44 | 44,0.4135,0.402865,0.001143 45 | 45,0.3552,0.344143,0.001203 46 | 46,0.2955,0.283972,0.001254 47 | 47,0.2346,0.222401,0.001295 48 | 48,0.1728,0.159777,0.001327 49 | 49,0.1103,0.096225,0.001347 50 | 50,0.0473,0.031175,0.00135 51 | 51,-0.0158,-0.036145,0.001316 52 | 52,-0.0789,-0.093624,0.001212 53 | 53,-0.1416,-0.11851,0.001224 54 | 54,-0.2038,-0.186612,0.001302 55 | 55,-0.2652,-0.25088,0.001282 56 | 56,-0.3255,-0.31269,0.001235 57 | 57,-0.3845,-0.372754,0.00118 58 | 58,-0.442,-0.43092,0.001114 59 | 59,-0.4977,-0.487241,0.001042 60 | 60,-0.5515,-0.541587,0.000963 61 | 61,-0.603,-0.593674,0.000884 62 | 62,-0.6521,-0.643376,0.000801 63 | 63,-0.6987,-0.690412,0.000713 64 | 64,-0.7424,-0.73469,0.000626 65 | 65,-0.7832,-0.776057,0.000542 66 | 66,-0.8209,-0.814296,0.000457 67 | 67,-0.8553,-0.849249,0.000378 68 | 68,-0.8863,-0.880856,0.000304 69 | 69,-0.9138,-0.908922,0.000235 70 | 70,-0.9376,-0.933327,0.000174 71 | 71,-0.9577,-0.954044,0.00012 72 | 72,-0.9739,-0.970935,7.6e-05 73 | 73,-0.9863,-0.983914,4.1e-05 74 | 74,-0.9947,-0.992997,1.7e-05 75 | 75,-0.9992,-0.998115,3e-06 76 | 76,-0.9997,-0.999243,0.0 77 | 77,-0.9962,-0.996365,8e-06 78 | 78,-0.9888,-0.986596,3.4e-05 79 | 79,-0.9774,-0.974576,6.7e-05 80 | 80,-0.9621,-0.958655,0.000109 81 | 81,-0.9429,-0.938952,0.000159 82 | 82,-0.9201,-0.915441,0.000219 83 | 83,-0.8935,-0.888295,0.000285 84 | 84,-0.8634,-0.857581,0.000359 85 | 85,-0.8298,-0.823452,0.000436 86 | 86,-0.793,-0.786057,0.00052 87 | 87,-0.7529,-0.745529,0.000603 88 | 88,-0.7099,-0.701963,0.000691 89 | 89,-0.664,-0.655613,0.000777 90 | 90,-0.6155,-0.606634,0.000862 91 | 91,-0.5646,-0.555213,0.000944 92 | 92,-0.5113,-0.501599,0.001021 93 | 93,-0.4561,-0.445877,0.001095 94 | 94,-0.399,-0.388353,0.001161 95 | 95,-0.3404,-0.329298,0.001221 96 | 96,-0.2804,-0.268743,0.00127 97 | 97,-0.2192,-0.206972,0.00131 98 | 98,-0.1572,-0.144193,0.001337 99 | 99,-0.0946,-0.080148,0.00135 100 | 100,-0.0316,-0.014567,0.001343 101 | 101,0.0316,0.068972,0.0029 102 | 102,0.0946,0.116449,0.001403 103 | 103,0.1572,0.135305,0.001258 104 | 104,0.2192,0.202468,0.001285 105 | 105,0.2804,, 106 | 106,0.3404,, 107 | 107,0.399,, 108 | 108,0.4561,0.445219,0.001098 109 | 109,0.5113,0.501079,0.001023 110 | 110,0.5646,0.554745,0.000945 111 | 111,0.6155,0.374054,0.173669 112 | 112,0.664,0.270333,0.306521 113 | 113,0.7099,0.283128,0.360397 114 | 114,0.7529,0.46335,0.315274 115 | 115,0.793,0.785899,0.00052 116 | 116,0.8298,0.823339,0.000436 117 | 117,0.8634,0.857494,0.00036 118 | 118,0.8935,0.527889,0.458094 119 | 119,0.9201,0.335774,0.678753 120 | 120,0.9429,0.559523,0.547018 121 | 121,0.9621,0.958603,0.000108 122 | 122,0.9774,0.974543,6.7e-05 123 | 123,0.9888,0.986575,3.4e-05 124 | 124,0.9962,0.994656,1.3e-05 125 | 125,0.9997,0.998772,2e-06 126 | 126,0.9992,0.9989,1e-06 127 | 127,0.9947,0.993013,1.7e-05 128 | 128,0.9863,0.983939,4.1e-05 129 | 129,0.9739,0.97098,7.6e-05 130 | 130,0.9577,0.954109,0.00012 131 | 131,0.9376,0.933404,0.000174 132 | 132,0.9138,0.908985,0.000234 133 | 133,0.8863,0.880928,0.000304 134 | 134,0.8553,0.84935,0.000378 135 | 135,0.8209,0.814449,0.000457 136 | 136,0.7832,0.776235,0.000542 137 | 137,0.7424,0.734895,0.000625 138 | 138,0.6987,0.690655,0.000711 139 | 139,0.6521,0.643643,0.000799 140 | 140,0.603,0.594004,0.000882 141 | 141,0.5515,0.542014,0.000963 142 | 142,0.4977,0.48787,0.001042 143 | 143,0.442,0.431697,0.001111 144 | 144,0.3845,0.37377,0.001176 145 | 145,0.3255,0.314227,0.001232 146 | 146,0.2652,0.253414,0.001283 147 | 147,0.2038,0.191458,0.001321 148 | 148,0.1416,0.128356,0.001347 149 | 149,0.0789,0.064212,0.001365 150 | 150,0.0158,-0.001619,0.00135 151 | 151,-0.0473,-0.070532,0.001241 152 | 152,-0.1103,-0.095429,0.001207 153 | 153,-0.1728,-0.152558,0.001282 154 | 154,-0.2346,-0.218709,0.001283 155 | 155,-0.2955,-0.281823,0.001249 156 | 156,-0.3552,-0.342686,0.001199 157 | 157,-0.4135,-0.401873,0.00114 158 | 158,-0.4701,-0.4593,0.001074 159 | 159,-0.5249,-0.514658,0.001004 160 | 160,-0.5775,-0.567889,0.000922 161 | 161,-0.6279,-0.618738,0.000839 162 | 162,-0.6758,-0.667178,0.000756 163 | 163,-0.7209,-0.712927,0.000668 164 | 164,-0.7632,-0.755733,0.000583 165 | 165,-0.8025,-0.795564,0.000499 166 | 166,-0.8385,-0.832208,0.000417 167 | 167,-0.8712,-0.865479,0.00034 168 | 168,-0.9005,-0.895324,0.000269 169 | 169,-0.9261,-0.921617,0.000203 170 | 170,-0.9481,-0.944188,0.000147 171 | 171,-0.9663,-0.962968,9.7e-05 172 | 172,-0.9806,-0.977906,5.8e-05 173 | 173,-0.991,-0.988931,2.8e-05 174 | 174,-0.9975,-0.996011,9e-06 175 | 175,-1.0,-0.999146,1e-06 176 | 176,-0.9985,-0.99827,3e-06 177 | 177,-0.993,-0.991114,2.2e-05 178 | 178,-0.9836,-0.981085,4.9e-05 179 | 179,-0.9702,-0.967113,8.6e-05 180 | 180,-0.953,-0.949245,0.000133 181 | 181,-0.932,-0.927629,0.000187 182 | 182,-0.9072,-0.90234,0.000252 183 | 183,-0.8789,-0.873398,0.000322 184 | 184,-0.847,-0.840995,0.000398 185 | 185,-0.8118,-0.805208,0.000477 186 | 186,-0.7733,-0.766194,0.000563 187 | 187,-0.7318,-0.724118,0.000647 188 | 188,-0.6873,-0.67916,0.000735 189 | 189,-0.6401,-0.631434,0.000819 190 | 190,-0.5903,-0.581211,0.000901 191 | 191,-0.5382,-0.528628,0.000983 192 | 192,-0.484,-0.473905,0.001056 193 | 193,-0.4278,-0.417326,0.001128 194 | 194,-0.3699,-0.358949,0.001186 195 | 195,-0.3105,-0.299073,0.001242 196 | 196,-0.2499,-0.237889,0.001289 197 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/Smplx_nan_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions,Pred_Variance 2 | 2,0.998,, 3 | 3,0.992,-0.27715,0.90803 4 | 4,0.9821,0.334718,0.86145 5 | 5,0.9683,0.32555,0.848765 6 | 6,0.9506,-0.281352,0.885469 7 | 7,0.9291,, 8 | 8,0.9039,, 9 | 9,0.8751,, 10 | 10,0.8428,, 11 | 11,,, 12 | 12,,, 13 | 13,0.7264,, 14 | 14,0.6815,, 15 | 15,0.634,, 16 | 16,0.5839,-0.253514,0.364237 17 | 17,0.5316,, 18 | 18,,0.111225,0.276347 19 | 19,0.4206,, 20 | 20,0.3625,0.067159,0.180277 21 | 21,0.303,0.044284,0.138041 22 | 22,0.2423,0.021248,0.100384 23 | 23,0.1806,-0.002435,0.068198 24 | 24,0.1181,-0.153452,0.028737 25 | 25,0.0552,-0.137863,0.012047 26 | 26,-0.0079,-0.122721,0.002498 27 | 27,-0.071,-0.106685,0.003626 28 | 28,-0.1338,-0.081759,0.003147 29 | 29,-0.1961,-0.076546,0.002763 30 | 30,-0.2575,-0.142852,0.022338 31 | 31,-0.318,-0.165986,0.042725 32 | 32,-0.3772,-0.186774,0.069436 33 | 33,-0.4349,-0.206799,0.101884 34 | 34,-0.4909,-0.225406,0.139561 35 | 35,-0.5449,-0.24281,0.182007 36 | 36,-0.5967,-0.259518,0.22837 37 | 37,-0.6461,, 38 | 38,-0.693,-0.288823,0.330281 39 | 39,-0.7371,-0.301554,0.384254 40 | 40,-0.7783,-0.472349,0.321404 41 | 41,-0.8164,-0.392776,0.472068 42 | 42,-0.8512,-0.332965,0.547099 43 | 43,-0.8826,, 44 | 44,-0.9105,, 45 | 45,-0.9348,-0.351801,0.694159 46 | 46,-0.9554,-0.560835,0.551007 47 | 47,-0.9721,-0.964388,0.000351 48 | 48,-0.985,-0.445329,0.750504 49 | 49,-0.9939,-0.357304,0.83003 50 | 50,-0.9989,-0.3549,0.849481 51 | 51,-0.9999,-0.351783,0.861848 52 | 52,-0.9969,-0.346346,0.868009 53 | 53,-0.9899,-0.559247,0.66828 54 | 54,-0.979,-0.331464,0.859301 55 | 55,-0.9642,-0.322775,0.843077 56 | 56,-0.9455,-0.312811,0.820426 57 | 57,-0.9231,-0.301104,0.791889 58 | 58,-0.897,-0.288296,0.757641 59 | 59,-0.8673,-0.274843,0.717963 60 | 60,-0.8342,-0.259421,0.674248 61 | 61,-0.7977,-0.244167,0.626101 62 | 62,-0.7581,-0.2265,0.575677 63 | 63,-0.7154,-0.208841,0.522597 64 | 64,-0.6699,-0.190413,0.467972 65 | 65,-0.6217,-0.170374,0.413333 66 | 66,-0.5711,-0.150695,0.358532 67 | 67,-0.5181,-0.129221,0.30546 68 | 68,-0.4631,-0.107997,0.254115 69 | 69,-0.4063,-0.085824,0.205827 70 | 70,-0.3478,-0.063611,0.161078 71 | 71,-0.2879,-0.040091,0.120914 72 | 72,-0.2269,-0.017604,0.085411 73 | 73,-0.165,0.006492,0.055721 74 | 74,-0.1024,0.030742,0.032007 75 | 75,-0.0395,0.118919,0.00673 76 | 76,0.0237,0.089201,0.003946 77 | 77,0.0867,0.102226,0.004398 78 | 78,0.1494,0.087024,0.003492 79 | 79,0.2115,0.092963,0.002801 80 | 80,0.2728,0.041527,0.019737 81 | 81,0.3329,0.023697,0.04011 82 | 82,0.3918,0.18958,0.083579 83 | 83,0.4491,0.208457,0.118693 84 | 84,0.5046,0.227334,0.158572 85 | 85,0.558,0.24412,0.203229 86 | 86,0.6093,0.2605,0.251285 87 | 87,0.6581,0.27532,0.302461 88 | 88,0.7043,0.289464,0.355597 89 | 89,0.7477,0.301504,0.410382 90 | 90,0.7881,0.313595,0.464989 91 | 91,0.8254,0.323392,0.519647 92 | 92,0.8594,0.332005,0.572862 93 | 93,0.8899,0.340184,0.623407 94 | 94,0.9169,0.345614,0.671795 95 | 95,0.9403,0.350891,0.715615 96 | 96,0.9599,0.353929,0.755584 97 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/Smplx_negTp_block_3sp_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions,Pred_Variance 2 | 50,0.777883,0.530512,1.201127 3 | 51,-0.538724,0.191684,0.1724 4 | 52,-0.309352,-0.984273,0.652048 5 | 53,0.000553,-0.084214,1.288469 6 | 54,-0.012581,-0.00843,0.052784 7 | 55,0.563513,0.205163,0.328226 8 | 56,0.546839,-0.246618,1.381041 9 | 57,1.708685,-0.689461,0.231913 10 | 58,-0.924343,0.332287,1.086247 11 | 59,0.229087,0.296642,0.526306 12 | 60,-1.149584,-0.254835,0.639765 13 | 61,1.567762,-0.206314,0.098188 14 | 62,-1.528225,0.086238,0.091168 15 | 63,-0.089572,-0.013627,0.109243 16 | 64,-0.620201,-0.664773,0.094745 17 | 65,-0.285003,1.07472,1.594937 18 | 66,-0.930042,-0.540547,0.229156 19 | 67,-0.705679,0.267418,1.387373 20 | 68,-1.11594,-0.588954,0.155937 21 | 69,-0.888742,0.562169,1.035978 22 | 70,0.41874,0.884908,0.69583 23 | 71,-0.190223,-0.79728,0.753763 24 | 72,-0.935922,-0.10113,1.202438 25 | 73,-0.126205,0.528297,0.970632 26 | 74,0.191106,0.125734,0.41466 27 | 75,-0.93995,-0.258728,0.13157 28 | 76,1.525613,0.242821,0.427782 29 | 77,-0.705881,0.678479,0.682609 30 | 78,1.406557,0.066428,0.932064 31 | 79,-0.380974,-0.002384,0.5382 32 | 80,1.983323,0.168179,0.400906 33 | 81,-0.352249,, 34 | 82,0.089892,, 35 | -------------------------------------------------------------------------------- /src/pyEDM/tests/validation/Smplx_validLib_valid.csv: -------------------------------------------------------------------------------- 1 | Time,Observations,Predictions,Pred_Variance 2 | 2,0.0631,, 3 | 3,0.126,0.589116,0.000431 4 | 4,0.1883,0.588951,0.000431 5 | 5,0.2499,0.588725,0.000431 6 | 6,0.3105,0.588396,0.00043 7 | 7,0.3699,0.587877,0.000429 8 | 8,0.4278,0.586942,0.000425 9 | 9,0.484,0.584791,0.000412 10 | 10,0.5382,0.575702,0.000282 11 | 11,0.5903,0.598248,0.000877 12 | 12,0.6401,0.647555,0.000795 13 | 13,0.6873,0.69437,0.00071 14 | 14,0.7318,0.73842,0.000621 15 | 15,0.7733,0.779527,0.000538 16 | 16,0.8118,0.817487,0.000453 17 | 17,0.847,0.852177,0.000376 18 | 18,0.8789,0.883487,0.0003 19 | 19,0.9072,0.911305,0.000233 20 | 20,0.932,0.935422,0.000171 21 | 21,0.953,0.955818,0.000119 22 | 22,0.9702,0.972475,7.4e-05 23 | 23,0.9836,0.985153,4e-05 24 | 24,0.993,0.993849,1.6e-05 25 | 25,0.9985,0.998523,3e-06 26 | 26,1.0,0.998954,1e-06 27 | 27,0.9975,0.995287,8e-06 28 | 28,0.991,0.993294,1.8e-05 29 | 29,0.9806,0.983353,4.6e-05 30 | 30,0.9663,0.969387,8.3e-05 31 | 31,0.9481,0.951702,0.00013 32 | 32,0.9261,0.930215,0.000185 33 | 33,0.9005,0.905025,0.000249 34 | 34,0.8712,0.876316,0.00032 35 | 35,0.8385,0.844097,0.000395 36 | 36,0.8025,0.808504,0.000476 37 | 37,0.7632,0.769763,0.000559 38 | 38,0.7209,0.727926,0.000642 39 | 39,0.6758,0.683134,0.000731 40 | 40,0.6279,0.635705,0.000815 41 | 41,0.5775,0.585739,0.000897 42 | 42,0.5249,0.53333,0.000979 43 | 43,0.4701,0.532048,0.003025 44 | 44,0.4135,0.540488,0.002714 45 | 45,0.3552,0.550004,0.002178 46 | 46,0.2955,0.586529,0.000422 47 | 47,0.2346,0.587547,0.000427 48 | 48,0.1728,0.588165,0.000429 49 | 49,0.1103,0.588559,0.00043 50 | 50,0.0473,0.588828,0.000431 51 | 51,-0.0158,0.589022,0.000431 52 | 52,-0.0789,0.207415,0.290268 53 | 53,-0.1416,-0.54727,0.003994 54 | 54,-0.2038,-0.547584,0.003974 55 | 55,-0.2652,-0.548028,0.003944 56 | 56,-0.3255,-0.548693,0.0039 57 | 57,-0.3845,-0.549784,0.003825 58 | 58,-0.442,-0.551843,0.003678 59 | 59,-0.4977,-0.556795,0.003285 60 | 60,-0.5515,-0.588559,0.000278 61 | 61,-0.603,-0.61077,0.000858 62 | 62,-0.6521,-0.659585,0.000773 63 | 63,-0.6987,-0.705655,0.000686 64 | 64,-0.7424,-0.748924,0.000601 65 | 65,-0.7832,-0.789288,0.000517 66 | 66,-0.8209,-0.826447,0.000434 67 | 67,-0.8553,-0.860292,0.000356 68 | 68,-0.8863,-0.890774,0.000284 69 | 69,-0.9138,-0.917674,0.000216 70 | 70,-0.9376,-0.940902,0.000158 71 | 71,-0.9577,-0.960389,0.000106 72 | 72,-0.9739,-0.976015,6.5e-05 73 | 73,-0.9863,-0.987679,3.3e-05 74 | 74,-0.9947,-0.995405,1.2e-05 75 | 75,-0.9992,-0.999069,1e-06 76 | 76,-0.9997,-0.99836,2e-06 77 | 77,-0.9962,-0.994719,1.1e-05 78 | 78,-0.9888,-0.991212,2.4e-05 79 | 79,-0.9774,-0.980216,5.5e-05 80 | 80,-0.9621,-0.965319,9.4e-05 81 | 81,-0.9429,-0.946673,0.000143 82 | 82,-0.9201,-0.9242,0.000201 83 | 83,-0.8935,-0.898216,0.000266 84 | 84,-0.8634,-0.868622,0.000337 85 | 85,-0.8298,-0.835539,0.000414 86 | 86,-0.793,-0.79914,0.000496 87 | 87,-0.7529,-0.759612,0.000579 88 | 88,-0.7099,-0.717,0.000665 89 | 89,-0.664,-0.671525,0.000752 90 | 90,-0.6155,-0.623389,0.000838 91 | 91,-0.5646,-0.57277,0.000919 92 | 92,-0.5113,-0.519967,0.000997 93 | 93,-0.4561,-0.518584,0.003085 94 | 94,-0.399,-0.540266,0.004196 95 | 95,-0.3404,-0.547846,0.003857 96 | 96,-0.2804,-0.5482,0.00388 97 | 97,-0.2192,-0.547848,0.003924 98 | 98,-0.1572,-0.547501,0.003958 99 | 99,-0.0946,-0.547225,0.003982 100 | 100,-0.0316,-0.54701,0.004 101 | 101,0.0316,-0.546839,0.004014 102 | 102,0.0946,0.194217,0.295577 103 | 103,0.1572,0.589039,0.000431 104 | 104,0.2192,0.588848,0.000431 105 | 105,0.2804,0.588577,0.00043 106 | 106,0.3404,0.588169,0.000429 107 | 107,0.399,0.587486,0.000427 108 | 108,0.4561,0.586129,0.000421 109 | 109,0.5113,0.582222,0.000387 110 | 110,0.5646,0.601238,0.000272 111 | 111,0.6155,0.623189,0.000837 112 | 112,0.664,0.671359,0.000751 113 | 113,0.7099,0.716759,0.000666 114 | 114,0.7529,0.759339,0.000579 115 | 115,0.793,0.798862,0.000496 116 | 116,0.8298,0.835246,0.000414 117 | 117,0.8634,0.868289,0.000338 118 | 118,0.8935,0.897839,0.000265 119 | 119,0.9201,0.923816,0.000201 120 | 120,0.9429,0.946147,0.000143 121 | 121,0.9621,0.964629,9.5e-05 122 | 122,0.9774,0.979264,5.6e-05 123 | 123,0.9888,0.990008,2.7e-05 124 | 124,0.9962,0.996725,8e-06 125 | 125,0.9997,0.999319,0.0 126 | 126,0.9992,0.997455,4e-06 127 | 127,0.9947,0.995097,1.1e-05 128 | 128,0.9863,0.988836,3.1e-05 129 | 129,0.9739,0.976836,6.4e-05 130 | 130,0.9577,0.960974,0.000106 131 | 131,0.9376,0.941397,0.000158 132 | 132,0.9138,0.91812,0.000216 133 | 133,0.8863,0.891166,0.000283 134 | 134,0.8553,0.860642,0.000356 135 | 135,0.8209,0.826755,0.000433 136 | 136,0.7832,0.789547,0.000517 137 | 137,0.7424,0.749166,0.000601 138 | 138,0.6987,0.705874,0.000686 139 | 139,0.6521,0.659773,0.000774 140 | 140,0.603,0.61095,0.000858 141 | 141,0.5515,0.559788,0.000939 142 | 142,0.4977,0.506413,0.001018 143 | 143,0.442,0.505058,0.00315 144 | 144,0.3845,0.548064,0.00231 145 | 145,0.3255,0.585841,0.000418 146 | 146,0.2652,0.587102,0.000425 147 | 147,0.2038,0.587893,0.000429 148 | 148,0.1416,0.588382,0.00043 149 | 149,0.0789,0.588706,0.000431 150 | 150,0.0158,0.588933,0.000431 151 | 151,-0.0473,0.589099,0.000431 152 | 152,-0.1103,-0.209209,0.294684 153 | 153,-0.1728,-0.547415,0.003985 154 | 154,-0.2346,-0.547786,0.00396 155 | 155,-0.2955,-0.548324,0.003924 156 | 156,-0.3552,-0.549165,0.003868 157 | 157,-0.4135,-0.550631,0.003765 158 | 158,-0.4701,-0.5537,0.003537 159 | 159,-0.5249,-0.594981,0.00038 160 | 160,-0.5775,-0.588153,0.002962 161 | 161,-0.6279,-0.635479,0.000816 162 | 162,-0.6758,-0.68291,0.000731 163 | 163,-0.7209,-0.727701,0.000642 164 | 164,-0.7632,-0.769513,0.000559 165 | 165,-0.8025,-0.808248,0.000475 166 | 166,-0.8385,-0.843829,0.000394 167 | 167,-0.8712,-0.876014,0.000319 168 | 168,-0.9005,-0.904668,0.000249 169 | 169,-0.9261,-0.929765,0.000186 170 | 170,-0.9481,-0.951122,0.000131 171 | 171,-0.9663,-0.968636,8.4e-05 172 | 172,-0.9806,-0.982315,4.8e-05 173 | 173,-0.991,-0.992047,2.1e-05 174 | 174,-0.9975,-0.997737,5e-06 175 | 175,-1.0,-0.999271,0.0 176 | 176,-0.9985,-0.996277,6e-06 177 | 177,-0.993,-0.99452,1.4e-05 178 | 178,-0.9836,-0.986289,3.8e-05 179 | 179,-0.9702,-0.973244,7.3e-05 180 | 180,-0.953,-0.956401,0.000118 181 | 181,-0.932,-0.935912,0.00017 182 | 182,-0.9072,-0.911733,0.000232 183 | 183,-0.8789,-0.883822,0.0003 184 | 184,-0.847,-0.852484,0.000376 185 | 185,-0.8118,-0.817756,0.000453 186 | 186,-0.7733,-0.779751,0.000539 187 | 187,-0.7318,-0.738629,0.000622 188 | 188,-0.6873,-0.694615,0.00071 189 | 189,-0.6401,-0.647796,0.000794 190 | 190,-0.5903,-0.598432,0.000877 191 | 191,-0.5382,-0.546609,0.000961 192 | 192,-0.484,-0.492644,0.001035 193 | 193,-0.4278,-0.491455,0.003218 194 | 194,-0.3699,-0.546081,0.00393 195 | 195,-0.3105,-0.548236,0.003859 196 | 196,-0.2499,-0.548035,0.003903 197 | 197,-0.1883,-0.547667,0.003943 198 | 198,-0.126,-0.547355,0.003971 199 | 199,-0.0631,-0.547111,0.003992 200 | 200,0.0,-0.546919,0.004008 201 | 201,,-0.546767,0.00402 202 | --------------------------------------------------------------------------------