Open source time series library for Python

Overview

PyFlux

Join the chat at https://gitter.im/RJT1990/pyflux PyPI version Documentation Status

PyFlux is an open source time series library for Python. The library has a good array of modern time series models, as well as a flexible array of inference options (frequentist and Bayesian) that can be applied to these models. By combining breadth of models with breadth of inference, PyFlux allows for a probabilistic approach to time series modelling.

See some examples and documentation below. PyFlux is still only alpha software; this means you use it at your own risk, that test coverage is still in need of expansion, and also that some modules are still in need of being optimized.

Click here for a getting started guide.

Note From Author : I am currently working on other projects as of now, so have paused updates for this library for the immediate future. If you'd like to help move the library forward by contributing, then do get in touch! I am planning to review at end of year and update the library as required (new version requirements, etc).

Models

Inference

Installing PyFlux

pip install pyflux

Python Version

Supported on Python 2.7 and 3.5.

Talks

Citation

PyFlux is still alpha software so results should be treated with care, but citations are very welcome:

Ross Taylor. 2016. PyFlux: An open source time series library for Python

Comments
  • failure in install with pip

    failure in install with pip

    OS: windows 10 python version: 3.5 form Anaconda the command pip install pyflux fails and has the following output from cmd:

    Failed building wheel for pyflux Running setup.py clean for pyflux Failed to build pyflux Installing collected packages: pyflux Running setup.py install for pyflux ... error

    Complete output from command c:\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Victor\\AppData\\Local\\Temp\\pip-build-kmpjxnhy\\pyflux\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Victor\AppData\Local\Temp\pip-szvhc2lu-record\install-record.txt --single-version-externally-managed --compile:

    A few things happen successfully after that message but at the end this happens:

    _check_build.c c:\anaconda3\include\pyconfig.h(243): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory error: Command "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\anaconda3\lib\site-packages\numpy\core\include -Ic:\anaconda3\include -Ic:\anaconda3\include -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" /Tcpyflux\__check_build\_check_build.c /Fobuild\temp.win-amd64-3.5\Release\pyflux\__check_build\_check_build.obj" failed with exit status 2

    ---------------------------------------- Command "c:\anaconda3\python.exe -u -c "import setuptools, [pyflux fail install.txt](https://github.com/RJT1990/pyflux/files/1087255/pyflux.fail.install.txt) tokenize;__file__='C:\\Users\\Victor\\AppData\\Local\\Temp\\pip-build-kmpjxnhy\\pyflux\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Victor\AppData\Local\Temp\pip-szvhc2lu-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Victor\AppData\Local\Temp\pip-build-kmpjxnhy\pyflux\

    How can I fix this?

    opened by RichardMM 16
  • plot_predict : 'module' object has no attribute 'indexes'

    plot_predict : 'module' object has no attribute 'indexes'

    When I run the ARMAX example: http://pyflux.readthedocs.io/en/latest/arimax.html I get the following error from model.plot_predict(h=10,oos_data=data.iloc[-12:],past_values=100,figsize=(15,5)) : File "/usr/local/lib/python2.7/dist-packages/pyflux/arma/arimax.py", line 778, in plot_predict date_index = self.shift_dates(h) File "/usr/local/lib/python2.7/dist-packages/pyflux/tsm.py", line 536, in shift_dates if isinstance(date_index, pd.core.indexes.datetimes.DatetimeIndex): AttributeError: 'module' object has no attribute 'indexes'

    opened by alireza-akhondi-asl 10
  • pip install -e . RuntimeError: Running cythonize failed!

    pip install -e . RuntimeError: Running cythonize failed!

    When I try install pyflux from the source code

    pip install -e .
    

    I get this error message

        Complete output from command python setup.py egg_info:
        /Users/pablo/.envs/pyflux/bin/python3: can't open file '/Users/pablo/src/pyflux/tools/cythonize.py': [Errno 2] No such file or directory
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/Users/pablo/src/pyflux/setup.py", line 92, in <module>
            setup_package()
          File "/Users/pablo/src/pyflux/setup.py", line 70, in setup_package
            generate_cython(PACKAGE_NAME)
          File "/Users/pablo/src/pyflux/setup.py", line 38, in generate_cython
            raise RuntimeError("Running cythonize failed!")
        RuntimeError: Running cythonize failed!
        Cythonizing sources
    
    opened by juanpabloaj 10
  • Import matplotlib only if required to avoid dependency issues with Tkinter

    Import matplotlib only if required to avoid dependency issues with Tkinter

    Right now it's not possible to use pyflux in a python environment which is not configured for Tk, which is the case for most server environments:

    Traceback (most recent call last):
      File "...", line 1, in <module>
        import pyflux as pf
      File ".../python/lib/python2.7/site-packages/pyflux/__init__.py", line 5, in <module>
        from .arma import *
      File ".../python/lib/python2.7/site-packages/pyflux/arma/__init__.py", line 1, in <module>
        from .arma import ARIMA
      File ".../python/lib/python2.7/site-packages/pyflux/arma/arma.py", line 8, in <module>
        import matplotlib.pyplot as plt
      File ".../python/lib/python2.7/site-packages/matplotlib/pyplot.py", line 114, in <module>
        _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
      File ".../python/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
        globals(),locals(),[backend_name],0)
      File ".../python/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 6, in <module>
        from matplotlib.externals.six.moves import tkinter as Tk
      File ".../python/lib/python2.7/site-packages/matplotlib/externals/six.py", line 199, in load_module
        mod = mod._resolve()
      File ".../python/lib/python2.7/site-packages/matplotlib/externals/six.py", line 113, in _resolve
        return _import_module(self.mod)
      File ".../python/lib/python2.7/site-packages/matplotlib/externals/six.py", line 80, in _import_module
        __import__(name)
      File ".../python/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
          import _tkinter # If this fails your Python may not be configured for Tk
    ImportError: No module named _tkinter
    

    This PR moves all matplotlib imports from the global scope into the different plotting functions so that Tkinter is only required if you actually use the plotting capabilities of pyflux.

    opened by tmak 9
  • failed building wheel for pyflux

    failed building wheel for pyflux

    I've tried a couple of different approaches but can't seem to get past this error.

    Failed building wheel for pyflux Running setup.py clean for pyflux Failed to build pyflux Installing collected packages: pyflux Running setup.py install for pyflux ... error Complete output from command /Users/pillbug/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/17/gfz9lnjs30l_sd0tgn7v1m3m0000gn/T/pip-build-hktpm5i6/pyflux/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /var/folders/17/gfz9lnjs30l_sd0tgn7v1m3m0000gn/T/pip-2tnfhoox-record/install-record.txt --single-version-externally-managed --compile: running install running build running config_cc unifing config_cc, config, build_clib, build_ext, build commands --compiler options running config_fc unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options running build_src build_src building extension "pyflux.__check_build._check_build" sources building extension "pyflux.arma.arma_recursions" sources building extension "pyflux.arma.nn_architecture" sources building extension "pyflux.families.gas_recursions" sources building extension "pyflux.families.poisson_kalman_recursions" sources building extension "pyflux.garch.garch_recursions" sources building extension "pyflux.gas.gas_core_recursions" sources building extension "pyflux.gpnarx.kernel_routines" sources building extension "pyflux.inference.metropolis_sampler" sources building extension "pyflux.inference.bbvi_routines" sources building extension "pyflux.ssm.kalman" sources building extension "pyflux.var.var_recursions" sources build_src: building npy-pkg config files running build_py creating build creating build/lib.macosx-10.6-x86_64-3.5 creating build/lib.macosx-10.6-x86_64-3.5/pyflux copying pyflux/init.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux copying pyflux/covariances.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux copying pyflux/data_check.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux copying pyflux/latent_variables.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux copying pyflux/results.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux copying pyflux/setup.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux copying pyflux/tsm.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux creating build/lib.macosx-10.6-x86_64-3.5/pyflux/__check_build copying pyflux/__check_build/init.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/__check_build copying pyflux/__check_build/setup.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/__check_build creating build/lib.macosx-10.6-x86_64-3.5/pyflux/arma copying pyflux/arma/init.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/arma copying pyflux/arma/arimax.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/arma copying pyflux/arma/arma.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/arma copying pyflux/arma/nnar.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/arma copying pyflux/arma/nnarx.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/arma copying pyflux/arma/setup.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/arma creating build/lib.macosx-10.6-x86_64-3.5/pyflux/ensembles copying pyflux/ensembles/init.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/ensembles copying pyflux/ensembles/mixture_of_experts.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/ensembles creating build/lib.macosx-10.6-x86_64-3.5/pyflux/families copying pyflux/families/init.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/families copying pyflux/families/cauchy.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/families copying pyflux/families/exponential.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/families copying pyflux/families/family.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/families copying pyflux/families/flat.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/families copying pyflux/families/inverse_gamma.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/families copying pyflux/families/inverse_wishart.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/families copying pyflux/families/laplace.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/families copying pyflux/families/normal.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/families copying pyflux/families/poisson.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/families copying pyflux/families/setup.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/families copying pyflux/families/skewt.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/families copying pyflux/families/t.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/families copying pyflux/families/truncated_normal.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/families creating build/lib.macosx-10.6-x86_64-3.5/pyflux/garch copying pyflux/garch/init.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/garch copying pyflux/garch/egarch.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/garch copying pyflux/garch/egarchm.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/garch copying pyflux/garch/egarchmreg.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/garch copying pyflux/garch/garch.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/garch copying pyflux/garch/lmegarch.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/garch copying pyflux/garch/segarch.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/garch copying pyflux/garch/segarchm.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/garch copying pyflux/garch/setup.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/garch creating build/lib.macosx-10.6-x86_64-3.5/pyflux/gas copying pyflux/gas/init.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/gas copying pyflux/gas/gas.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/gas copying pyflux/gas/gasllm.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/gas copying pyflux/gas/gasllt.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/gas copying pyflux/gas/gasrank.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/gas copying pyflux/gas/gasreg.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/gas copying pyflux/gas/gasx.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/gas copying pyflux/gas/scores.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/gas copying pyflux/gas/setup.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/gas creating build/lib.macosx-10.6-x86_64-3.5/pyflux/gpnarx copying pyflux/gpnarx/init.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/gpnarx copying pyflux/gpnarx/gpnarx.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/gpnarx copying pyflux/gpnarx/kernels.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/gpnarx copying pyflux/gpnarx/setup.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/gpnarx creating build/lib.macosx-10.6-x86_64-3.5/pyflux/inference copying pyflux/inference/init.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/inference copying pyflux/inference/bbvi.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/inference copying pyflux/inference/metropolis_hastings.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/inference copying pyflux/inference/norm_post_sim.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/inference copying pyflux/inference/setup.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/inference copying pyflux/inference/stoch_optim.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/inference creating build/lib.macosx-10.6-x86_64-3.5/pyflux/output copying pyflux/output/init.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/output copying pyflux/output/tableprinter.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/output creating build/lib.macosx-10.6-x86_64-3.5/pyflux/ssm copying pyflux/ssm/init.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/ssm copying pyflux/ssm/dar.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/ssm copying pyflux/ssm/dynamic_glm.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/ssm copying pyflux/ssm/dynlin.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/ssm copying pyflux/ssm/llm.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/ssm copying pyflux/ssm/llt.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/ssm copying pyflux/ssm/local_level.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/ssm copying pyflux/ssm/local_trend.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/ssm copying pyflux/ssm/ndynlin.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/ssm copying pyflux/ssm/nllm.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/ssm copying pyflux/ssm/nllt.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/ssm copying pyflux/ssm/setup.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/ssm creating build/lib.macosx-10.6-x86_64-3.5/pyflux/tests copying pyflux/tests/init.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/tests copying pyflux/tests/nhst.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/tests creating build/lib.macosx-10.6-x86_64-3.5/pyflux/var copying pyflux/var/init.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/var copying pyflux/var/setup.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/var copying pyflux/var/var.py -> build/lib.macosx-10.6-x86_64-3.5/pyflux/var running build_ext customize UnixCCompiler customize UnixCCompiler using build_ext building 'pyflux.__check_build._check_build' extension compiling C sources C compiler: /usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/pillbug/anaconda3/include -arch x86_64

    creating build/temp.macosx-10.6-x86_64-3.5
    creating build/temp.macosx-10.6-x86_64-3.5/pyflux
    creating build/temp.macosx-10.6-x86_64-3.5/pyflux/__check_build
    compile options: '-I/Users/pillbug/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/Users/pillbug/anaconda3/include/python3.5m -c'
    clang: pyflux/__check_build/_check_build.c
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: Command "/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/pillbug/anaconda3/include -arch x86_64 -I/Users/pillbug/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/Users/pillbug/anaconda3/include/python3.5m -c pyflux/__check_build/_check_build.c -o build/temp.macosx-10.6-x86_64-3.5/pyflux/__check_build/_check_build.o" failed with exit status 1
    
    ----------------------------------------
    

    Command "/Users/pillbug/anaconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/17/gfz9lnjs30l_sd0tgn7v1m3m0000gn/T/pip-build-hktpm5i6/pyflux/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /var/folders/17/gfz9lnjs30l_sd0tgn7v1m3m0000gn/T/pip-2tnfhoox-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/17/gfz9lnjs30l_sd0tgn7v1m3m0000gn/T/pip-build-hktpm5i6/pyflux/

    opened by mjjohns1 8
  • pyflux.com is not hosted anymore, but the docs still reference it

    pyflux.com is not hosted anymore, but the docs still reference it

    For instance, the image at http://www.pyflux.com/welcome_pack/introduction/model_api_1.png is referenced by the docs at https://pyflux.readthedocs.io/en/latest/index.html but not available anymore.

    pyflux.com now contains ads for python-related search terms. It it is lost, the images (if still available somehow) should be hosted on readthedocs, I guess.

    opened by nhoening 7
  • WIP: Cythonization for Arma

    WIP: Cythonization for Arma

    This is a really early WIP for the Arma Cythonization.

    I'm still having a bit of trouble getting the setup.py file sorted out. However my knowledge of Cython isn't great.

    You should be able to get some speedups without even writing much Cython code.

    opened by springcoil 6
  • VAR model's AIC, BIC and Log Likelihood are non-deterministic

    VAR model's AIC, BIC and Log Likelihood are non-deterministic

    Example code:

    file issuegithub.py

    import numpy as np
    import pyflux as pf
    import pandas as pd
    
    df = pd.DataFrame(np.linspace(0,100,1000), columns=list('A'))
    # Model the data using VAR modeling
    model = pf.VAR(data=df, lags=2, integ=1)
    # Fit the model
    x = model.fit()
    # Print the aic
    print(x.aic)
    

    Runs:

    $ python issuegithub.py
    651.7090301513672
    $ python issuegithub.py
    636.0988006591797
    $ python issuegithub.py
    -16537352142428.482
    

    I've narrowed it down to a call to var_likelihood, that is defined in pyflux/var/var_recursions.cpython-36m-x86_64-linux-gnu.so.

    It's a .so file so I can't debug it but adding a print to the result of the call to that function for each run will show that each time it will return something different.

    opened by Alechan 5
  • AttributeError: 'str' object has no attribute 'X'

    AttributeError: 'str' object has no attribute 'X'

    GP-NARX model

    Hi I am using the narx model and the following error is thrown when I try to propose the model.

    Traceback (most recent call last):
      File "/home/efkag/Desktop/BTBSimulator/SimulatorPackage/Simulator.py", line 163, in <module>
        model = pf.GPNARX(data=data_arr, ar=2, kernel='RQ', integ=4, target=[0, 1])
      File "/usr/local/lib/python3.5/dist-packages/pyflux/gpnarx/gpnarx.py", line 84, in __init__
        self.kernel.X = self.X().T
    AttributeError: 'str' object has no attribute 'X'
    

    I am using Python 3.5. I tried changing the input from NumPy to Pandas Data Frame and changing the type of the kernel but nothing seems to work. The IDE identifies the problem to be in line 84 in the library file gpnarx.py. screenshot from 2017-07-01 17-18-28

    Please help I don't know how to fix this.

    opened by efkag 5
  • Error in arimax.plot_predict, plot_predict_is, predict?

    Error in arimax.plot_predict, plot_predict_is, predict?

    Hi,

    I am getting the following error in trying to replicate the example on http://www.pyflux.com/docs/arimax.html: Traceback (most recent call last):

    File "", line 28, in model.plot_predict(h=10, oos_data=data.iloc[-12:], past_values=100, figsize=(15,5))

    File "/anaconda/envs/python3/lib/python3.6/site-packages/pyflux/arma/arimax.py", line 778, in plot_predict date_index = self.shift_dates(h)

    File "/anaconda/envs/python3/lib/python3.6/site-packages/pyflux/tsm.py", line 537, in shift_dates if isinstance(date_index,pd.tseries.index.DatetimeIndex):

    AttributeError: module 'pandas.tseries' has no attribute 'index'

    Below is the code, which I have copied verbatim from the page:

    import numpy as np import pandas as pd import pyflux as pf from datetime import datetime import matplotlib.pyplot as plt

    data = pd.read_csv("https://vincentarelbundock.github.io/Rdatasets/csv/MASS/drivers.csv") data.index = data['time']; data.loc[(data['time']>=1983.05), 'seat_belt'] = 1; data.loc[(data['time']<1983.05), 'seat_belt'] = 0; data.loc[(data['time']>=1974.00), 'oil_crisis'] = 1; data.loc[(data['time']<1974.00), 'oil_crisis'] = 0; plt.figure(figsize=(15,5)); plt.plot(data.index,data['drivers']); plt.ylabel('Driver Deaths'); plt.title('Deaths of Car Drivers in Great Britain 1969-84'); plt.plot();

    type(data['drivers'])

    model = pf.ARIMAX(data=data, formula='drivers~1+seat_belt+oil_crisis', ar=1, ma=1, family=pf.Normal()) x = model.fit("MLE") x.summary()

    model.plot_fit(figsize=(15,10))

    model.plot_predict(h=10, oos_data=data.iloc[-12:], past_values=100, figsize=(15,5))

    opened by shr264 5
  • ImportError: No module named 'pyflux.other'

    ImportError: No module named 'pyflux.other'

    When I try to import pyflux I get this error

    python -c 'import pyflux'
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/pablo/.envs/pyflux/lib/python3.5/site-packages/pyflux/__init__.py", line 17, in <module>
        from .other import *
    ImportError: No module named 'pyflux.other'
    

    Other info

    $ pip list | grep pyflux
    pyflux (0.4.13)
    
    $ python --version
    Python 3.5.1
    
    opened by juanpabloaj 5
  • Add support to release Linux aarch64 wheels

    Add support to release Linux aarch64 wheels

    Problem

    On aarch64, ‘pip install pyflux’ is giving the below error -

    pyflux/arma/arma_recursions.c: In function ‘__Pyx__ExceptionSave’:
        pyflux/arma/arma_recursions.c:19331:21: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
        19331 |     *type = tstate->exc_type;
              |                     ^~~~~~~~
              |                     curexc_type
        pyflux/arma/arma_recursions.c:19332:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
        19332 |     *value = tstate->exc_value;
              |                      ^~~~~~~~~
              |                      curexc_value
        pyflux/arma/arma_recursions.c:19333:19: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
        19333 |     *tb = tstate->exc_traceback;
              |                   ^~~~~~~~~~~~~
              |                   curexc_traceback
        pyflux/arma/arma_recursions.c: In function ‘__Pyx__ExceptionReset’:
        pyflux/arma/arma_recursions.c:19340:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
        19340 |     tmp_type = tstate->exc_type;
              |                        ^~~~~~~~
              |                        curexc_type
        pyflux/arma/arma_recursions.c:19341:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
        19341 |     tmp_value = tstate->exc_value;
              |                         ^~~~~~~~~
              |                         curexc_value
        pyflux/arma/arma_recursions.c:19342:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
        19342 |     tmp_tb = tstate->exc_traceback;
              |                      ^~~~~~~~~~~~~
              |                      curexc_traceback
        pyflux/arma/arma_recursions.c:19343:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
        19343 |     tstate->exc_type = type;
              |             ^~~~~~~~
              |             curexc_type
        pyflux/arma/arma_recursions.c:19344:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
        19344 |     tstate->exc_value = value;
              |             ^~~~~~~~~
              |             curexc_value
        pyflux/arma/arma_recursions.c:19345:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
        19345 |     tstate->exc_traceback = tb;
              |             ^~~~~~~~~~~~~
              |             curexc_traceback
        pyflux/arma/arma_recursions.c: In function ‘__Pyx__GetException’:
        pyflux/arma/arma_recursions.c:19400:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
        19400 |     tmp_type = tstate->exc_type;
              |                        ^~~~~~~~
              |                        curexc_type
        pyflux/arma/arma_recursions.c:19401:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
        19401 |     tmp_value = tstate->exc_value;
              |                         ^~~~~~~~~
              |                         curexc_value
        pyflux/arma/arma_recursions.c:19402:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
        19402 |     tmp_tb = tstate->exc_traceback;
              |                      ^~~~~~~~~~~~~
              |                      curexc_traceback
        pyflux/arma/arma_recursions.c:19403:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
        19403 |     tstate->exc_type = local_type;
              |             ^~~~~~~~
              |             curexc_type
        pyflux/arma/arma_recursions.c:19404:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
        19404 |     tstate->exc_value = local_value;
              |             ^~~~~~~~~
              |             curexc_value
        pyflux/arma/arma_recursions.c:19405:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
        19405 |     tstate->exc_traceback = local_tb;
              |             ^~~~~~~~~~~~~
              |             curexc_traceback
        pyflux/arma/arma_recursions.c: In function ‘__Pyx__ExceptionSwap’:
        pyflux/arma/arma_recursions.c:19427:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
        19427 |     tmp_type = tstate->exc_type;
              |                        ^~~~~~~~
              |                        curexc_type
        pyflux/arma/arma_recursions.c:19428:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
        19428 |     tmp_value = tstate->exc_value;
              |                         ^~~~~~~~~
              |                         curexc_value
        pyflux/arma/arma_recursions.c:19429:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
        19429 |     tmp_tb = tstate->exc_traceback;
              |                      ^~~~~~~~~~~~~
              |                      curexc_traceback
        pyflux/arma/arma_recursions.c:19430:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
        19430 |     tstate->exc_type = *type;
              |             ^~~~~~~~
              |             curexc_type
        pyflux/arma/arma_recursions.c:19431:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
        19431 |     tstate->exc_value = *value;
              |             ^~~~~~~~~
              |             curexc_value
        pyflux/arma/arma_recursions.c:19432:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
        19432 |     tstate->exc_traceback = *tb;
              |             ^~~~~~~~~~~~~
              |             curexc_traceback
        In file included from /usr/local/lib/python3.8/dist-packages/numpy/core/include/numpy/ndarrayobject.h:21,
                         from /usr/local/lib/python3.8/dist-packages/numpy/core/include/numpy/arrayobject.h:5,
                         from pyflux/arma/arma_recursions.c:274:
        At top level:
        /usr/local/lib/python3.8/dist-packages/numpy/core/include/numpy/__multiarray_api.h:1477:1: warning: ‘_import_array’ defined but not used [-Wunused-function]
         1477 | _import_array(void)
              | ^~~~~~~~~~~~~
        error: Command "aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -Ibuild/src.linux-aarch64-3.8/numpy/distutils/include -I/usr/include/python3.8 -c pyflux/arma/arma_recursions.c -o build/temp.linux-aarch64-3.8/pyflux/arma/arma_recursions.o -MMD -MF build/temp.linux-aarch64-3.8/pyflux/arma/arma_recursions.o.d" failed with exit status 1
    

    Resolution

    On aarch64, ‘pip install pyflux’ should download the wheels from PyPI.

    @RJT1990 and Team, Please let me know your interest in releasing aarch64 wheels. I can help in this.

    opened by odidev 0
  • EGARCHMReg predict error

    EGARCHMReg predict error

    Hi, anyone can help how to use predict in EGARCHMReg? I got this error :

    ---------------------------------------------------------------------------
    ValueError                                Traceback (most recent call last)
    <ipython-input-56-dfcdc33a1b08> in <module>()
    ----> 1 modelx.predict(180,final_returns, intervals=False)
    
    C:\Users\Owner\Anaconda3\envs\pyflux\lib\site-packages\pyflux\garch\egarchmreg.py in predict(self, h, oos_data, intervals)
        765             X_oos = np.array([X_oos])[0]
        766             X_pred = X_oos[:h]
    --> 767             lmda, Y, scores = self._model(self.latent_variables.get_z_values())
        768             date_index = self.shift_dates(h)
        769 
    
    ValueError: too many values to unpack (expected 3)
    

    I used same dataset in example part of documentation.

    modelx.predict(180,final_returns, intervals=False)

    Thank you

    opened by ramdhan1989 0
  • Install Issue for the newest mac M1 pro chip

    Install Issue for the newest mac M1 pro chip

    Could you upgrade the package for the newest MacBook pro package installation? It appears that the package will be compiled into an incompatible type for the MacBook pro M1 chip.

    opened by joychen98er 0
  • Pyflux throws out errors for GARCH

    Pyflux throws out errors for GARCH

    I am following the example on PyFlux and I get to the GARCH model and it throws out these errors. Can someone help, please?

    In [118]: my_model = pf.GARCH(p = 1, q = 1, data = a_returns)

    AttributeError Traceback (most recent call last) in ----> 1 my_model = pf.GARCH(p = 1, q = 1, data = a_returns)

    C:\ProgramData\Anaconda3\lib\site-packages\pyflux\garch\garch.py in init(self, data, p, q, target) 53 54 # Format the data ---> 55 self.data, self.data_name, self.is_pandas, self.index = dc.data_check(data,target) 56 self.data_length = self.data.shape[0] 57 self._create_latent_variables()

    C:\ProgramData\Anaconda3\lib\site-packages\pyflux\data_check.py in data_check(data, target) 32 data_index = data.index 33 if target is None: ---> 34 transformed_data = data.ix[:,0].values 35 data_name = str(data.columns.values[0]) 36 else:

    C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\generic.py in getattr(self, name) 5485 ): 5486 return self[name] -> 5487 return object.getattribute(self, name) 5488 5489 def setattr(self, name: str, value) -> None:

    AttributeError: 'DataFrame' object has no attribute 'ix'

    opened by ckorkpoe 0
  • pip install fail on google colab

    pip install fail on google colab

    Collecting pyflux
      Using cached pyflux-0.4.15.tar.gz (1.3 MB)
    Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from pyflux) (1.19.5)
    Requirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (from pyflux) (1.1.5)
    Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from pyflux) (1.4.1)
    Requirement already satisfied: numdifftools in /usr/local/lib/python3.7/dist-packages (from pyflux) (0.9.40)
    Requirement already satisfied: patsy in /usr/local/lib/python3.7/dist-packages (from pyflux) (0.5.2)
    Requirement already satisfied: algopy>=0.4 in /usr/local/lib/python3.7/dist-packages (from numdifftools->pyflux) (0.5.7)
    Requirement already satisfied: statsmodels>=0.6 in /usr/local/lib/python3.7/dist-packages (from numdifftools->pyflux) (0.10.2)
    Requirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.7/dist-packages (from pandas->pyflux) (2.8.2)
    Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.7/dist-packages (from pandas->pyflux) (2018.9)
    Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from patsy->pyflux) (1.15.0)
    Building wheels for collected packages: pyflux
      Building wheel for pyflux (setup.py) ... error
      ERROR: Failed building wheel for pyflux
      Running setup.py clean for pyflux
    Failed to build pyflux
    Installing collected packages: pyflux
        Running setup.py install for pyflux ... error
    ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-55kchscf/pyflux_5882bd81dcd145dbaf93bfa838249a71/setup.py'"'"'; __file__='"'"'/tmp/pip-install-55kchscf/pyflux_5882bd81dcd145dbaf93bfa838249a71/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-bvd4wquf/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.7/pyflux Check the logs for full command output.
    
    opened by dirknbr 2
