How to use the pmdarima.datasets.load_lynx function in pmdarima

To help you get started, we’ve selected a few pmdarima examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alkaline-ml / pmdarima / examples / arima / example_add_new_samples.py View on Github external
.. raw:: html

   <br>
"""
print(__doc__)

# Author: Taylor Smith 

import pmdarima as pm
from pmdarima import model_selection
import matplotlib.pyplot as plt
import numpy as np

# #############################################################################
# Load the data and split it into separate pieces
data = pm.datasets.load_lynx()
train, test = model_selection.train_test_split(data, train_size=100)

# #############################################################################
# Fit with some validation (cv) samples
arima = pm.auto_arima(train, start_p=1, start_q=1, d=0, max_p=5, max_q=5,
                      out_of_sample_size=10, suppress_warnings=True,
                      stepwise=True, error_action='ignore')

# Now plot the results and the forecast for the test set
preds, conf_int = arima.predict(n_periods=test.shape[0],
                                return_conf_int=True)

fig, axes = plt.subplots(2, 1, figsize=(12, 8))
x_axis = np.arange(train.shape[0] + preds.shape[0])
axes[0].plot(x_axis[:train.shape[0]], train, alpha=0.75)
axes[0].scatter(x_axis[train.shape[0]:], preds, alpha=0.4, marker='o')
github alkaline-ml / pmdarima / examples / datasets / example_load_data.py View on Github external
used for benchmarking or experimentation. Pyramid has several built-in datasets
that exhibit seasonality, non-stationarity, and other time series nuances.

.. raw:: html

   <br>
"""
print(__doc__)

# Author: Taylor Smith 

import pmdarima as pm

# #############################################################################
# You can load the datasets via load_
lynx = pm.datasets.load_lynx()
print("Lynx array:")
print(lynx)

# You can also get a series, if you rather
print("\nLynx series head:")
print(pm.datasets.load_lynx(as_series=True).head())

# Several other datasets:
heart_rate = pm.datasets.load_heartrate()
wineind = pm.datasets.load_wineind()
woolyrnq = pm.datasets.load_woolyrnq()
github DUanalytics / pyAnalytics / 88-TS / 88P_pmdarima_ds.py View on Github external
#%%%% 
import pmdarima.datasets as pm

#Air Passengers
#The classic Box &amp; Jenkins airline data. Monthly totals of international airline passengers, 1949 to 1960.
pm.load_airpassengers(True).head()
#7.2. Austres
#Numbers (in thousands) of Australian residents measured quarterly from March 1971 to March 1994. The sample consists of 89 records on a quarterly basis.
pm.load_austres(True).head()
#Heartrate - The heart rate data records sample of heartrate data borrowed from an MIT database. The sample consists of 150 evenly spaced (0.5 seconds) heartrate measurements.
pm.load_heartrate(True).head()
pm.load_heartrate(True)
#Lynx dataset records the number of skins of predators (lynx) that were collected over many years by the Hudson’s Bay Company (1821 - 1934). It’s commonly used for time-series benchmarking (Brockwell and Davis - 1991) and is built into R. The dataset exhibits a clear 10-year cycle.
pm.load_lynx(as_series=True).head()
pm.load_lynx(as_series=True)
#Wineind -This time-series records total wine sales by Australian wine makers in bottles &lt;= 1 litre between Jan 1980 – Aug 1994. This dataset is found in the R forecast package.
pm.load_wineind(as_series=True).head()
pm.load_wineind(as_series=True)
#Woolyrnq - A time-series that records the quarterly production (in tonnes) of woollen yarn in Australia between Mar 1965 and Sep 1994. This dataset is found in the R forecast package.
pm.load_woolyrnq(True).head()
pm.load_woolyrnq(as_series=True)
github alkaline-ml / pmdarima / develop / _downloads / example_add_new_samples.py View on Github external
.. raw:: html

   <br>
"""
print(__doc__)

# Author: Taylor Smith 

import pmdarima as pm
import matplotlib.pyplot as plt
import numpy as np

# #############################################################################
# Load the data and split it into separate pieces
data = pm.datasets.load_lynx()
train, test = data[:100], data[100:]

# #############################################################################
# Fit with some validation (cv) samples
arima = pm.auto_arima(train, start_p=1, start_q=1, d=0, max_p=5, max_q=5,
                      out_of_sample_size=10, suppress_warnings=True,
                      stepwise=True, error_action='ignore')

# Now plot the results and the forecast for the test set
preds, conf_int = arima.predict(n_periods=test.shape[0],
                                return_conf_int=True)

fig, axes = plt.subplots(2, 1, figsize=(12, 8))
x_axis = np.arange(train.shape[0] + preds.shape[0])
axes[0].plot(x_axis[:train.shape[0]], train, alpha=0.75)
axes[0].scatter(x_axis[train.shape[0]:], preds, alpha=0.4, marker='o')
github alkaline-ml / pmdarima / examples / datasets / example_load_data.py View on Github external
"""
print(__doc__)

