In [1]:
import numpy as np
import pandas as pd
%matplotlib inline
In [2]:
N = 3600
lRand = 0.1 * np.random.randn(N)
df_train = pd.DataFrame({"Date" : pd.date_range(start="2016-01-25", periods=N, freq='D'),
"Signal" : np.sin(2* np.pi * 20 * np.arange(N)/N)})
# keep the trend at the beginning of the signal, remove negative values at the end
df_train['Signal'] = df_train['Signal'].apply(lambda x : max(x,0)) + lRand * lRand
In [3]:
df_train.plot('Date' , 'Signal')
Out[3]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f4d12d0db38>
In [4]:
import pyaf.ForecastEngine as autof
lEngine = autof.cForecastEngine()
lEngine.mOptions.set_active_transformations([])
lEngine.mOptions.set_active_trends(['LinearTrend' , 'PolyTrend'])
lEngine.train(iInputDS = df_train, iTime = 'Date', iSignal = 'Signal', iHorizon = 7);
lEngine.getModelInfo() # => relative error 7% (MAPE)
INFO:pyaf.std:START_TRAINING 'Signal'
INFO:pyaf.std:END_TRAINING_TIME_IN_SECONDS 'Signal' 2.4998836517333984
INFO:pyaf.std:TIME_DETAIL TimeVariable='Date' TimeMin=2016-01-25T00:00:00.000000 TimeMax=2023-12-07T00:00:00.000000 TimeDelta=1 days Estimation = (0 , 2874) Validation = (2874 , 3593) Test = (3593 , 3600) Horizon=7
INFO:pyaf.std:SIGNAL_DETAIL SignalVariable='_Signal' Min=3.14325763451e-09 Max=1.07816541727 Mean=0.328210672281 StdDev=0.38556152364
INFO:pyaf.std:BEST_TRANSOFORMATION_TYPE '_'
INFO:pyaf.std:BEST_DECOMPOSITION '_Signal_LinearTrend_residue_bestCycle_byL2_residue_AR(64)' [LinearTrend + Cycle_Length_30 + AR(64)]
INFO:pyaf.std:TREND_DETAIL '_Signal_LinearTrend' [LinearTrend]
INFO:pyaf.std:CYCLE_DETAIL '_Signal_LinearTrend_residue_bestCycle_byL2' [Cycle_Length_30]
INFO:pyaf.std:AUTOREG_DETAIL '_Signal_LinearTrend_residue_bestCycle_byL2_residue_AR(64)' [AR(64)]
INFO:pyaf.std:MODEL_MAPE MAPE_Fit=2827.2811 MAPE_Forecast=838.5239 MAPE_Test=4.5133
INFO:pyaf.std:MODEL_SMAPE SMAPE_Fit=0.6542 SMAPE_Forecast=0.6407 SMAPE_Test=1.1086
INFO:pyaf.std:MODEL_MASE MASE_Fit=0.7277 MASE_Forecast=0.7218 MASE_Test=0.8161
INFO:pyaf.std:MODEL_L1 L1_Fit=0.0141818101913 L1_Forecast=0.0134584708676 L1_Test=0.00739650962185
INFO:pyaf.std:MODEL_L2 L2_Fit=0.0194550087922 L2_Forecast=0.0185122386963 L2_Test=0.00817985866538
INFO:pyaf.std:MODEL_COMPLEXITY 88
INFO:pyaf.std:AR_MODEL_DETAIL_START
INFO:pyaf.std:AR_MODEL_COEFF 1 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag1 0.474456219147
INFO:pyaf.std:AR_MODEL_COEFF 2 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag2 0.328237380986
INFO:pyaf.std:AR_MODEL_COEFF 3 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag3 0.219108441087
INFO:pyaf.std:AR_MODEL_COEFF 4 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag4 0.116354853078
INFO:pyaf.std:AR_MODEL_COEFF 5 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag5 0.0725089046663
INFO:pyaf.std:AR_MODEL_COEFF 6 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag64 -0.0473333312255
INFO:pyaf.std:AR_MODEL_COEFF 7 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag10 -0.0393228959163
INFO:pyaf.std:AR_MODEL_COEFF 8 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag11 -0.0390432349361
INFO:pyaf.std:AR_MODEL_COEFF 9 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag35 0.0351063718124
INFO:pyaf.std:AR_MODEL_COEFF 10 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag32 0.0318259270439
INFO:pyaf.std:AR_MODEL_DETAIL_END
In [5]:
lEngine.standrdPlots()
INFO:pyaf.std:START_PLOTTING
/home/antoine/dev/python/packages/pyaf/TS/Plots.py:30: UserWarning:
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
The backend was *originally* set to 'module://ipykernel.pylab.backend_inline' by the following code:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "/home/antoine/.local/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelapp.py", line 477, in start
ioloop.IOLoop.instance().start()
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/ioloop.py", line 177, in start
super(ZMQIOLoop, self).start()
File "/home/antoine/.local/lib/python3.6/site-packages/tornado/ioloop.py", line 888, in start
handler_func(fd_obj, events)
File "/home/antoine/.local/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 440, in _handle_events
self._handle_recv()
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 472, in _handle_recv
self._run_callback(callback, msg)
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 414, in _run_callback
callback(*args, **kwargs)
File "/home/antoine/.local/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 235, in dispatch_shell
handler(stream, idents, msg)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 399, in execute_request
user_expressions, allow_stdin)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/ipkernel.py", line 196, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/zmqshell.py", line 533, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2717, in run_cell
interactivity=interactivity, compiler=compiler, result=result)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2827, in run_ast_nodes
if self.run_code(code, result):
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-746e0005dc42>", line 4, in <module>
get_ipython().magic('matplotlib inline')
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2158, in magic
return self.run_line_magic(magic_name, magic_arg_s)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2079, in run_line_magic
result = fn(*args,**kwargs)
File "<decorator-gen-104>", line 2, in matplotlib
File "/usr/lib/python3/dist-packages/IPython/core/magic.py", line 188, in <lambda>
call = lambda f, *a, **k: f(*a, **k)
File "/usr/lib/python3/dist-packages/IPython/core/magics/pylab.py", line 100, in matplotlib
gui, backend = self.shell.enable_matplotlib(args.gui)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2947, in enable_matplotlib
pt.activate_matplotlib(backend)
File "/usr/lib/python3/dist-packages/IPython/core/pylabtools.py", line 295, in activate_matplotlib
matplotlib.pyplot.switch_backend(backend)
File "/home/antoine/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 229, in switch_backend
matplotlib.use(newbackend, warn=False, force=True)
File "/home/antoine/.local/lib/python3.6/site-packages/matplotlib/__init__.py", line 1305, in use
reload(sys.modules['matplotlib.backends'])
File "/usr/lib/python3.6/importlib/__init__.py", line 166, in reload
_bootstrap._exec(spec, module)
File "/home/antoine/.local/lib/python3.6/site-packages/matplotlib/backends/__init__.py", line 14, in <module>
line for line in traceback.format_stack()
matplotlib.use('Agg')
/home/antoine/dev/python/packages/pyaf/TS/Plots.py:107: UserWarning:
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
The backend was *originally* set to 'module://ipykernel.pylab.backend_inline' by the following code:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "/home/antoine/.local/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelapp.py", line 477, in start
ioloop.IOLoop.instance().start()
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/ioloop.py", line 177, in start
super(ZMQIOLoop, self).start()
File "/home/antoine/.local/lib/python3.6/site-packages/tornado/ioloop.py", line 888, in start
handler_func(fd_obj, events)
File "/home/antoine/.local/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 440, in _handle_events
self._handle_recv()
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 472, in _handle_recv
self._run_callback(callback, msg)
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 414, in _run_callback
callback(*args, **kwargs)
File "/home/antoine/.local/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 235, in dispatch_shell
handler(stream, idents, msg)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 399, in execute_request
user_expressions, allow_stdin)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/ipkernel.py", line 196, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/zmqshell.py", line 533, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2717, in run_cell
interactivity=interactivity, compiler=compiler, result=result)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2827, in run_ast_nodes
if self.run_code(code, result):
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-746e0005dc42>", line 4, in <module>
get_ipython().magic('matplotlib inline')
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2158, in magic
return self.run_line_magic(magic_name, magic_arg_s)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2079, in run_line_magic
result = fn(*args,**kwargs)
File "<decorator-gen-104>", line 2, in matplotlib
File "/usr/lib/python3/dist-packages/IPython/core/magic.py", line 188, in <lambda>
call = lambda f, *a, **k: f(*a, **k)
File "/usr/lib/python3/dist-packages/IPython/core/magics/pylab.py", line 100, in matplotlib
gui, backend = self.shell.enable_matplotlib(args.gui)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2947, in enable_matplotlib
pt.activate_matplotlib(backend)
File "/usr/lib/python3/dist-packages/IPython/core/pylabtools.py", line 295, in activate_matplotlib
matplotlib.pyplot.switch_backend(backend)
File "/home/antoine/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 229, in switch_backend
matplotlib.use(newbackend, warn=False, force=True)
File "/home/antoine/.local/lib/python3.6/site-packages/matplotlib/__init__.py", line 1305, in use
reload(sys.modules['matplotlib.backends'])
File "/usr/lib/python3.6/importlib/__init__.py", line 166, in reload
_bootstrap._exec(spec, module)
File "/home/antoine/.local/lib/python3.6/site-packages/matplotlib/backends/__init__.py", line 14, in <module>
line for line in traceback.format_stack()
matplotlib.use('Agg')
INFO:pyaf.std:END_PLOTTING_TIME_IN_SECONDS 1.9088590145111084
In [ ]:
In [6]:
lEngine2 = autof.cForecastEngine()
lEngine2.mOptions.set_active_transformations([])
lEngine2.mOptions.set_active_trends(['LinearTrend' , 'PolyTrend'])
lEngine2.mOptions.mForecastRectifier = "relu"
lEngine2.train(iInputDS = df_train, iTime = 'Date', iSignal = 'Signal', iHorizon = 7);
lEngine2.getModelInfo() # => relative error 7% (MAPE)
INFO:pyaf.std:START_TRAINING 'Signal'
INFO:pyaf.std:END_TRAINING_TIME_IN_SECONDS 'Signal' 2.4499406814575195
INFO:pyaf.std:TIME_DETAIL TimeVariable='Date' TimeMin=2016-01-25T00:00:00.000000 TimeMax=2023-12-07T00:00:00.000000 TimeDelta=1 days Estimation = (0 , 2874) Validation = (2874 , 3593) Test = (3593 , 3600) Horizon=7
INFO:pyaf.std:SIGNAL_DETAIL SignalVariable='_Signal' Min=3.14325763451e-09 Max=1.07816541727 Mean=0.328210672281 StdDev=0.38556152364
INFO:pyaf.std:BEST_TRANSOFORMATION_TYPE '_'
INFO:pyaf.std:BEST_DECOMPOSITION '_Signal_LinearTrend_residue_bestCycle_byL2_residue_AR(64)' [LinearTrend + Cycle_Length_30 + AR(64)]
INFO:pyaf.std:TREND_DETAIL '_Signal_LinearTrend' [LinearTrend]
INFO:pyaf.std:CYCLE_DETAIL '_Signal_LinearTrend_residue_bestCycle_byL2' [Cycle_Length_30]
INFO:pyaf.std:AUTOREG_DETAIL '_Signal_LinearTrend_residue_bestCycle_byL2_residue_AR(64)' [AR(64)]
INFO:pyaf.std:MODEL_MAPE MAPE_Fit=2827.2811 MAPE_Forecast=838.5239 MAPE_Test=4.5133
INFO:pyaf.std:MODEL_SMAPE SMAPE_Fit=0.6542 SMAPE_Forecast=0.6407 SMAPE_Test=1.1086
INFO:pyaf.std:MODEL_MASE MASE_Fit=0.7277 MASE_Forecast=0.7218 MASE_Test=0.8161
INFO:pyaf.std:MODEL_L1 L1_Fit=0.0141818101913 L1_Forecast=0.0134584708676 L1_Test=0.00739650962185
INFO:pyaf.std:MODEL_L2 L2_Fit=0.0194550087922 L2_Forecast=0.0185122386963 L2_Test=0.00817985866538
INFO:pyaf.std:MODEL_COMPLEXITY 88
INFO:pyaf.std:AR_MODEL_DETAIL_START
INFO:pyaf.std:AR_MODEL_COEFF 1 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag1 0.474456219147
INFO:pyaf.std:AR_MODEL_COEFF 2 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag2 0.328237380986
INFO:pyaf.std:AR_MODEL_COEFF 3 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag3 0.219108441087
INFO:pyaf.std:AR_MODEL_COEFF 4 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag4 0.116354853078
INFO:pyaf.std:AR_MODEL_COEFF 5 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag5 0.0725089046663
INFO:pyaf.std:AR_MODEL_COEFF 6 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag64 -0.0473333312255
INFO:pyaf.std:AR_MODEL_COEFF 7 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag10 -0.0393228959163
INFO:pyaf.std:AR_MODEL_COEFF 8 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag11 -0.0390432349361
INFO:pyaf.std:AR_MODEL_COEFF 9 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag35 0.0351063718124
INFO:pyaf.std:AR_MODEL_COEFF 10 _Signal_LinearTrend_residue_bestCycle_byL2_residue_Lag32 0.0318259270439
INFO:pyaf.std:AR_MODEL_DETAIL_END
In [7]:
lEngine2.standrdPlots()
INFO:pyaf.std:START_PLOTTING
/home/antoine/dev/python/packages/pyaf/TS/Plots.py:30: UserWarning:
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
The backend was *originally* set to 'module://ipykernel.pylab.backend_inline' by the following code:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "/home/antoine/.local/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelapp.py", line 477, in start
ioloop.IOLoop.instance().start()
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/ioloop.py", line 177, in start
super(ZMQIOLoop, self).start()
File "/home/antoine/.local/lib/python3.6/site-packages/tornado/ioloop.py", line 888, in start
handler_func(fd_obj, events)
File "/home/antoine/.local/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 440, in _handle_events
self._handle_recv()
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 472, in _handle_recv
self._run_callback(callback, msg)
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 414, in _run_callback
callback(*args, **kwargs)
File "/home/antoine/.local/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 235, in dispatch_shell
handler(stream, idents, msg)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 399, in execute_request
user_expressions, allow_stdin)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/ipkernel.py", line 196, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/zmqshell.py", line 533, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2717, in run_cell
interactivity=interactivity, compiler=compiler, result=result)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2827, in run_ast_nodes
if self.run_code(code, result):
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-746e0005dc42>", line 4, in <module>
get_ipython().magic('matplotlib inline')
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2158, in magic
return self.run_line_magic(magic_name, magic_arg_s)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2079, in run_line_magic
result = fn(*args,**kwargs)
File "<decorator-gen-104>", line 2, in matplotlib
File "/usr/lib/python3/dist-packages/IPython/core/magic.py", line 188, in <lambda>
call = lambda f, *a, **k: f(*a, **k)
File "/usr/lib/python3/dist-packages/IPython/core/magics/pylab.py", line 100, in matplotlib
gui, backend = self.shell.enable_matplotlib(args.gui)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2947, in enable_matplotlib
pt.activate_matplotlib(backend)
File "/usr/lib/python3/dist-packages/IPython/core/pylabtools.py", line 295, in activate_matplotlib
matplotlib.pyplot.switch_backend(backend)
File "/home/antoine/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 229, in switch_backend
matplotlib.use(newbackend, warn=False, force=True)
File "/home/antoine/.local/lib/python3.6/site-packages/matplotlib/__init__.py", line 1305, in use
reload(sys.modules['matplotlib.backends'])
File "/usr/lib/python3.6/importlib/__init__.py", line 166, in reload
_bootstrap._exec(spec, module)
File "/home/antoine/.local/lib/python3.6/site-packages/matplotlib/backends/__init__.py", line 14, in <module>
line for line in traceback.format_stack()
matplotlib.use('Agg')
/home/antoine/dev/python/packages/pyaf/TS/Plots.py:107: UserWarning:
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.
The backend was *originally* set to 'module://ipykernel.pylab.backend_inline' by the following code:
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "/home/antoine/.local/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelapp.py", line 477, in start
ioloop.IOLoop.instance().start()
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/ioloop.py", line 177, in start
super(ZMQIOLoop, self).start()
File "/home/antoine/.local/lib/python3.6/site-packages/tornado/ioloop.py", line 888, in start
handler_func(fd_obj, events)
File "/home/antoine/.local/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 440, in _handle_events
self._handle_recv()
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 472, in _handle_recv
self._run_callback(callback, msg)
File "/home/antoine/.local/lib/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 414, in _run_callback
callback(*args, **kwargs)
File "/home/antoine/.local/lib/python3.6/site-packages/tornado/stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 235, in dispatch_shell
handler(stream, idents, msg)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/kernelbase.py", line 399, in execute_request
user_expressions, allow_stdin)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/ipkernel.py", line 196, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "/usr/local/lib/python3.6/dist-packages/ipykernel/zmqshell.py", line 533, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2717, in run_cell
interactivity=interactivity, compiler=compiler, result=result)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2827, in run_ast_nodes
if self.run_code(code, result):
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-746e0005dc42>", line 4, in <module>
get_ipython().magic('matplotlib inline')
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2158, in magic
return self.run_line_magic(magic_name, magic_arg_s)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2079, in run_line_magic
result = fn(*args,**kwargs)
File "<decorator-gen-104>", line 2, in matplotlib
File "/usr/lib/python3/dist-packages/IPython/core/magic.py", line 188, in <lambda>
call = lambda f, *a, **k: f(*a, **k)
File "/usr/lib/python3/dist-packages/IPython/core/magics/pylab.py", line 100, in matplotlib
gui, backend = self.shell.enable_matplotlib(args.gui)
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2947, in enable_matplotlib
pt.activate_matplotlib(backend)
File "/usr/lib/python3/dist-packages/IPython/core/pylabtools.py", line 295, in activate_matplotlib
matplotlib.pyplot.switch_backend(backend)
File "/home/antoine/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 229, in switch_backend
matplotlib.use(newbackend, warn=False, force=True)
File "/home/antoine/.local/lib/python3.6/site-packages/matplotlib/__init__.py", line 1305, in use
reload(sys.modules['matplotlib.backends'])
File "/usr/lib/python3.6/importlib/__init__.py", line 166, in reload
_bootstrap._exec(spec, module)
File "/home/antoine/.local/lib/python3.6/site-packages/matplotlib/backends/__init__.py", line 14, in <module>
line for line in traceback.format_stack()
matplotlib.use('Agg')
INFO:pyaf.std:END_PLOTTING_TIME_IN_SECONDS 1.9544663429260254
In [ ]:
Content source: antoinecarme/pyaf
Similar notebooks: