'ValueError: Input contains NaN, infinity or a value too large for dtype('float64'). timeseries

DES_train = train.copy() DES_test = test.copy()

model_DES = Holt(DES_train['Sparkling'])

First we will define an empty dataframe to store our values from the loop

resultsDf_7 = pd.DataFrame({'Alpha Values':[],'Beta Values':[],'Train RMSE':[],'Test RMSE': []}) resultsDf_7

for i in np.arange(0.3,1.1,0.1): for j in np.arange(0.3,1.1,0.1): model_DES_alpha_i_j = model_DES.fit(smoothing_level=i,smoothing_trend=j,optimized=False,use_brute=True) DES_train['predict',i,j] = model_DES_alpha_i_j.fittedvalues DES_test['predict',i,j] = model_DES_alpha_i_j.forecast(steps=18)

    rmse_model6_train = metrics.mean_squared_error(DES_train['Sparkling'],DES_train['predict',i,j],squared=False)
    
    rmse_model6_test = metrics.mean_squared_error(DES_test['Sparkling'],DES_test['predict',i,j],squared=False)
    
    resultsDf_7 = resultsDf_7.append({'Alpha Values':i,'Beta Values':j,'Train RMSE':rmse_model6_train
                                      ,'Test RMSE':rmse_model6_test}, ignore_index=True)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source