Owner
Ross Taylor
Working on @paperswithcode
Ross Taylor
An open-source library of algorithms to analyse time series in GPU and CPU.

An open-source library of algorithms to analyse time series in GPU and CPU.

Shapelets 216 Dec 30, 2022
Nixtla is an open-source time series forecasting library.

Nixtla Nixtla is an open-source time series forecasting library. We are helping data scientists and developers to have access to open source state-of-

Nixtla 401 Jan 8, 2023
A statistical library designed to fill the void in Python's time series analysis capabilities, including the equivalent of R's auto.arima function.

pmdarima Pmdarima (originally pyramid-arima, for the anagram of 'py' + 'arima') is a statistical library designed to fill the void in Python's time se

alkaline-ml 1.3k Dec 22, 2022
A python library for easy manipulation and forecasting of time series.

Time Series Made Easy in Python darts is a python library for easy manipulation and forecasting of time series. It contains a variety of models, from

Unit8 5.2k Jan 4, 2023
STUMPY is a powerful and scalable Python library for computing a Matrix Profile, which can be used for a variety of time series data mining tasks

STUMPY STUMPY is a powerful and scalable library that efficiently computes something called the matrix profile, which can be used for a variety of tim

TD Ameritrade 2.5k Jan 6, 2023
A python library for Bayesian time series modeling

