Discussion:
[pystatsmodels] attributeerror: 'nonetype' object has no attribute 'predict' with ARMA model
garba moussa
2018-10-19 11:08:29 UTC
Permalink
Hi nice people

I use ARMA MODEL to forecast values but when i call predict method I have
this error : attributeerror: 'nonetype' object has no attribute 'predict'

for p in range(100):
64 for q in range(100):
65 try:
66 self._model = ARMA(ts_arma_model,
order=order).fit(full_output= False, transparams=False, disp=False)
67 except:
68 pass
69 # self._params = self._model.self._params
70 logger.debug('SELF MODEL %s',self._model)
71 # self._model = sm.tsa.ARMA(ts,
order=self._order).fit(method='mle', trend='nc')
72 logger.info("SELF MODEL : %s", self._model)
73 # start_date = ts_arma_model.index[-1] +
self._period
74 # end_date = start_date + (self._predict
-1)*self._period
75 # forecast =
self._model.predict(self._params.all, start_date.isoformat(),
end_date.isoformat())
76 # logger.debug(forecast)
77
78 start_date = ts_arma_model.index[-1] + self._period
79 # start_date = '2018-10-18 02:19:58.314000'
80 logger.debug('START DATE %s',start_date)
81 end_date = start_date + (self._predict -1)*self._period
82 # end_date = '2018-10-18 03:08:58.493000'
83 logger.debug('END DATE %s',end_date)
84 forecast = self._model.predict(start_date.isoformat(),
end_date.isoformat())
I have this error attributeerror: 'nonetype' object has no attribute
'predict

Thanks for your help
j***@gmail.com
2018-10-19 11:59:09 UTC
Permalink
Post by garba moussa
Hi nice people
I use ARMA MODEL to forecast values but when i call predict method I have
this error : attributeerror: 'nonetype' object has no attribute 'predict'
66 self._model = ARMA(ts_arma_model,
order=order).fit(full_output= False, transparams=False, disp=False)
I guess this raises an exception, and then self._model is not defined.
Try without the try... except to see if there is a problem.

AFAIR, full_output=False is not allowed in some of the optimizers.

