Exemplo n.º 1
0
    def test_export_load(self, tmpdir):
        data_loader = SF1Data(config['sf1_data_path'])
        tickers_df = data_loader.load_base_data(currency='USD',
                                                scalemarketcap=['5 - Large'])
        tickers = tickers_df['ticker'].unique().tolist()
        pipeline = self._create_pipeline()
        res = pipeline.fit(data_loader, tickers[:100])
        df = pipeline.execute(data_loader, tickers[:100])
        pipeline.export_core('{}/pipeline'.format(str(tmpdir)))
        #assert str(tmpdir) == 'efef'
        pipeline = BasePipeline.load('{}/pipeline.pickle'.format(str(tmpdir)))
        df1 = pipeline.execute(data_loader, tickers[:100])

        np.testing.assert_array_equal(df['y'].values, df1['y'].values)
    def test_export_load(self, data_loader, tmpdir):
        f1, target, model = self._create_base_components()
        pipeline = BasePipeline(feature=f1,
                                target=target,
                                model=model,
                                metric=median_absolute_relative_error,
                                out_name=None)
        res = pipeline.fit(data_loader, tickers)
        df = pipeline.execute(data_loader, tickers)
        pipeline.export_core('{}/pipeline'.format(str(tmpdir)))
        pipeline = BasePipeline.load('{}/pipeline.pickle'.format(str(tmpdir)))
        df1 = pipeline.execute(data_loader, tickers[:100])

        np.testing.assert_array_equal(df['y_0'].values, df1['y_0'].values)