Exemple #1
0
    def test_smap(self):
        #--------------------------------------------------------
        # circle test embedded = True
        #--------------------------------------------------------
        print("--- S-map circle embedded = True ---")
        dfc = EDM.ReadDataFrame("", self.Files["circle.csv"])

        # Passing Pandas DataFrame input to Smap rather than path/file
        SM = EDM.SMap("", "", dfc, "", "", "1 100", "101 198", 2, 1, 0, 1, 4,
                      0, "x y", "x", "", "", True, False, True, False)

        df = SM['predictions']

        dfv = EDM.ReadDataFrame("", self.Files["Smap_circle_pyEDM.csv"])

        S1 = dfv.get('Prediction_t(+1)')
        S2 = round(df.get('Predictions'), 4)
        self.assertTrue(S1.equals(S2))
Exemple #2
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)))
Exemple #3
0
    def test_multiview( self ):
        print ( "--- Multiview ---" )
        M = EDM.Multiview( "", self.Files[ "block_3sp.csv" ], None, "./", "", 
                           "1 100", "101 198", 0, 3, 1, 0, -1,
                           "x_t y_t z_t", "x_t", 0, 0, True, False, 4 )

        df_pred  = M['Predictions']
        df_combo = round( M['View'  ], 4 )
        
        # cppEDM and devPDM outputs are rounded to os.precision( 4 );
        dfv = EDM.ReadDataFrame( "", self.Files[ "Multiview_pred_valid.csv" ],
                                 noTime = True )
        dfc = EDM.ReadDataFrame( "", self.Files[ "Multiview_combos_valid.csv" ],
                                 noTime = True )

        # Validate predictions
        M1 = dfv.get('Predictions')
        M2 = round( df_pred.get('Predictions'), 4 ) 
        self.assertTrue( M1.equals( M2 ) )

        # Validate combinations
        self.assertTrue( dfc.equals( df_combo ) )
Exemple #4
0
    def test_simplex(self):
        #--------------------------------------------------------
        # embedded = False
        #--------------------------------------------------------
        print("--- Simplex embedded = False ---")
        df = EDM.Simplex("", self.Files["block_3sp.csv"], None, "./", "",
                         "1 100", "101 195", 3, 1, 0, 1, 0, "x_t", "x_t",
                         False, False, True, False)

        # cppEDM and devEDM outputs are rounded to os.precision( 4 );
        dfv = EDM.ReadDataFrame("", self.Files["Smplx_E3_block_3sp_pyEDM.csv"])

        S1 = dfv.get('Prediction_t(+1)')[1:95]  # Skip row 0 Nan
        S2 = round(df.get('Predictions'), 4)[1:95]  # Skip row 0 Nan
        self.assertTrue(S1.equals(S2))
Exemple #5
0
    def test_simplex2(self):
        #--------------------------------------------------------
        # embedded = True
        #--------------------------------------------------------
        print("--- Simplex embedded = True ---")
        df = EDM.Simplex("", self.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, False)

        # This has been rounded to os.precision( 4 );
        dfv = EDM.ReadDataFrame("",
                                self.Files["Smplx_embd_block_3sp_pyEDM.csv"])

        S1 = dfv.get('Prediction_t(+1)')[1:98]  # Skip row 0 Nan
        S2 = round(df.get('Predictions'), 4)[1:98]  # Skip row 0 Nan
        self.assertTrue(S1.equals(S2))
Exemple #6
0
    def test_smap2(self):
        #--------------------------------------------------------
        # block_3sp embedded = True
        #--------------------------------------------------------
        print("--- S-map block_3sp embedded = True ---")
        SM = EDM.SMap("", self.Files["block_3sp.csv"], None, "./", "", "1 99",
                      "100 198", 3, 1, 0, 1, 2, 0, "x_t y_t z_t", "x_t", "",
                      "", True, False, True, False)

        df = SM['predictions']

        dfv = EDM.ReadDataFrame("",
                                self.Files["Smap_embd_block_3sp_pyEDM.csv"])

        S1 = dfv.get('Prediction_t(+1)')
        S2 = round(df.get('Predictions'), 4)
        self.assertTrue(S1.equals(S2))