Josef
Post by garba moussa
68 pass
69 # self._params = self._model.self._params
70 logger.debug('SELF MODEL %s',self._model)
71 # self._model = sm.tsa.ARMA(ts,
order=self._order).fit(method='mle', trend='nc')
72 logger.info("SELF MODEL : %s", self._model)
73 # start_date = ts_arma_model.index[-1] +
self._period
74 # end_date = start_date + (self._predict
-1)*self._period
75 # forecast =
self._model.predict(self._params.all, start_date.isoformat(),
end_date.isoformat())
76 # logger.debug(forecast)
77
78 start_date = ts_arma_model.index[-1] + self._period
79 # start_date = '2018-10-18 02:19:58.314000'
80 logger.debug('START DATE %s',start_date)
81 end_date = start_date + (self._predict -1)*self._period
82 # end_date = '2018-10-18 03:08:58.493000'
83 logger.debug('END DATE %s',end_date)
84 forecast = self._model.predict(start_date.isoformat(),
end_date.isoformat())
I have this error attributeerror: 'nonetype' object has no attribute
'predict
Thanks for your help
garba moussa
2018-10-19 12:53:05 UTC
Permalink
when I do what you say me josef I have this error :
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" self.handler.end_batch(request.end)"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File \"/tmp/kapacitor_udf/kapacitor/udf/agent/py/arma_model.py\",
line 170, in end_batch"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" forecast = self._state.arma_model()"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File \"/tmp/kapacitor_udf/kapacitor/udf/agent/py/arma_model.py\",
line 91, in arma_model"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" forecast = self._model.predict(start_date.isoformat(),
end_date.isoformat())"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/base/wrapper.py\",
line 95, in wrapper"
ts=2018-10-19T14:52:04.263+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" obj = data.wrap_output(func(results, *args, **kwargs), how)"
ts=2018-10-19T14:52:04.263+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 1506, in predict"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" return self.model.predict(self.params, start, end, exog, dynamic)"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 719, in predict"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" self._get_prediction_index(start, end, dynamic))"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 651, in _get_prediction_index"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" super(ARMA, self)._get_prediction_index(start, end, index))"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/base/tsa_model.py\",
line 479, in _get_prediction_index"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" raise KeyError('The `start` argument could not be matched to a'"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text="KeyError: 'The `start` argument could not be matched to a location
related to the index of the data.'"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text="2018-10-19 14:52:04,280 ERROR:root: error processing request of type
end: 'The `start` argument could not be matched to a location related to
the index of the data.'"
ts=2018-10-19T14:52:04.280+02:00 lvl=error msg="received error message"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 err="error processing request of type end: 'The `start`
argument could not be matched to a location related to the index of the
data.'"
Post by j***@gmail.com
Post by garba moussa
Hi nice people
I use ARMA MODEL to forecast values but when i call predict method I have
this error : attributeerror: 'nonetype' object has no attribute 'predict'
66 self._model = ARMA(ts_arma_model,
order=order).fit(full_output= False, transparams=False, disp=False)
I guess this raises an exception, and then self._model is not defined.
Try without the try... except to see if there is a problem.
AFAIR, full_output=False is not allowed in some of the optimizers.
Josef
Post by garba moussa
68 pass
69 # self._params = self._model.self._params
70 logger.debug('SELF MODEL %s',self._model)
71 # self._model = sm.tsa.ARMA(ts,
order=self._order).fit(method='mle', trend='nc')
72 logger.info("SELF MODEL : %s", self._model)
73 # start_date = ts_arma_model.index[-1] +
self._period
74 # end_date = start_date + (self._predict
-1)*self._period
75 # forecast =
self._model.predict(self._params.all, start_date.isoformat(),
end_date.isoformat())
76 # logger.debug(forecast)
77
78 start_date = ts_arma_model.index[-1] + self._period
79 # start_date = '2018-10-18 02:19:58.314000'
80 logger.debug('START DATE %s',start_date)
81 end_date = start_date + (self._predict -1)*self._period
82 # end_date = '2018-10-18 03:08:58.493000'
83 logger.debug('END DATE %s',end_date)
84 forecast = self._model.predict(start_date.isoformat(),
end_date.isoformat())
I have this error attributeerror: 'nonetype' object has no attribute
'predict
Thanks for your help
j***@gmail.com
2018-10-19 13:05:27 UTC
Permalink
Post by garba moussa
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" self.handler.end_batch(request.end)"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File \"/tmp/kapacitor_udf/kapacitor/udf/agent/py/arma_model.py\",
line 170, in end_batch"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" forecast = self._state.arma_model()"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File \"/tmp/kapacitor_udf/kapacitor/udf/agent/py/arma_model.py\",
line 91, in arma_model"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" forecast = self._model.predict(start_date.isoformat(),
end_date.isoformat())"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/base/wrapper.py\",
line 95, in wrapper"
ts=2018-10-19T14:52:04.263+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" obj = data.wrap_output(func(results, *args, **kwargs), how)"
ts=2018-10-19T14:52:04.263+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 1506, in predict"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" return self.model.predict(self.params, start, end, exog, dynamic)"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 719, in predict"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" self._get_prediction_index(start, end, dynamic))"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 651, in _get_prediction_index"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" super(ARMA, self)._get_prediction_index(start, end, index))"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/base/tsa_model.py\",
line 479, in _get_prediction_index"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" raise KeyError('The `start` argument could not be matched to a'"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text="KeyError: 'The `start` argument could not be matched to a location
related to the index of the data.'"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text="2018-10-19 14:52:04,280 ERROR:root: error processing request of type
end: 'The `start` argument could not be matched to a location related to
the index of the data.'"
ts=2018-10-19T14:52:04.280+02:00 lvl=error msg="received error message"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
'The `start` argument could not be matched to a location related to the
index of the data.'"
That's a different exception. Your definition of `start` doesn't match up
with the index that you used in the time series for the ARMA call.

It's better if you prepare a simple example first before hiding things
behind try except and the logger.

Josef
Post by garba moussa
Post by j***@gmail.com
Post by garba moussa
Hi nice people
I use ARMA MODEL to forecast values but when i call predict method I
have this error : attributeerror: 'nonetype' object has no attribute
'predict'
66 self._model = ARMA(ts_arma_model,
order=order).fit(full_output= False, transparams=False, disp=False)
I guess this raises an exception, and then self._model is not defined.
Try without the try... except to see if there is a problem.
AFAIR, full_output=False is not allowed in some of the optimizers.
Josef
Post by garba moussa
68 pass
69 # self._params = self._model.self._params
70 logger.debug('SELF MODEL %s',self._model)
71 # self._model = sm.tsa.ARMA(ts,
order=self._order).fit(method='mle', trend='nc')
72 logger.info("SELF MODEL : %s", self._model)
73 # start_date = ts_arma_model.index[-1] +
self._period
74 # end_date = start_date + (self._predict
-1)*self._period
75 # forecast =
self._model.predict(self._params.all, start_date.isoformat(),
end_date.isoformat())
76 # logger.debug(forecast)
77
78 start_date = ts_arma_model.index[-1] + self._period
79 # start_date = '2018-10-18 02:19:58.314000'
80 logger.debug('START DATE %s',start_date)
81 end_date = start_date + (self._predict
-1)*self._period
82 # end_date = '2018-10-18 03:08:58.493000'
83 logger.debug('END DATE %s',end_date)
84 forecast =
self._model.predict(start_date.isoformat(), end_date.isoformat())
I have this error attributeerror: 'nonetype' object has no attribute
'predict
Thanks for your help
garba moussa
2018-10-19 13:06:11 UTC
Permalink
@josef I have this error now : 'The `start` argument could not be matched
to a location related to the index of the data.'"

