Convert Figma logo to code with AI

RJT1990 logopyflux

Open source time series library for Python

2,106
240
2,106
93

Top Related Projects

Statsmodels: statistical modeling and econometrics in Python

18,260

Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.

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

1,853

A Python package for Bayesian forecasting with object-oriented design and probabilistic models under the hood.

7,734

A unified framework for machine learning with time series

Lightning ⚡️ fast forecasting with statistical and econometric models.

Quick Overview

PyFlux is an open-source time series analysis library for Python. It provides a range of modern time series models, including ARIMA, GARCH, and state space models, with a focus on Bayesian inference and stochastic volatility models. PyFlux aims to make time series modeling more accessible and flexible for data scientists and researchers.

Pros

  • Offers a wide variety of time series models, including advanced Bayesian and stochastic volatility models
  • Provides a consistent API across different model types, making it easy to switch between models
  • Includes built-in plotting and diagnostics tools for model evaluation
  • Supports both classical and Bayesian inference methods

Cons

  • Less actively maintained compared to some other time series libraries
  • Documentation could be more comprehensive and up-to-date
  • May have a steeper learning curve for users not familiar with Bayesian methods
  • Performance may be slower compared to some other specialized time series libraries

Code Examples

  1. Fitting an ARIMA model:
import pyflux as pf
import pandas as pd

data = pd.read_csv('your_data.csv')
model = pf.ARIMA(data=data, ar=1, ma=1, target='y')
result = model.fit()
print(result.summary())
  1. Forecasting with a GARCH model:
import pyflux as pf
import pandas as pd

data = pd.read_csv('stock_returns.csv')
model = pf.GARCH(data=data, p=1, q=1, target='returns')
model.fit()
forecast = model.predict(h=5)
print(forecast)
  1. Plotting model results:
import pyflux as pf
import pandas as pd
import matplotlib.pyplot as plt

data = pd.read_csv('time_series_data.csv')
model = pf.GAS(data=data, ar=1, sc=1, family=pf.Normal())
model.fit()
model.plot_fit()
plt.show()

Getting Started

To get started with PyFlux, follow these steps:

  1. Install PyFlux using pip:

    pip install pyflux
    
  2. Import the library and load your data:

    import pyflux as pf
    import pandas as pd
    
    data = pd.read_csv('your_data.csv')
    
  3. Choose a model and fit it to your data:

    model = pf.ARIMA(data=data, ar=1, ma=1, target='y')
    result = model.fit()
    
  4. Analyze the results and make predictions:

    print(result.summary())
    forecast = model.predict(h=5)
    print(forecast)
    

Competitor Comparisons

Statsmodels: statistical modeling and econometrics in Python

Pros of statsmodels

  • More comprehensive and widely used in the statistical community
  • Extensive documentation and active community support
  • Broader range of statistical models and methods available

Cons of statsmodels

  • Steeper learning curve for beginners
  • Can be slower for certain operations compared to PyFlux
  • Less focus on time series analysis compared to PyFlux's specialization

Code Comparison

statsmodels:

import statsmodels.api as sm
model = sm.OLS(y, X).fit()
predictions = model.predict(X_new)

PyFlux:

import pyflux as pf
model = pf.ARIMA(data=data, ar=1, ma=1, target='y')
model.fit()
predictions = model.predict(h=5)

Summary

statsmodels offers a more comprehensive suite of statistical tools with extensive documentation and community support. However, it may have a steeper learning curve and be slower for certain operations. PyFlux, on the other hand, specializes in time series analysis and may be more user-friendly for beginners in this specific domain. The code comparison shows that both libraries have different approaches to model creation and prediction, with PyFlux focusing on time series models like ARIMA.

18,260

Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.

Pros of Prophet

  • More active development and larger community support
  • Handles seasonality and holidays automatically
  • User-friendly interface with minimal statistical knowledge required

Cons of Prophet

  • Less flexible for custom model specifications
  • Can be slower for large datasets
  • Limited to additive models, may not handle multiplicative trends well

Code Comparison

Prophet:

from fbprophet import Prophet
m = Prophet()
m.fit(df)
future = m.make_future_dataframe(periods=365)
forecast = m.predict(future)

PyFlux:

from pyflux import ARIMA
model = ARIMA(data=df, ar=1, ma=1, integ=1)
model.fit("MLE")
forecast = model.predict(h=365)