# Author: Taylor Smith 

import pmdarima as pm

# #############################################################################
# You can load the datasets via load_
lynx = pm.datasets.load_lynx()
print("Lynx array:")
print(lynx)

# You can also get a series, if you rather
print("\nLynx series head:")
print(pm.datasets.load_lynx(as_series=True).head())

# Several other datasets:
heart_rate = pm.datasets.load_heartrate()
wineind = pm.datasets.load_wineind()
woolyrnq = pm.datasets.load_woolyrnq()
github DUanalytics / pyAnalytics / 88-TS / 88P_pmdarima_ds.py View on Github external
woolyrnq

#%%%% 
import pmdarima.datasets as pm

#Air Passengers
#The classic Box &amp; Jenkins airline data. Monthly totals of international airline passengers, 1949 to 1960.
pm.load_airpassengers(True).head()
#7.2. Austres
#Numbers (in thousands) of Australian residents measured quarterly from March 1971 to March 1994. The sample consists of 89 records on a quarterly basis.
pm.load_austres(True).head()
#Heartrate - The heart rate data records sample of heartrate data borrowed from an MIT database. The sample consists of 150 evenly spaced (0.5 seconds) heartrate measurements.
pm.load_heartrate(True).head()
pm.load_heartrate(True)
#Lynx dataset records the number of skins of predators (lynx) that were collected over many years by the Hudson’s Bay Company (1821 - 1934). It’s commonly used for time-series benchmarking (Brockwell and Davis - 1991) and is built into R. The dataset exhibits a clear 10-year cycle.
pm.load_lynx(as_series=True).head()
pm.load_lynx(as_series=True)
#Wineind -This time-series records total wine sales by Australian wine makers in bottles &lt;= 1 litre between Jan 1980 – Aug 1994. This dataset is found in the R forecast package.
pm.load_wineind(as_series=True).head()
pm.load_wineind(as_series=True)
#Woolyrnq - A time-series that records the quarterly production (in tonnes) of woollen yarn in Australia between Mar 1965 and Sep 1994. This dataset is found in the R forecast package.
pm.load_woolyrnq(True).head()
pm.load_woolyrnq(as_series=True)
github DUanalytics / pyAnalytics / 88-TS / 88P_pmdarima_lynx.py View on Github external
plt.plot(x_years[x_axis[:train.shape[0]]], train, alpha=0.75)
plt.plot(x_years[x_axis[train.shape[0]:]], preds, alpha=0.75)  # Forecasts
plt.scatter(x_years[x_axis[train.shape[0]:]], test, alpha=0.4, marker='x')  # Test data
plt.fill_between(x_years[x_axis[-preds.shape[0]:]], conf_int[:, 0], conf_int[:, 1], alpha=0.1, color='b')
plt.title("Lynx forecasts")
plt.xlabel("Year");


#%%%%%
import pmdarima as pm
import matplotlib.pyplot as plt
import numpy as np

###########################################
# Load the data and split it into separate pieces
data = pm.datasets.load_lynx()
data.shape  #0-99,100 to 114
train, test = data[:100], data[100:]

####################################################################
# Fit with some validation (cv) samples
arima = pm.auto_arima(train, start_p=1, start_q=1, d=0, max_p=5, max_q=5,  out_of_sample_size=10, suppress_warnings=True,   stepwise=True, error_action='ignore')

# Now plot the results and the forecast for the test set
preds, conf_int = arima.predict(n_periods=test.shape[0], return_conf_int =True)
preds
fig, axes = plt.subplots(2, 1, figsize=(12, 8))
x_axis = np.arange(train.shape[0] + preds.shape[0])
axes[0].plot(x_axis[:train.shape[0]], train, alpha=0.75)
axes[0].scatter(x_axis[train.shape[0]:], preds, alpha=0.4, marker='o')
axes[0].scatter(x_axis[train.shape[0]:], test, alpha=0.4, marker='x')
axes[0].fill_between(x_axis[-preds.shape[0]:], conf_int[:, 0], conf_int[:, 1],alpha=0.1, color='b')