Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
PyAF is an Open Source Python library for Automatic Forecasting built on top of popular data science python modules: NumPy, SciPy, Pandas and scikit-learn.
PyAF works as an automated process for predicting future values of a signal using a machine learning approach. It provides a set of features that is comparable to some popular commercial automatic forecasting products.
PyAF has been developed, tested and benchmarked using a python 3.x version.
PyAF is distributed under the 3-Clause BSD license.
import numpy as np, pandas as pd
import pyaf.ForecastEngine as autof
if __name__ == '__main__':
# generate a daily signal covering one year 2016 in a pandas dataframe
N = 360
df_train = pd.DataFrame({"Date": pd.date_range(start="2016-01-25", periods=N, freq='D'),
"Signal": (np.arange(N)//40 + np.arange(N) % 21 + np.random.randn(N))})
# create a forecast engine, the main object handling all the operations
lEngine = autof.cForecastEngine()
# get the best time series model for predicting one week
lEngine.train(iInputDS=df_train, iTime='Date', iSignal='Signal', iHorizon=7);
lEngine.getModelInfo() # => relative error 7% (MAPE)
# predict one week
df_forecast = lEngine.forecast(iInputDS=df_train, iHorizon=7)
# list the columns of the forecast dataset
print(df_forecast.columns)
# print the real forecasts
# Future dates : ['2017-01-19T00:00:00.000000000' '2017-01-20T00:00:00.000000000' '2017-01-21T00:00:00.000000000' '2017-01-22T00:00:00.000000000' '2017-01-23T00:00:00.000000000' '2017-01-24T00:00:00.000000000' '2017-01-25T00:00:00.000000000']
print(df_forecast['Date'].tail(7).values)
# signal forecast : [ 9.74934646 10.04419761 12.15136455 12.20369717 14.09607727 15.68086323 16.22296559]
print(df_forecast['Signal_Forecast'].tail(7).values)
also availabe as a jupyter notebook
PyAF allows forecasting a time series (or a signal) for future values in a fully automated way. To build forecasts, PyAF allows using time information (by identifying long-term evolution and periodic patterns), analyzes the past of the signal, exploits exogenous data (user-provided time series that may be correlated with the signal) as well as the hierarchical structure of the signal (by aggregating spatial components forecasts, for example).
PyAF uses Pandas as a data access layer. It consumes data coming from a pandas data- frame (with time and signal columns), builds a time series model, and outputs the forecasts in a pandas data-frame. Pandas is an excellent data access layer, it allows reading/writing a huge set of file formats, accessing various data sources (databases) and has an extensive set of algorithms to handle data- frames (aggregation, statistics, linear algebra, plotting, etc.).
PyAF statistical time series models are built/estimated/trained using scikit-learn.
The following features are available :
PyAF is a work in progress. The set of features is evolving. Your feature requests, comments, help, hints are very welcome.
PyAF has been developed, tested and used on a python 3.x version.
It can be installed from PyPI for the latest official release:
pip install pyaf
The development version is also available by executing:
pip install scipy pandas scikit-learn matplotlib pydot xgboost statsmodels
pip install --upgrade git+git://github.com/antoinecarme/pyaf.git
Code contributions are welcome. Bug reports, request for new features and documentation, tests are welcome. Please use the GitHub platform for these tasks.
You can check the latest sources of PyAF from GitHub with the command::
git clone http://github.com/antoinecarme/pyaf.git
This project was started in summer 2016 as a POC to check the feasibility of an automatic forecasting tool based only on Python available data science software (NumPy, SciPy, Pandas, scikit-learn, etc.).
See the AUTHORS.rst file for a complete list of contributors.
PyAF is currently maintained by the original developer. PyAF support will be provided when possible and even if you are not creating an issue, you are encouraged to follow these guidelines.
Bug reports, improvement requests, documentation, hints and test scripts are welcome. Please use the GitHub platform for these tasks.
Please don't ask too much about new features. PyAF is only about forecasting (the last F). To keep PyAF design simple and flexible, we avoid Feature Creep.
For your commercial forecasting projects, please consider using the services of a forecasting expert near you (be it an R or a Python expert).
An introductory notebook to the time series forecasting with PyAF is available here. It contains some real-world examples and use cases.
A specific notebook describing the use of exogenous data is available here.
Notebooks describing an example of hierarchical forecasting models are available for Signal Hierarchies and for Grouped Signals.
The python code is not yet fully documented. This is a top priority (TODO).
Comments, appreciations, remarks, etc .... are welcome. Your feedback is welcome if you use this library in a project or a publication.
FAQs
Python Automatic Forecasting
We found that pyaf demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.