<commit_before>import pandas as pd
import numpy as np
import pyaf.ForecastEngine as autof
import pyaf.Bench.TS_datasets as tsds


import warnings


def test_random_exogenous(n , nbex):

    with warnings.catch_warnings():
        warnings.simplefilter("error")

        b1 = tsds.generate_random_TS(N = 600 , FREQ = 'D', seed = 0, trendtype = "constant", cycle_length = 12, transform = "", sigma = 0.0, exog_count = 2000);
        df = b1.mPastData

        # this script works on mysql with N = 600, exog_count = 20 when thread_stack = 1920K in
        # /etc/mysql/mysql.conf.d/mysqld.cnf

        # #df.to_csv("outputs/rand_exogenous.csv")

        print(b1)
        H = b1.mHorizon[b1.mSignalVar];
    
        N = df.shape[0];
        df1 = df.head(n).copy();
        lEngine = autof.cForecastEngine()
        # lEngine.mOptions.mEnableSeasonals = False;
        # lEngine.mOptions.mDebugCycles = False;
        lEngine.mOptions.mDebugProfile = True;
        lEngine
        lExogenousData = (b1.mExogenousDataFrame , b1.mExogenousVariables[0:nbex]) 
        lEngine.train(df1 , b1.mTimeVar , b1.mSignalVar, H, lExogenousData);
        lEngine.getModelInfo();
        lEngine.standardPlots(name = "outputs/my_exog_" + str(nbex) + "_" + str(n));
        lEngine.mSignalDecomposition.mBestModel.mTimeInfo.mResolution
        
        dfapp_in = df1.copy();
        dfapp_in.tail()


        dfapp_out = lEngine.forecast(dfapp_in, H);
        dfapp_out.tail(2 * H)
        print("Forecast Columns " , dfapp_out.columns);
        Forecast_DF = dfapp_out[[b1.mTimeVar , b1.mSignalVar, b1.mSignalVar + '_Forecast']]
        print(Forecast_DF.info())
        print("Forecasts\n" , Forecast_DF.tail(H).values);
        
        print("\n\n<ModelInfo>")
        print(lEngine.to_json());
        print("</ModelInfo>\n\n")
        print("\n\n<Forecast>")
        print(Forecast_DF.tail(2*H).to_json(date_format='iso'))
        print("</Forecast>\n\n")<commit_msg>Make the Modeling Scale when the Number of Exogenous Variables Increases #198. Improved time series generation with large number of exog vars.<commit_after>import pandas as pd
import numpy as np
import pyaf.ForecastEngine as autof
import pyaf.Bench.TS_datasets as tsds


import warnings


def test_random_exogenous(n , nbex):

    with warnings.catch_warnings():
        # warnings.simplefilter("error")

        b1 = tsds.generate_random_TS(N = 600 , FREQ = 'D', seed = 0, trendtype = "LinearTrend", cycle_length = 12, transform = "", sigma = 0.0, exog_count = 2000, ar_order = 12);
        df = b1.mPastData
        print(df.head())
        print(b1)
        H = b1.mHorizon[b1.mSignalVar];
    
        N = df.shape[0];
        df1 = df.head(n).copy();
        lEngine = autof.cForecastEngine()
        # lEngine.mOptions.mEnableSeasonals = False;
        # lEngine.mOptions.mDebugCycles = False;
        lEngine.mOptions.mDebugProfile = True;
        lEngine.mOptions.mNbCores = 1
        lEngine.mOptions.set_active_autoregressions(['ARX']);
        lEngine
        lExogenousData = (b1.mExogenousDataFrame , b1.mExogenousVariables[0:nbex]) 
        lExogenousData[0].info()
        df1.info()
        lEngine.train(df1 , b1.mTimeVar , b1.mSignalVar, H, lExogenousData);
        lEngine.getModelInfo();
        lEngine.standardPlots(name = "outputs/my_exog_" + str(nbex) + "_" + str(n));
        lEngine.mSignalDecomposition.mBestModel.mTimeInfo.mResolution
        
        dfapp_in = df1.copy();
        dfapp_in.tail()


        dfapp_out = lEngine.forecast(dfapp_in, H);
        dfapp_out.tail(2 * H)
        print("Forecast Columns " , dfapp_out.columns);
        Forecast_DF = dfapp_out[[b1.mTimeVar , b1.mSignalVar, b1.mSignalVar + '_Forecast']]
        print(Forecast_DF.info())
        print("Forecasts\n" , Forecast_DF.tail(H).values);
        
        print("\n\n<ModelInfo>")
        print(lEngine.to_json());
        print("</ModelInfo>\n\n")
        print("\n\n<Forecast>")
        print(Forecast_DF.tail(2*H).to_json(date_format='iso'))
        print("</Forecast>\n\n")
{'fraction_non_alphanumeric': 0.13021991598715096, 'fraction_numerical': 0.01952063256733383, 'mean_word_length': 2.6968036529680366, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4422704', 'n_tokens_mistral': 1473, 'n_tokens_neox': 1393, 'n_words': 238}