PyDLM Welcome to pydlm, a flexible time series modeling library for python. This library is based on the Bayesian dynamic linear model (Harrison and W

Sam 438 Dec 17, 2022
An open source framework that provides a simple, universal API for building distributed applications. Ray is packaged with RLlib, a scalable reinforcement learning library, and Tune, a scalable hyperparameter tuning library.

Ray provides a simple, universal API for building distributed applications. Ray is packaged with the following libraries for accelerating machine lear

null 23.3k Dec 31, 2022
Probabilistic time series modeling in Python

GluonTS - Probabilistic Time Series Modeling in Python GluonTS is a Python toolkit for probabilistic time series modeling, built around Apache MXNet (

Amazon Web Services - Labs 3.3k Jan 3, 2023
A Python package for time series classification

pyts: a Python package for time series classification pyts is a Python package for time series classification. It aims to make time series classificat

Johann Faouzi 1.4k Jan 1, 2023
Python module for machine learning time series:

seglearn Seglearn is a python package for machine learning time series or sequences. It provides an integrated pipeline for segmentation, feature extr

David Burns 536 Dec 29, 2022
A Python toolkit for rule-based/unsupervised anomaly detection in time series

Anomaly Detection Toolkit (ADTK) Anomaly Detection Toolkit (ADTK) is a Python package for unsupervised / rule-based time series anomaly detection. As

Arundo Analytics 888 Dec 30, 2022
AtsPy: Automated Time Series Models in Python (by @firmai)

Automated Time Series Models in Python (AtsPy) SSRN Report Easily develop state of the art time series models to forecast univariate data series. Simp

Derek Snow 465 Jan 2, 2023
A Python implementation of GRAIL, a generic framework to learn compact time series representations.

GRAIL A Python implementation of GRAIL, a generic framework to learn compact time series representations. Requirements Python 3.6+ numpy scipy tslearn

null 3 Nov 24, 2021
PyPOTS - A Python Toolbox for Data Mining on Partially-Observed Time Series

A python toolbox/library for data mining on partially-observed time series, supporting tasks of forecasting/imputation/classification/clustering on incomplete multivariate time series with missing values.

Wenjie Du 179 Dec 31, 2022
A machine learning toolkit dedicated to time-series data

tslearn The machine learning toolkit for time series analysis in Python Section Description Installation Installing the dependencies and tslearn Getti

null 2.3k Jan 5, 2023
Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.

Prophet: Automatic Forecasting Procedure Prophet is a procedure for forecasting time series data based on an additive model where non-linear trends ar

Facebook 15.4k Jan 7, 2023
Automatic extraction of relevant features from time series:

tsfresh This repository contains the TSFRESH python package. The abbreviation stands for "Time Series Feature extraction based on scalable hypothesis

Blue Yonder GmbH 7k Jan 6, 2023
A unified framework for machine learning with time series

Welcome to sktime A unified framework for machine learning with time series We provide specialized time series algorithms and scikit-learn compatible

The Alan Turing Institute 6k Jan 6, 2023
A machine learning toolkit dedicated to time-series data

tslearn The machine learning toolkit for time series analysis in Python Section Description Installation Installing the dependencies and tslearn Getti

null 2.3k Dec 29, 2022