Skip to main content

Deep learning models for forecasting purposes.

Project description

Welcome to Autopycoin


ci_autopycoin CircleCI codecov Documentation Status

This is a deep learning package based on tensorflow and maintained by a group of french students and used in a their final master project. All the models are the Unofficial implementations.

Available Models


from autopycoin.models import create_interpretable_nbeats, create_interpretable_nbeats, NBEATS, PoolNBEATS
Model epistemic error Aleotoric error Paper
NBEATS Dropout or bagging Quantiles Paper

Available Losses


from autopycoin.losses import QuantileLossError, SymetricMeanAbsolutePercentageError
Losses
QuantileLosseError
SymetricMeanAbsolutePercentageError

Dataset maker


from autopycoin.dataset import WindowGenerator
Dataset maker
WindowGenerator

How to use autopycoin


pip install autopycoin

Univariate time series


from autopycoin.models import create_interpretable_nbeats
from autopycoin.losses import QuantileLossError
from autopycoin.dataset import WindowGenerator

import pandas as pd

# Let's suppose we have a pandas time series
data = pd.DataFrame([
    [0, 0],
    [1, 1],
    [2, 2],
    [3, 3],
    [4, 4],
    [5, 5],
    [6, 6],
    [7, 7],
    [8, 8],
    [9, 9],
    [10, 10]
    ])

w_oneshot = WindowGenerator(input_width=3, # Input width used for the model
                            label_width=2, # label width used for the model
                            shift=2, # if shift < label_width then input and label will overlap each other
                            valid_size=2, # Defines your validation set size (if int then this is the number of instances else float this the percentage of your dataset)
                            test_size=1, # The same
                            flat=True, # flat to true to flatten the input (don't use multivariate time series) 
                            batch_size=None,
                            preprocessing=None # function to apply to the input  
                            )

# Let suppose that tthe columns 0 is the one we want to predict
w_oneshot = w_oneshot.from_array(
    data,
    input_columns=[0],
    label_columns=[0])

# w_oneshot is then our dataset maker

model = create_interpretable_nbeats(label_width=w_oneshot.label_width)

model.compile(loss=QuantileLossError(quantiles=[0.5]))

# fit
model.fit(w_oneshot.train, validation_data=w_oneshot.valid)

model.predict(w_oneshot.test)

Multivariate time series


from autopycoin.models import create_interpretable_nbeats
from autopycoin.losses import QuantileLossError
from autopycoin.dataset import WindowGenerator

import pandas as pd

# The same example
data = pd.DataFrame([
    [0, 0],
    [1, 1],
    [2, 2],
    [3, 3],
    [4, 4],
    [5, 5],
    [6, 6],
    [7, 7],
    [8, 8],
    [9, 9],
    [10, 10]
    ])

w_oneshot = WindowGenerator(input_width=3, # Input width used for the model
                            label_width=2, # label width used for the model
                            shift=2, # if shift < label_width then input and label will overlap each other
                            valid_size=2, # Defines your validation set size (if int then this is the number of instances else float this the percentage of your dataset)
                            test_size=1, # The same
                            flat=False, # flat to False
                            batch_size=None,
                            preprocessing=None # function to apply to the input  
                            )

# This is an univariate model hence input_columns and label_columns has to be equal
w_oneshot = w_oneshot.from_array(
    data,
    input_columns=[0, 1], 
    label_columns=[0, 1])

# w_oneshot is then our dataset maker

model = create_interpretable_nbeats(label_width=w_oneshot.label_width)

model.compile(loss=QuantileLossError(quantiles=[0.5]))

# fit
model.fit(w_oneshot.train, validation_data=w_oneshot.valid)

model.predict(w_oneshot.test) # The last dim corresponds to the variables

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autopycoin-0.1.17.tar.gz (68.5 kB view hashes)

Uploaded Source

Built Distribution

autopycoin-0.1.17-py3-none-any.whl (78.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page