Example #1
0
def Create_date_list(config):
    
    dwps = util.create_list_period(config["train_start"], config["train_end"], False)
    dwp_test = util.create_list_period(config["backtest_start"], config["backtest_end"], False)
    dwp, dtp = util.get_all_combination_date(dwps, 12) 
    
    return dwp_test,dwp,dtp
Example #2
0
    def setUpClass(cls) -> None:

        # Generating data / params
        cls.list_period = utils.create_list_period(201601, 202012)
        cls.horizon = 6
        cls.years_to_add = 3
        cls.combination_date = utils.get_all_combination_date(
            cls.list_period, cls.horizon)

        # Reading test data for il
        cls.raw_master_il = pd.read_csv(os.path.join(DIR_TEST_DATA,
                                                     'raw_master_il.csv'),
                                        parse_dates=['date'])
        cls.all_sales_il = pd.read_pickle(
            os.path.join(DIR_TEST_DATA, 'test_all_sales_il.pkl'))
        cls.forecast_il = pd.read_pickle(
            os.path.join(DIR_TEST_DATA, 'test_extend_forecast_il.pkl'))
        cls.pre_forecast_correction_il = pd.read_pickle(
            os.path.join(DIR_TEST_DATA,
                         'test_apply_forecast_correction_il.pkl'))
        cls.long_il = pd.read_pickle(
            os.path.join(DIR_TEST_DATA, 'test_reformat_il.pkl'))

        # Reading test data for dc
        cls.raw_master_dc = pd.read_pickle(
            os.path.join(DIR_TEST_DATA, 'raw_master_dc.pkl'))
        cls.all_sales_dc = pd.read_pickle(
            os.path.join(DIR_TEST_DATA, 'test_all_sales_dc.pkl'))
        cls.forecast_dc = pd.read_pickle(
            os.path.join(DIR_TEST_DATA, 'test_extend_forecast_dc.pkl'))
        cls.pre_forecast_correction_dc = pd.read_pickle(
            os.path.join(DIR_TEST_DATA,
                         'test_apply_forecast_correction_dc.pkl'))
        cls.long_dc = pd.read_pickle(
            os.path.join(DIR_TEST_DATA, 'test_reformat_dc.pkl'))
Example #3
0
            feature_importance_df_final.to_csv('./data/feature_importance_all_df.csv')

        return resfinal


if __name__ == '__main__':

    import src.forecaster.utilitaires as util
    import src.forecaster.diagnostic as diagnostic

    raw_master = pd.read_csv('./data/raw/raw_master_dc_20191126.csv')
    mod = Modeldc(raw_master)
    max_date_available = mod.all_sales.calendar_yearmonth.max()
    filter_date = min(201909, max_date_available)
    dwps = util.create_list_period(201701, filter_date, False)
    dwp, dtp = util.get_all_combination_date(dwps, 12)

    print("creating the main table")
    table_all_features = mod.create_all_features(dwp, dtp)
    # table_all_features = pd.read_csv("data/table_all_features_dc.csv")

    dwp_test = util.create_list_period(201804, 201909, False)
    #
    # model_config = ModelConfig(
    #     model_name="GradientBoostingRegressor",
    #     model_params={
    #         'standard_scaling': False,
    #         'pca': 0,
    #         'loss': 'huber',
    #         'learning_rate': 0.01,
    #         'n_estimators': 500,