Thanks
Post by garba moussa
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" self.handler.end_batch(request.end)"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File \"/tmp/kapacitor_udf/kapacitor/udf/agent/py/arma_model.py\",
line 170, in end_batch"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" forecast = self._state.arma_model()"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File \"/tmp/kapacitor_udf/kapacitor/udf/agent/py/arma_model.py\",
line 91, in arma_model"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" forecast = self._model.predict(start_date.isoformat(),
end_date.isoformat())"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/base/wrapper.py\",
line 95, in wrapper"
ts=2018-10-19T14:52:04.263+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" obj = data.wrap_output(func(results, *args, **kwargs), how)"
ts=2018-10-19T14:52:04.263+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 1506, in predict"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" return self.model.predict(self.params, start, end, exog, dynamic)"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 719, in predict"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" self._get_prediction_index(start, end, dynamic))"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 651, in _get_prediction_index"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" super(ARMA, self)._get_prediction_index(start, end, index))"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/base/tsa_model.py\",
line 479, in _get_prediction_index"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" raise KeyError('The `start` argument could not be matched to a'"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text="KeyError: 'The `start` argument could not be matched to a location
related to the index of the data.'"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text="2018-10-19 14:52:04,280 ERROR:root: error processing request of type
end: 'The `start` argument could not be matched to a location related to
the index of the data.'"
ts=2018-10-19T14:52:04.280+02:00 lvl=error msg="received error message"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 err="error processing request of type end: 'The `start`
argument could not be matched to a location related to the index of the
data.'"
Post by j***@gmail.com
Post by garba moussa
Hi nice people
I use ARMA MODEL to forecast values but when i call predict method I
have this error : attributeerror: 'nonetype' object has no attribute
'predict'
66 self._model = ARMA(ts_arma_model,
order=order).fit(full_output= False, transparams=False, disp=False)
I guess this raises an exception, and then self._model is not defined.
Try without the try... except to see if there is a problem.
AFAIR, full_output=False is not allowed in some of the optimizers.
Josef
Post by garba moussa
68 pass
69 # self._params = self._model.self._params
70 logger.debug('SELF MODEL %s',self._model)
71 # self._model = sm.tsa.ARMA(ts,
order=self._order).fit(method='mle', trend='nc')
72 logger.info("SELF MODEL : %s", self._model)
73 # start_date = ts_arma_model.index[-1] +
self._period
74 # end_date = start_date + (self._predict
-1)*self._period
75 # forecast =
self._model.predict(self._params.all, start_date.isoformat(),
end_date.isoformat())
76 # logger.debug(forecast)
77
78 start_date = ts_arma_model.index[-1] + self._period
79 # start_date = '2018-10-18 02:19:58.314000'
80 logger.debug('START DATE %s',start_date)
81 end_date = start_date + (self._predict
-1)*self._period
82 # end_date = '2018-10-18 03:08:58.493000'
83 logger.debug('END DATE %s',end_date)
84 forecast =
self._model.predict(start_date.isoformat(), end_date.isoformat())
I have this error attributeerror: 'nonetype' object has no attribute
'predict
Thanks for your help
garba moussa
2018-10-19 13:08:12 UTC
Permalink
thats is my ARMA data :
def get_series_arma_model(self):
45
46 return pd.DataFrame(data=self._values,
index=pd.to_datetime(self._dates))
Post by garba moussa
@josef I have this error now : 'The `start` argument could not be matched
to a location related to the index of the data.'"
Thanks
Post by garba moussa
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" self.handler.end_batch(request.end)"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File \"/tmp/kapacitor_udf/kapacitor/udf/agent/py/arma_model.py\",
line 170, in end_batch"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" forecast = self._state.arma_model()"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File \"/tmp/kapacitor_udf/kapacitor/udf/agent/py/arma_model.py\",
line 91, in arma_model"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" forecast = self._model.predict(start_date.isoformat(),
end_date.isoformat())"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/base/wrapper.py\",
line 95, in wrapper"
ts=2018-10-19T14:52:04.263+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" obj = data.wrap_output(func(results, *args, **kwargs), how)"
ts=2018-10-19T14:52:04.263+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 1506, in predict"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" return self.model.predict(self.params, start, end, exog, dynamic)"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 719, in predict"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" self._get_prediction_index(start, end, dynamic))"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 651, in _get_prediction_index"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" super(ARMA, self)._get_prediction_index(start, end, index))"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/base/tsa_model.py\",
line 479, in _get_prediction_index"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text=" raise KeyError('The `start` argument could not be matched to a'"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text="KeyError: 'The `start` argument could not be matched to a location
related to the index of the data.'"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_responsetime_absipevwp54 node=arma_model2
text="2018-10-19 14:52:04,280 ERROR:root: error processing request of type
end: 'The `start` argument could not be matched to a location related to
the index of the data.'"
ts=2018-10-19T14:52:04.280+02:00 lvl=error msg="received error message"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 err="error processing request of type end: 'The `start`
argument could not be matched to a location related to the index of the
data.'"
Post by j***@gmail.com
Post by garba moussa
Hi nice people
I use ARMA MODEL to forecast values but when i call predict method I
have this error : attributeerror: 'nonetype' object has no attribute
'predict'
66 self._model = ARMA(ts_arma_model,
order=order).fit(full_output= False, transparams=False, disp=False)
I guess this raises an exception, and then self._model is not defined.
Try without the try... except to see if there is a problem.
AFAIR, full_output=False is not allowed in some of the optimizers.
Josef
Post by garba moussa
68 pass
69 # self._params = self._model.self._params
70 logger.debug('SELF MODEL %s',self._model)
71 # self._model = sm.tsa.ARMA(ts,
order=self._order).fit(method='mle', trend='nc')
72 logger.info("SELF MODEL : %s", self._model)
73 # start_date = ts_arma_model.index[-1] +
self._period
74 # end_date = start_date + (self._predict
-1)*self._period
75 # forecast =
self._model.predict(self._params.all, start_date.isoformat(),
end_date.isoformat())
76 # logger.debug(forecast)
77
78 start_date = ts_arma_model.index[-1] + self._period
79 # start_date = '2018-10-18 02:19:58.314000'
80 logger.debug('START DATE %s',start_date)
81 end_date = start_date + (self._predict
-1)*self._period
82 # end_date = '2018-10-18 03:08:58.493000'
83 logger.debug('END DATE %s',end_date)
84 forecast =
self._model.predict(start_date.isoformat(), end_date.isoformat())
I have this error attributeerror: 'nonetype' object has no attribute
'predict
Thanks for your help
garba moussa
2018-10-19 13:20:20 UTC
Permalink
Look some UDF as ARMA model on others data I have the forecast values:
ts=2018-10-19T15:19:09.940+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
15:19:09,940 DEBUG:root: START DATE 2018-10-19 13:20:00"
ts=2018-10-19T15:19:09.940+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
15:19:09,940 DEBUG:root: END DATE 2018-10-19 14:55:00"
ts=2018-10-19T15:19:09.947+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
15:19:09,946 DEBUG:root: 2018-10-19 13:20:00 265.465398"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
13:25:00 267.129344"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
13:30:00 268.729245"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
13:35:00 270.266298"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
13:40:00 271.741687"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
13:45:00 273.156584"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
13:50:00 274.512151"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
13:55:00 275.809534"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
14:00:00 277.049870"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
14:05:00 278.234281"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
14:10:00 279.363878"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
14:15:00 280.439759"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
14:20:00 281.463010"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
14:25:00 282.434705"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
14:30:00 283.355905"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
14:35:00 284.227658"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
14:40:00 285.051000"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
14:45:00 285.826955"
ts=2018-10-19T15:19:09.948+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
14:50:00 286.556534"
ts=2018-10-19T15:19:09.949+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="2018-10-19
14:55:00 287.240737"
ts=2018-10-19T15:19:09.949+02:00 lvl=info msg="UDF log" service=kapacitor
task_master=main task=arma_temp_stat node=arma_model2 text="Fre
Post by garba moussa
45
46 return pd.DataFrame(data=self._values,
index=pd.to_datetime(self._dates))
Post by garba moussa
@josef I have this error now : 'The `start` argument could not be matched
to a location related to the index of the data.'"
Thanks
Post by garba moussa
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" self.handler.end_batch(request.end)"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" File
\"/tmp/kapacitor_udf/kapacitor/udf/agent/py/arma_model.py\", line 170, in
end_batch"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" forecast = self._state.arma_model()"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" File
\"/tmp/kapacitor_udf/kapacitor/udf/agent/py/arma_model.py\", line 91, in
arma_model"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" forecast =
self._model.predict(start_date.isoformat(), end_date.isoformat())"
ts=2018-10-19T14:52:04.258+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/base/wrapper.py\",
line 95, in wrapper"
ts=2018-10-19T14:52:04.263+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" obj = data.wrap_output(func(results, *args,
**kwargs), how)"
ts=2018-10-19T14:52:04.263+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 1506, in predict"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" return self.model.predict(self.params, start,
end, exog, dynamic)"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 719, in predict"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" self._get_prediction_index(start, end, dynamic))"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.py\",
line 651, in _get_prediction_index"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" super(ARMA, self)._get_prediction_index(start,
end, index))"
ts=2018-10-19T14:52:04.271+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" File
\"/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/base/tsa_model.py\",
line 479, in _get_prediction_index"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text=" raise KeyError('The `start` argument could not
be matched to a'"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text="KeyError: 'The `start` argument could not be matched
to a location related to the index of the data.'"
ts=2018-10-19T14:52:04.280+02:00 lvl=info msg="UDF log"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 text="2018-10-19 14:52:04,280 ERROR:root: error processing
request of type end: 'The `start` argument could not be matched to a
location related to the index of the data.'"
ts=2018-10-19T14:52:04.280+02:00 lvl=error msg="received error message"
service=kapacitor task_master=main task=arma_responsetime_absipevwp54
node=arma_model2 err="error processing request of type end: 'The `start`
argument could not be matched to a location related to the index of the
data.'"
Post by j***@gmail.com
Post by garba moussa
Hi nice people
I use ARMA MODEL to forecast values but when i call predict method I
have this error : attributeerror: 'nonetype' object has no attribute
'predict'
66 self._model = ARMA(ts_arma_model,
order=order).fit(full_output= False, transparams=False, disp=False)
I guess this raises an exception, and then self._model is not defined.
Try without the try... except to see if there is a problem.
AFAIR, full_output=False is not allowed in some of the optimizers.
Josef
Post by garba moussa
68 pass
69 # self._params = self._model.self._params
70 logger.debug('SELF MODEL %s',self._model)
71 # self._model = sm.tsa.ARMA(ts,
order=self._order).fit(method='mle', trend='nc')
72 logger.info("SELF MODEL : %s", self._model)
73 # start_date = ts_arma_model.index[-1] +
self._period
74 # end_date = start_date + (self._predict
-1)*self._period
75 # forecast =
self._model.predict(self._params.all, start_date.isoformat(),
end_date.isoformat())
76 # logger.debug(forecast)
77
78 start_date = ts_arma_model.index[-1] + self._period
79 # start_date = '2018-10-18 02:19:58.314000'
80 logger.debug('START DATE %s',start_date)
81 end_date = start_date + (self._predict
-1)*self._period
82 # end_date = '2018-10-18 03:08:58.493000'
83 logger.debug('END DATE %s',end_date)
84 forecast =
self._model.predict(start_date.isoformat(), end_date.isoformat())
I have this error attributeerror: 'nonetype' object has no attribute
'predict
Thanks for your help
Loading...