Example #1
0
def main():
    # read_csv_by_Pandas(filename)
    # read_sample_data(filename2)

    filename = 'data/output_populations_10-5000.csv'
    filename2 = 'data/output_pops_E.csv'
    st = 1000
    ed = 2000

    file = filename
    df = (pd.read_csv(file, sep=",", header=0))[st:ed]

    print(df.head(10))

    df[['1', '2', '3', '4']].plot()
    plt.show()

    # ax = plt.gca()

    # df.plot(x='iteration', y='1', kind='line', ax=ax)
    # df.plot(x='iteration', y='2', kind='line', ax=ax)
    # df.plot(x='iteration', y='3', kind='line', ax=ax)
    # df.plot(x='iteration', y='4', kind='line', ax=ax)
    # df.plot(x='iteration', y='5', kind='line', ax=ax)
    # plt.show()

    pyEDM.CCM(dataFrame=df,
              E=3,
              columns="1",
              target="2",
              libSizes="10 70 10",
              showPlot=False,
              sample=100)
Example #2
0
def main():
    '''EDM package examples.
       df denotes a Pandas DataFrame.
       S and M denote dictionaries of Pandas DataFrames'''

    dataFiles = [ "TentMap_rEDM.csv",
                  "TentMapNoise_rEDM.csv",
                  "circle.csv",
                  "block_3sp.csv",
                  "sardine_anchovy_sst.csv" ]
    
    # Create map of module dataFiles pathnames in Files
    Files = {}

    for file in dataFiles:
        filename = "data/" + file
        if pkg_resources.resource_exists( EDM.__name__, filename ):
            Files[ file ] = \
            pkg_resources.resource_filename( EDM.__name__, filename )
        else :
            raise Exception( "examples.py: Failed to find data file " + \
                             file + " in EDM package" )

    # Note the path argument is empty "", file path is in Files{}
    df = EDM.EmbedDimension( "", Files[ "TentMap_rEDM.csv" ], None, "./", "",
                             "1 100", "201 500", 10, 1, 1,
                             "TentMap", "", False, False, 4 )
    
    df = EDM.PredictInterval( "", Files[ "TentMap_rEDM.csv" ], None, "./", "",
                              "1 100", "201 500", 10, 2, 1,
                              "TentMap", "", False, False, 4 );

    df = EDM.PredictNonlinear( "", Files[ "TentMapNoise_rEDM.csv" ], None,
                               "./", "", "1 100", "201 500", "", 2, 1, 0, 1,
                               "TentMap", "", False, False, 4 )
    
    # Tent map simplex : specify multivariable columns embedded = True
    df = EDM.Simplex( "", Files[ "block_3sp.csv" ], None, "./", "", 
                      "1 99", "100 198", 3, 1, 0, 1, 0,
                      "x_t y_t z_t", "x_t", True, False, True, True )

    # Tent map simplex : Embed column x_t to E=3, embedded = False
    df = EDM.Simplex( "", Files[ "block_3sp.csv" ], None, "./", "", 
                      "1 99", "100 195", 3, 1, 0, 1, 0,
                      "x_t", "x_t", False, False, True, True )

    M = EDM.Multiview( "", Files[ "block_3sp.csv" ], None, "./", "", 
                       "1 100", "101 198", 3, 1, 0, 1,
                       "x_t y_t z_t", "x_t", 0, 0, False, 4, True )

    # S-map circle : specify multivariable columns embedded = True
    S = EDM.SMap( "", Files[ "circle.csv" ], None, "./", "", 
                  "1 100", "101 198", 2, 1, 0, 1, 4, 0,
                  "x y", "x", "", "", True, False, True, True )
    
    df = EDM.CCM( "", Files[ "sardine_anchovy_sst.csv" ], None, "./", "", 
                  3, 0, 0, 1, "anchovy", "np_sst",
                  "10 70 10", 100, True, False, 0, True, True )
Example #3
0
    def test_ccm(self):
        print("--- CCM ---")
        df = EDM.CCM("", self.Files["sardine_anchovy_sst.csv"], None, "./", "",
                     3, 0, 0, 1, "anchovy", "np_sst", "10 75 5", 1, False,
                     False, 0, True)

        dfv = EDM.ReadDataFrame("",
                                self.Files["CCM_anch_sst_cppEDM_valid.csv"],
                                noTime=True)

        self.assertTrue(dfv.equals(round(df, 4)))
