python - Error in Threading SARIMAX model -


i using threading library first time inorder speed training time of sarimax model. code keeps failing following error

bad direction in line search; refresh lbfgs memory , restart iteration. problem unconstrained. problem unconstrained. problem unconstrained. 

following code:

import numpy np import pandas pd statsmodels.tsa.arima_model import arima import statsmodels.tsa.api smt threading import thread  def process_id(ndata):    train = ndata[0:-7]    test = ndata[len(train):]    try:        model = smt.sarimax(train.asfreq(freq='1d'), exog=none, order=(0, 1, 1), seasonal_order=(0, 1, 1, 7)).fit()        pred = model.get_forecast(len(test))        fcst = pred.predicted_mean        fcst.index = test.index        mapelist = []        in range(len(fcst)):             mapelist.insert(i, (np.absolute(test[i] - fcst[i])) / test[i])        mape = np.mean(mapelist) * 100        print(mape)     except:        mape = 0        pass return mape  def process_range(ndata, store=none):    if store none:       store = {}    id in ndata:       store[id] = process_id(ndata[id])    return store   def threaded_process_range(nthreads,ndata):     store = {}     threads = []     # create threads     k = 0     tk = ndata.columns     in range(nthreads):         dk  = tk[k:len(tk)/nthreads+k]         k = k+len(tk)/nthreads         t = thread(target=process_range, args=(ndata[dk],store))         threads.append(t)     [ t.start() t in threads ]     [ t.join() t in threads ]     return store  outdata = threaded_process_range(4,ndata) 

few things mention:

  • data daily stock time series in dataframe
  • threading works arima model
  • sarimax model works when done in loop

any insights highly appreciated thanks!


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -