Comments (5)
Hey @Timuchin. That seems to be due to the default method ('CSS'
) of the arima
function, by setting method='CSS-ML'
(the default of statsforecast.models.ARIMA
) I get the same result as in statsmodels
.
The warnings seem to be coming from the suggestions of the optimization algorithm, which sometimes suggests values that produce Inf
in the objective function. I think we can make that return a big float instead.
from statsforecast.
Hey @Timuchin, thanks for the excellent report. Are you still getting this error? I get it as a warning, i.e. RuntimeWarning: invalid value encountered in subtract df = fun(x) - f0
from statsforecast.
This issue has been automatically closed because it has been awaiting a response for too long. When you have time to to work with the maintainers to resolve this issue, please post a new comment and it will be re-opened. If the issue has been locked for editing by the time you return to it, please open a new issue and reference this one.
from statsforecast.
@jmoralez Hello!
After updating statsforecast to 1.7.3 it stopped getting error. But yeah, it throws a warning. I guess the main reason that it cannot converge to stable solution.
RuntimeWarning: invalid value encountered in subtract df = fun(x) - f0
UserWarning: possible convergence problem: minimize gave code 2]
It does not seem as a big problem, though quite interesting that MA(1) from statsmodels does not get such error. I guess it successfully converges. As a result coefficient for MA(1) is different. And, what's more important, it calculates AIC criteria. This can can be important further for AutoARIMA.
param | statsforecast | statsmodels tsa | statsmodels statespace |
---|---|---|---|
MA | 0.911 | 0.975 | 0.975 |
intercept | 91.29 | 91.71 | 91.71 |
AIC | nan | 7561.34 | 7561.34 |
from statsforecast.arima import arima
import numpy as np
import statsmodels.api as sm
np.random.seed(1234)
SIZE = 1_000
LOC = 1
SCALE = 1
eps = []
for i in range(SIZE):
if i == 0:
eps.append(np.random.normal(loc = LOC, scale = SCALE, size = 1)[0])
elif (i > 0) & (i <= SIZE):
eps.append(LOC + 0.99 * eps[i-1] + np.random.normal(loc = np.log(LOC), scale = np.sqrt(SCALE), size = 1)[0])
eps = np.array(eps)
ma_nixtla = arima(x = eps, order = (0, 0, 1))
ma_stats = sm.tsa.ARIMA(eps, order = (0, 0, 1)).fit()
ma_stats_ss = sm.tsa.statespace.SARIMAX(eps, order = (0, 0, 1), trend='c').fit()
print(f'''
MA coef are statsforecast:{ma_nixtla.get('coef').get('ma1')}, statsmodels tsa: {ma_stats.params[1]}, statsmodels statespace: {ma_stats_ss.params[1]}, \n
Intercept coef are statsforecast:{ma_nixtla.get('coef').get('intercept')}, statsmodels tsa: {ma_stats.params[0]}, statsmodels statespace: {ma_stats_ss.params[0]}, \n
AIC criteria are statsforecast:{ma_nixtla.get('aic')}, statsmodels tsa: {ma_stats.aic}, statsmodels statespace: {ma_stats_ss.aic}
''')
Dependencies
statsmodels==0.14.1
statsforecast==1.7.3
numpy==1.26.3
from statsforecast.
I am also seeing a ton of RuntimeWarning: invalid value encountered in subtract
at df = fun(x) - f0
from statsforecast.
Related Issues (20)
- Missing Amazon Forecast results in the experiment docs HOT 4
- AttributeError: 'bool' object has no attribute 'n_windows' when adding confidence level HOT 4
- SeasonalNaive forecasts are not as expected; expected lag 12 but forecast is rounded and slightly off HOT 2
- Getting error when training AutoCES on covid deaths dataset from gluonts HOT 3
- StatsForecast: No model able to be fitted HOT 1
- Can statsforecast detect season_length automatically? HOT 2
- ValueError: xreg is rank deficient HOT 4
- Models: documented public methods/attributes to extract best parameters for Auto* models HOT 3
- Auto_Ces "Exception: no model able to be fitted" HOT 4
- Problem getting fitted values using cross validation with a spark dataframe HOT 2
- Problem using fit and predict or fit_predict using a spark dataframe HOT 1
- Model evaluation documentation asserts that datasetsforecast is required, but it isn't HOT 2
- Deprecate references to custom `evaluate_performace` function in favor of `utilsforecast.evaluation.evaluate`? HOT 2
- Should `forecast_fitted_values` also work for fitted models in addition to when forecast(fitted=True) is called? HOT 1
- Dead links for several pages in docs HOT 2
- MSTL can't use AutoETS as trend_forecaster HOT 1
- Can I use Exogenous features with AutoETS HOT 1
- statsforecast: prediction fails if more than one model uses fallbackheuristic HOT 2
- ARIMA fit asymmetrical var_coef for some parameters
- MSTL is very slow and not using all CPU cores at all HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from statsforecast.