Example #4
0
def main():
    '''EDM package examples.
       df denotes a Pandas DataFrame.
       S and M denote dictionaries of Pandas DataFrames'''

    dataFiles = [ "TentMap_rEDM.csv",
                  "TentMapNoise_rEDM.csv",
                  "circle.csv",
                  "block_3sp.csv",
                  "sardine_anchovy_sst.csv" ]
    
    # Create map of module dataFiles pathnames in Files
    Files = {}

    for file in dataFiles:
        filename = "data/" + file
        if pkg_resources.resource_exists( EDM.__name__, filename ):
            Files[ file ] = \
            pkg_resources.resource_filename( EDM.__name__, filename )
        else :
            raise Exception( "examples.py: Failed to find data file " + \
                             file + " in EDM package" )

    # Note the path argument is empty "", file path is in Files{}
    df = EDM.EmbedDimension( pathIn = "", dataFile = Files["TentMap_rEDM.csv"],
                             lib = "1 100", pred = "201 500", maxE = 10,
                             Tp = 1, tau = -1, exclusionRadius = 0,
                             columns = "TentMap", target = "TentMap",
                             validLib = [], numThreads = 4 )
    
    df = EDM.PredictInterval( pathIn = "", dataFile = Files["TentMap_rEDM.csv"],
                              lib = "1 100", pred = "201 500", maxTp = 10,
                              E = 2, tau = -1, exclusionRadius = 0,
                              columns = "TentMap", target = "TentMap",
                              validLib = [], numThreads = 4 );

    df = EDM.PredictNonlinear( pathIn = "",
                               dataFile = Files[ "TentMapNoise_rEDM.csv" ],
                               lib = "1 100", pred = "201 500", E = 2,
                               Tp = 1, knn = 0, tau = -1,
                               columns = "TentMap", target = "TentMap",
                               validLib = [], numThreads = 4 )
    
    # Tent map simplex : specify multivariable columns embedded = True
    S = EDM.Simplex( pathIn = "", dataFile = Files[ "block_3sp.csv" ],
                     lib = "1 99", pred = "100 198", E = 3, Tp = 1,
                     knn = 0, tau = -1, exclusionRadius = 0,
                     columns = "x_t y_t z_t", target = "x_t",
                     embedded = True, showPlot = True,
                     validLib = [], generateSteps = 0, parameterList = False )

    # Tent map simplex : Embed column x_t to E=3, embedded = False
    S = EDM.Simplex( pathIn = "", dataFile = Files[ "block_3sp.csv" ],
                     lib = "1 99", pred = "100 198", E = 3, Tp = 1,
                     knn = 0, tau = -1, exclusionRadius = 0,
                     columns = "x_t y_t z_t", target = "x_t",
                     embedded = False, showPlot = True,
                     validLib = [], generateSteps = 0, parameterList = False )

    M = EDM.Multiview( pathIn = "", dataFile = Files[ "block_3sp.csv" ],
                       lib = "1 100", pred = "101 198",
                       D = 0, E = 3, Tp = 1, knn = 0, tau = -1,
                       multiview = 0, exclusionRadius = 0,
                       columns = "x_t y_t z_t", target = "x_t",
                       trainLib = True, excludeTarget = False,
                       numThreads = 4, showPlot = True )

    # S-map circle : specify multivariable columns embedded = True
    S = EDM.SMap( pathIn = "", dataFile = Files[ "circle.csv" ], 
                  lib = "1 100", pred = "101 198",
                  E = 2, Tp = 1, knn = 0, tau = -1,
                  theta = 4, exclusionRadius = 0,
                  columns = "x y", target = "x",
                  solver = None, embedded = True,
                  validLib = [], generateSteps = 0, parameterList = False )
    
    CM = EDM.CCM( pathIn = "", dataFile = Files[ "sardine_anchovy_sst.csv" ],
                  E = 3, Tp = 0, knn = 0, tau = -1, exclusionRadius = 0,
                  columns = "anchovy", target = "np_sst",
                  libSizes = "10 70 10", sample = 100, random = True,
                  replacement = False, seed = 0, includeData = False,
                  parameterList = False, verbose = False, showPlot = True )