Prophet focuses on ease of use with automatic parameter selection, while PyFlux offers more control over model specification. Prophet is better suited for quick forecasting with minimal setup, whereas PyFlux provides more flexibility for advanced users who want to fine-tune their models.

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

Pros of pmdarima

  • More active development and maintenance
  • Better documentation and examples
  • Wider range of ARIMA-based models, including auto-ARIMA

Cons of pmdarima

  • Focused primarily on ARIMA models, less versatile for other time series methods
  • Steeper learning curve for beginners

Code Comparison

pmdarima:

from pmdarima import auto_arima

model = auto_arima(y, seasonal=True, m=12)
forecast = model.predict(n_periods=5)

pyflux:

from pyflux import ARIMA

model = ARIMA(data=data, ar=1, ma=1, integ=1)
model.fit()
forecast = model.predict(h=5)

Both libraries offer ARIMA modeling capabilities, but pmdarima provides an auto-ARIMA function for automatic model selection. pyflux requires manual specification of ARIMA parameters but offers a wider range of time series models beyond ARIMA.

pmdarima is more suitable for users focused on ARIMA modeling with automated processes, while pyflux provides a broader set of time series models for users who need more flexibility in their analysis approach.

1,853

A Python package for Bayesian forecasting with object-oriented design and probabilistic models under the hood.

Pros of Orbit

  • More active development and maintenance
  • Broader range of forecasting models, including Bayesian structural time series
  • Better documentation and examples for practical use cases

Cons of Orbit

  • Steeper learning curve due to more complex models
  • Potentially slower execution for simpler forecasting tasks
  • Requires more dependencies and setup

Code Comparison

Pyflux example:

from pyflux import ARIMA

model = ARIMA(data=y, ar=1, ma=1, integ=1)
model.fit("MLE")
model.plot_fit()

Orbit example:

from orbit.models import DLT

model = DLT(response_col='y', date_col='ds')
model.fit(df)
predicted_df = model.predict(df)

Both libraries offer concise model creation and fitting, but Orbit's syntax is more aligned with modern data science practices, using DataFrame inputs and offering more flexibility in model configuration.

7,734

A unified framework for machine learning with time series

Pros of sktime

  • More comprehensive and actively maintained, with regular updates and a larger community
  • Offers a wider range of time series algorithms and models
  • Provides a unified interface for various time series tasks, including forecasting, classification, and clustering

Cons of sktime

  • Steeper learning curve due to its more complex architecture
  • May be overkill for simpler time series tasks
  • Requires more dependencies, potentially leading to longer setup times

Code Comparison

sktime example:

from sktime.forecasting.naive import NaiveForecaster
from sktime.datasets import load_airline

y = load_airline()
forecaster = NaiveForecaster(strategy="mean")
forecaster.fit(y)
y_pred = forecaster.predict(fh=[1,2,3])

pyflux example:

import pyflux as pf
import pandas as pd

data = pd.read_csv('data.csv')
model = pf.ARIMA(data=data, ar=1, ma=1, target='y')
model.fit()
model.plot_predict(h=10)

Both libraries offer time series forecasting capabilities, but sktime provides a more standardized interface across different algorithms, while pyflux focuses on specific time series models with a simpler API.

Lightning ⚡️ fast forecasting with statistical and econometric models.

Pros of statsforecast

  • More active development and maintenance
  • Broader range of statistical forecasting models
  • Better performance for large-scale forecasting tasks

Cons of statsforecast

  • Less focus on Bayesian methods
  • Steeper learning curve for users new to forecasting

Code comparison

statsforecast:

from statsforecast import StatsForecast
from statsforecast.models import AutoARIMA

sf = StatsForecast(
    models=[AutoARIMA()],
    freq='D',
    n_jobs=-1
)
forecasts = sf.forecast(df=data, h=30)

pyflux:

from pyflux import ARIMA

model = ARIMA(data=data, ar=1, ma=1, integ=1)
model.fit("MLE")
forecasts = model.predict(h=30)

Both libraries offer time series forecasting capabilities, but statsforecast provides a more modern and scalable approach, while pyflux focuses on Bayesian methods and offers a simpler API for certain models. statsforecast is more actively maintained and suitable for large-scale forecasting tasks, while pyflux may be preferred for specific Bayesian applications or users seeking a simpler interface for certain models.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

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