Git Product home page Git Product logo

scalecast's Introduction

Scalecast

Scalecast Logo

About

Scalecast helps you forecast time series. Here is how to initiate its main object:

from scalecast.Forecaster import Forecaster

f = Forecaster(
    y = array_of_values,
    current_dates = array_of_dates,
    future_dates=fcst_horizon_length,
    test_length = 0, # do you want to test all models? if so, on how many or what percent of observations?
    cis = False, # evaluate conformal confidence intervals for all models?
    metrics = ['rmse','mape','mae','r2'], # what metrics to evaluate over the validation/test sets?
)

Uniform ML modeling (with models from a diverse set of libraries, including scikit-learn, statsmodels, and tensorflow), reporting, and data visualizations are offered through the Forecaster and MVForecaster interfaces. Data storage and processing then becomes easy as all applicable data, predictions, and many derived metrics are contained in a few objects with much customization available through different modules. Feature requests and issue reporting are welcome! Don't forget to leave a star!⭐

Documentation

Popular Features

  1. Easy LSTM Modeling: setting up an LSTM model for time series using tensorflow is hard. Using scalecast, it's easy. Many tutorials and Kaggle notebooks that are designed for those getting to know the model use scalecast (see the aritcle).
f.set_estimator('lstm')
f.manual_forecast(
    lags=36,
    batch_size=32,
    epochs=15,
    validation_split=.2,
    activation='tanh',
    optimizer='Adam',
    learning_rate=0.001,
    lstm_layer_sizes=(100,)*3,
    dropout=(0,)*3,
)
  1. Auto lag, trend, and seasonality selection:
f.auto_Xvar_select( # iterate through different combinations of covariates
    estimator = 'lasso', # what estimator?
    alpha = .2, # estimator hyperparams?
    monitor = 'ValidationMetricValue', # what metric to monitor to make decisions?
    cross_validate = True, # cross validate
    cvkwargs = {'k':3}, # 3 folds
)
  1. Hyperparameter tuning using grid search and time series cross validation:
from scalecast import GridGenerator

GridGenerator.get_example_grids()
models = ['ridge','lasso','xgboost','lightgbm','knn']
f.tune_test_forecast(
    models,
    limit_grid_size = .2,
    feature_importance = True, # save pfi feature importance for each model?
    cross_validate = True, # cross validate? if False, using a seperate validation set that the user can specify
    rolling = True, # rolling time series cross validation?
    k = 3, # how many folds?
)
  1. Plotting results: plot test predictions, forecasts, fitted values, and more.
import matplotlib.pyplot as plt

fig, ax = plt.subplots(2,1, figsize = (12,6))
f.plot_test_set(models=models,order_by='TestSetRMSE',ax=ax[0])
f.plot(models=models,order_by='TestSetRMSE',ax=ax[1])
plt.show()
  1. Pipelines that include transformations, reverting, and backtesting:
from scalecast import GridGenerator
from scalecast.Pipeline import Transformer, Reverter, Pipeline
from scalecast.util import find_optimal_transformation, backtest_metrics

def forecaster(f):
    models = ['ridge','lasso','xgboost','lightgbm','knn']
    f.tune_test_forecast(
        models,
        limit_grid_size = .2, # randomized grid search on 20% of original grid sizes
        feature_importance = True, # save pfi feature importance for each model?
        cross_validate = True, # cross validate? if False, using a seperate validation set that the user can specify
        rolling = True, # rolling time series cross validation?
        k = 3, # how many folds?
    )

transformer, reverter = find_optimal_transformation(f) # just one of several ways to select transformations for your series

pipeline = Pipeline(
    steps = [
        ('Transform',transformer),
        ('Forecast',forecaster),
        ('Revert',reverter),
    ]
)

f = pipeline.fit_predict(f)
backtest_results = pipeline.backtest(f)
metrics = backtest_metrics(backtest_results)
  1. Model stacking: There are two ways to stack models with scalecast, with the StackingRegressor from scikit-learn or using its own stacking procedure.
from scalecast.auxmodels import auto_arima

f.set_estimator('lstm')
f.manual_forecast(
    lags=36,
    batch_size=32,
    epochs=15,
    validation_split=.2,
    activation='tanh',
    optimizer='Adam',
    learning_rate=0.001,
    lstm_layer_sizes=(100,)*3,
    dropout=(0,)*3,
)

f.set_estimator('prophet')
f.manual_forecast()

auto_arima(f)

# stack previously evaluated models
f.add_signals(['lstm','prophet','arima'])
f.set_estimator('catboost')
f.manual_forecast()
  1. Multivariate modeling and multivariate pipelines:
from scalecast.MVForecaster import MVForecaster
from scalecast.Pipeline import MVPipeline
from scalecast.util import find_optimal_transformation, backtest_metrics
from scalecast import GridGenerator

GridGenerator.get_mv_grids()

def mvforecaster(mvf):
    models = ['ridge','lasso','xgboost','lightgbm','knn']
    mvf.tune_test_forecast(
        models,
        limit_grid_size = .2, # randomized grid search on 20% of original grid sizes
        cross_validate = True, # cross validate? if False, using a seperate validation set that the user can specify
        rolling = True, # rolling time series cross validation?
        k = 3, # how many folds?
    )

mvf = MVForecaster(f1,f2,f3) # can take N Forecaster objects

transformer1, reverter1 = find_optimal_transformation(f1)
transformer2, reverter2 = find_optimal_transformation(f2)
transformer3, reverter3 = find_optimal_transformation(f3)

pipeline = MVPipeline(
    steps = [
        ('Transform',[transformer1,transformer2,transformer3]),
        ('Forecast',mvforecaster),
        ('Revert',[reverter1,reverter2,reverter3])
    ]
)

f1, f2, f3 = pipeline.fit_predict(f1, f2, f3)
backtest_results = pipeline.backtest(f1, f2, f3)
metrics = backtest_metrics(backtest_results)
  1. Transfer Learning (new with 0.19.0): Train a model in one Forecaster object and use that model to make predictions on the data in a separate Forecaster object.
f = Forecaster(...)
f.auto_Xvar_select()
f.set_estimator('xgboost')
f.cross_validate()
f.auto_forecast()

f_new = Forecaster(...) # different series than f
f_new = infer_apply_Xvar_selection(infer_from=f,apply_to=f_new)
f_new.transfer_predict(transfer_from=f,model='xgboost') # transfers the xgboost model from f to f_new

Installation

  • Only the base package is needed to get started:
    • pip install --upgrade scalecast
  • Optional add-ons:
    • pip install tensorflow (for RNN/LSTM on Windows) or pip install tensorflow-macos (for MAC/M1)
    • pip install darts
    • pip install prophet
    • pip install greykite (for the silverkite model)
    • pip install kats (changepoint detection)
    • pip install pmdarima (auto arima)
    • pip install tqdm (progress bar for notebook)
    • pip install ipython (widgets for notebook)
    • pip install ipywidgets (widgets for notebook)
    • jupyter nbextension enable --py widgetsnbextension (widgets for notebook)
    • jupyter labextension install @jupyter-widgets/jupyterlab-manager (widgets for Lab)

Articles and Links

Confidence Intervals

Dynamic Validation

Model Input Selection

Scaled Forecasting on Many Series

Transfer Learning

Anomaly Detection

Contributing

scalecast's People

Contributors

mikekeith52 avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

scalecast's Issues

Ability to set a call_me for default tune_test_forecast or to pass validation methods for tune_test_forecast

I would like to be able to choose a model, and run the same model multiple times with slightly different validation methods to determine the exact best process. I can create a manual function like below, but the issue comes with not being able to call tune_test_forecast() in the same way.

def model_validation(f, fcst=12):
    top_models = export_results(f).ModelNickname.tolist()
    for model in top_models:
        
        f.set_estimator(model)


        f.ingest_grid(model)
        f.limit_grid_size(.75,random_seed=20) # limits grid to .75 its original size

        print(f'Working on {model}')
        
        f.manual_forecast(call_me=model + "_dynamic")  # default is dynamic testing
        print('done with manual')


        f.tune(dynamic_tuning=True)
        f.auto_forecast(call_me=model + "_tuned")  # automatically uses optimal paramaeters suggested from the tuning process
        print('done with dynamic tuning')


        f.limit_grid_size(.5,random_seed=20) # limits grid to half its original size    
        f.tune(dynamic_tuning=fcst)
        f.auto_forecast(call_me=model + "_short_tuned")  # automatically uses optimal paramaeters suggested from the tuning process
        print('done with dynamic short tuning')

        f.cross_validate(k=5, dynamic_tuning=True)
        f.auto_forecast(call_me=model + "_cv")
        print('done with cv')


        f.cross_validate(k=5, rolling=True, dynamic_tuning=True)
        f.auto_forecast(call_me=model + "_rolling_cv")
        print('done with rolling cv')

        f.cross_validate(k=5, rolling=True, dynamic_tuning=fcst)
        f.auto_forecast(call_me=model + "_short_rolling_cv")
        print('done with short rolling cv')

        print(f"\nCompleted {model}")
        print('-'*100)
    print('Completed!')

Return a dataframe for the forecasted future values

image
I have the future forecast and able to plot it by setting f.fututre_genrations(), but I am not able to retrieve those values as dataframe. Like none of this includes a dataframe to return the result of fufture generations "dfs=['model_summaries','lvl_fcsts','lvl_test_set_predictions']"

Update export() methods to include CIs more easily + at level=True

This may already be a feature, but i think some of the export methods could be retooled.

Specifically, I would like to pull the CIs for test set predictions and forecasts at the level=True.

export_forecasts_with_cis and export_test set_preds_with_cis don’t currently have a level value to call on according to the docs.

Additionally, it would be nice to be able to call these dfs in the .export() method. This way, I can more easily call the functions for a list of models.

Error during plotting

I get this error when I try to plot
OptionError: "No such keys(s): 'mode.use_inf_as_null'"

Error with Forecaster Attribute 'validation_metric_value'

Hey, I've just started using Scalecast, and was trying to use the RandomForest Model. After initializing Forecaster and adding COVID19 Regressor and Time Trend, I got the error:

AttributeError: 'Forecaster' object has no attribute 'validation_metric_value'

Here is the code that I'm running:


def plot_test_export_summaries(f):
    """ exports the relevant statisitcal information and displays a plot of the test-set results for the last model run
    """
    f.plot_test_set(models=f.estimator,include_train=False)
    plt.title(f'{f.estimator} test-set results',size=16)
    plt.show()
    return f.export('model_summaries',determine_best_by='TestSetMAPE')[
        [
            'ModelNickname',
            'HyperParams',
            'TestSetMAPE',
            'InSampleMAPE',
        ]
    ]

icms = Forecaster(y=df.ICMS, current_dates=df.DATA, test_length=12, freq='MS')
icms.generate_future_dates(12)
icms.plot()

icms.add_covid19_regressor()
icms.add_time_trend()

icms.set_estimator('rf')
rf_grid = {
    'max_depth':[2,3,4,5],
    'n_estimators':[100,200,500],
    'max_features':['auto','sqrt','log2'],
    'max_samples':[.75,.9,1],
}
icms.ingest_grid(rf_grid)
icms.auto_forecast()
plot_test_export_summaries(icms)

Full error:
Error

I'm trying to figure out what is the problem, if anyone have any suggestion, I would aprecciate.

I still want to use other models ('xgboost', 'LSTM' and 'prophet'), but I get the same error. Am I missing something?

Lags seems not working with tune_test_forecast in MVForecaster

Hello,

Thanks for your wonderful library.

Juste a note, but it seems that in MVForecaster the function tune_test_forecast does not take into account the lags.

When I check the results, everything is similar to use manual_forecast(lags=1)

I’ve tried to use add_ar in every single Forecaster used in MVForecaster but without success

I’m using the last version of the library (0.17.14)

Regards,

None doesn't work when passed to the 'Xvars' key in a grid and using cross validation

When using the cross_validate() function, it throws an error when using None as an argument:

arima_grid = {
    'order':[
        (1,0,1),
        (1,0,0),
        (0,0,1)
    ],
    'seasonal_order':[
        (1,0,1,7),
        (1,0,0,7),
        (0,0,1,7),
        (0,1,0,7)
    ],
    'Xvars':[
        None,
        [
            'monthsin',
            'monthcos',
            'quartersin',
            'quartercos',
            'dayofyearsin',
            'dayofyearcos',
            'weeksin',
            'weekcos',
        ]
    ],
}

f.ingest_grid(arima_grid)
f.cross_validate(k=3) 

image

How to use best model and transformer from forecaster pipeline on new data without actual y

Hi @mikekeith52 . Sorry to ask again. Am still getting familiar with scalecast. This is related to #57 .

I got the following from the forecaster pipeline I ran:

best model = knn
best params = {'n_neighbors': 43}
optimal transformer = Transformer(
transformers = [
('DetrendTransform', {'loess': True}),
('DiffTransform', 1),
('ScaleTransform',)
]
)
f = Forecaster(
DateStartActuals=2016-01-10T00:00:00.000000000
DateEndActuals=2021-01-10T00:00:00.000000000
Freq=None
N_actuals=260
ForecastLength=4
Xvars=['month_8', 'quarter_2', 'quarter_3', 'COVID19', 'dengue_lag_4', 'dengue_lag_5', 'dengue_lag_6', 'dengue_lag_7', 'dengue_lag_8', 'symptoms_of_dengue_lag_8']
TestLength=4
ValidationMetric=rmse
ForecastsEvaluated=['mlr', 'lasso', 'ridge', 'elasticnet', 'xgboost', 'lightgbm', 'knn']
CILevel=None
CurrentEstimator=knn
GridsFile=Grids
)

Is there a way I can use these in sklearn (if not scalecast) to forecast new values of y based on just the values of Xvars? From what I understand forecaster needs y.

I would appreciate your assistance a lot.

Forecasts with only Positive values

Another topic that may be worth talking about, add a function to the library, and potentially document it, is how to constraint the Forecasts.

For example, in my case, my dataset has always a target value y positives.
So I am looking how to constraint my forecaster to forecast only positive values. When trying to perform the automatic forecasts in function of a database, often I get models forecasting negative values, which doesn't make sense (think of y such as Pressure value or ... )
Does the library has a function that allow to do this ? One way is maybe add a Log transform then Exp reverter.

Possible Bug: f.forecast gives Index error

Problem

This looks to be very promising module. The theta example given in the tutorial runs without error. But when I tried to implement the theta forecasting using this module for my example data, I got the index error for the validation.

How to fix the IndexError?

I have created a brand new virtual environment (venv) with python 3.9 and installed darts and scaleforecast.

Reproducible Example

import numpy as np
import pandas as pd
from scalecast.Forecaster import Forecaster

col_date = 'BillingDate'
col_val = 'TotWAC'

# data
url = "https://github.com/bhishanpdl/Shared/blob/master/data/data_scalecast/df_train.csv"
dfs = pd.read_html(url)

df_train = dfs[0].iloc[:,1:]
df_train[col_date] = pd.to_datetime(df_train[col_date])

y = df_train[col_val].to_list()
current_dates = df_train[col_date].to_list()

f = Forecaster(y=y,current_dates=current_dates)

f.set_test_length(.2)
f.generate_future_dates(90)
f.set_validation_metric('mape')

from darts.utils.utils import SeasonalityMode, TrendMode, ModelMode

theta_grid = {
    'theta':[0.5,1,1.5,2,2.5,3],
    'model_mode':[
        ModelMode.ADDITIVE,
        ModelMode.MULTIPLICATIVE
    ],
    'season_mode':[
        SeasonalityMode.MULTIPLICATIVE,
        SeasonalityMode.ADDITIVE
    ],
    'trend_mode':[
        TrendMode.EXPONENTIAL,
        TrendMode.LINEAR
    ],
}

f.set_estimator('theta')
f.ingest_grid(theta_grid)
f.cross_validate(k=3)
f.auto_forecast()

Error

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Input In [9], in <cell line: 44>()
     42 f.set_estimator('theta')
     43 f.ingest_grid(theta_grid)
---> 44 f.cross_validate(k=3)
     45 f.auto_forecast()

File \venv\py39darts\lib\site-packages\scalecast\Forecaster.py:3422, in Forecaster.cross_validate(self, k, rolling, dynamic_tuning)
   3420 self.grid = grid_evaluated.iloc[:, :-3]
   3421 self.dynamic_tuning = f2.dynamic_tuning
-> 3422 self._find_best_params(grid_evaluated)
   3423 self.grid_evaluated = grid_evaluated_cv.reset_index(drop=True)
   3424 self.grid = orig_grid

File \venv\py39darts\lib\site-packages\scalecast\Forecaster.py:3434, in Forecaster._find_best_params(self, grid_evaluated)
   3429     best_params_idx = self.grid.loc[
   3430         grid_evaluated["metric_value"]
   3431         == grid_evaluated["metric_value"].max()
   3432     ].index.to_list()[0]
   3433 else:
-> 3434     best_params_idx = self.grid.loc[
   3435         grid_evaluated["metric_value"]
   3436         == grid_evaluated["metric_value"].min()
   3437     ].index.to_list()[0]
   3438 self.best_params = {
   3439     k: v[best_params_idx]
   3440     for k, v in self.grid.to_dict(orient="series").items()
   3441 }
   3442 self.best_params = {
   3443     k: (
   3444         v
   (...)
   3452     for k, v in self.best_params.items()
   3453 }

IndexError: list index out of range

System Info

$ pip freeze
absl-py==1.2.0
aiohttp==3.8.1
aiosignal==1.2.0
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
asttokens==2.0.8
astunparse==1.6.3
async-timeout==4.0.2
attrs==22.1.0
autopep8==1.7.0
backcall==0.2.0
beautifulsoup4==4.11.1
bleach==5.0.1
cachetools==5.2.0
catboost==1.0.6
certifi==2022.6.15
cffi==1.15.1
charset-normalizer==2.1.1
cmdstanpy==1.0.5
colorama==0.4.5
convertdate==2.4.0
cycler==0.11.0
Cython==0.29.32
darts==0.21.0
debugpy==1.6.3
decorator==5.1.1
defusedxml==0.7.1
eli5==0.13.0
entrypoints==0.4
ephem==4.1.3
et-xmlfile==1.1.0
executing==0.10.0
fastjsonschema==2.16.1
flatbuffers==1.12
fonttools==4.36.0
frozenlist==1.3.1
fsspec==2022.7.1
gast==0.4.0
google-auth==2.11.0
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
graphviz==0.20.1
greenlet==1.1.2
grpcio==1.47.0
h5py==3.7.0
hijri-converter==2.2.4
holidays==0.15
html5lib==1.1
idna==3.3
importlib-metadata==4.12.0
ipykernel==6.15.1
ipython==8.4.0
ipython-genutils==0.2.0
ipywidgets==8.0.1
jedi==0.18.1
Jinja2==3.1.2
joblib==1.1.0
jsonschema==4.14.0
jupyter==1.0.0
jupyter-client==7.3.4
jupyter-console==6.4.4
jupyter-contrib-core==0.4.0
jupyter-contrib-nbextensions==0.5.1
jupyter-core==4.11.1
jupyter-highlight-selected-word==0.2.0
jupyter-latex-envs==1.4.6
jupyter-nbextensions-configurator==0.5.0
jupyterlab-pygments==0.2.2
jupyterlab-widgets==3.0.2
keras==2.9.0
Keras-Preprocessing==1.1.2
kiwisolver==1.4.4
korean-lunar-calendar==0.2.1
libclang==14.0.6
lightgbm==3.3.2
llvmlite==0.39.0
LunarCalendar==0.0.9
lxml==4.9.1
Markdown==3.4.1
MarkupSafe==2.1.1
matplotlib==3.5.3
matplotlib-inline==0.1.6
mistune==2.0.4
multidict==6.0.2
nbclient==0.6.6
nbconvert==7.0.0
nbformat==5.4.0
nest-asyncio==1.5.5
nfoursid==1.0.1
notebook==6.4.12
numba==0.56.0
numpy==1.22.4
oauthlib==3.2.0
openpyxl==3.0.10
opt-einsum==3.3.0
packaging==21.3
pandas==1.4.3
pandas-datareader==0.10.0
pandocfilters==1.5.0
parso==0.8.3
patsy==0.5.2
pickleshare==0.7.5
Pillow==9.2.0
plotly==5.10.0
pmdarima==2.0.0
prometheus-client==0.14.1
prompt-toolkit==3.0.30
prophet==1.1
protobuf==3.19.4
psutil==5.9.1
pure-eval==0.2.2
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycodestyle==2.9.1
pycparser==2.21
pyDeprecate==0.3.2
Pygments==2.13.0
PyMeeus==0.5.11
pyodbc==4.0.34
pyparsing==3.0.9
pyrsistent==0.18.1
python-dateutil==2.8.2
pytorch-lightning==1.7.2
pytz==2022.2.1
pywin32==304
pywinpty==2.0.7
PyYAML==6.0
pyzmq==23.2.1
qtconsole==5.3.1
QtPy==2.2.0
requests==2.28.1
requests-oauthlib==1.3.1
rsa==4.9
SCALECAST==0.13.11
scikit-learn==1.1.2
scipy==1.9.0
seaborn==0.11.2
Send2Trash==1.8.0
setuptools-git==1.2
six==1.16.0
soupsieve==2.3.2.post1
SQLAlchemy==1.4.40
stack-data==0.4.0
statsforecast==0.6.0
statsmodels==0.13.2
tabulate==0.8.10
tbats==1.1.0
tenacity==8.0.1
tensorboard==2.9.1
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorflow==2.9.1
tensorflow-estimator==2.9.0
tensorflow-io-gcs-filesystem==0.26.0
termcolor==1.1.0
terminado==0.15.0
threadpoolctl==3.1.0
tinycss2==1.1.1
toml==0.10.2
torch==1.12.1
torchmetrics==0.9.3
tornado==6.2
tqdm==4.64.0
traitlets==5.3.0
typing_extensions==4.3.0
ujson==5.4.0
urllib3==1.26.12
watermark==2.3.1
wcwidth==0.2.5
webencodings==0.5.1
Werkzeug==2.2.2
widgetsnbextension==4.0.2
wrapt==1.14.1
xarray==2022.6.0
xgboost==1.6.2
yarl==1.8.1
zipp==3.8.1

How to save model if I also used scalecast to find optimal transformation?

Good day. I used scalecast to build an auto-time series pipeline, which includes finding the optimal transformation and uses models [ 'mlr', 'lasso', 'ridge', 'elasticnet', 'xgboost', 'lightgbm', 'knn']. How do I save the optimal transformation found and the best model derived, for use in production.

Apologies in advance as I am new to using scalecast. I'll appreciate your assistance on this.

ForecastError: Need at least 1 Xvar to forecast with the svr model.

Hello!

I am running the code below from your medium article: https://towardsdatascience.com/forecast-on-3-levels-introducing-scalecast-pt-3-eb725e0be6c9

f.set_validation_length(6)

automatically tune and forecast with a series of models

models = ('mlr','knn','svr','xgboost','gbt','elasticnet','mlp','prophet')
for m in models:
f.set_estimator(m)
f.tune() # by default, will pull grids from Grids.py
f.auto_forecast()

Here is the error message I got:
ForecastError: Need at least 1 Xvar to forecast with the svr model.

Would you please help? Thank you!

Xvars are not found in the current_xreg dict keys

I was trying auto pipeline with transformation and multiple models.
When I reduced the series size from 43 to 40. it is not able the find all Xvars in the current_xreg keys list. meanwhile, the code is working fine with 43 size.
here are details

f_pipe_aut = Forecaster(y=data.y,current_dates=data.dates,future_dates=3)
f_pipe_aut.set_test_length(.10)
f_pipe_aut.add_time_trend()
f_pipe_aut.add_seasonal_regressors('month','quarter',sincos=True,raw=False)
f_pipe_aut.add_ar_terms(6)



transformer_aut, reverter_aut = find_optimal_transformation(
    f_pipe_aut,
    lags = 12,
    m = 'auto',
    monitor = 'mae',
    estimator = 'elasticnet',
    alpha = 0.2,
    test_length = 3,
    num_test_sets = 3,
    space_between_sets = 4,
    verbose = True,
)

def forecaster_aut(f,models):
    f.auto_Xvar_select(
        estimator='mlr',
        monitor='TestSetMAE',
        # alpha=0.2,
        # irr_cycles = [26],
    )
    f.tune_test_forecast(
        models,
        cross_validate=True,
        k=3,
        # dynamic tuning = 13 means we will hopefully find a model that is optimized to predict 13 steps
        # dynamic_tuning=13,
        # dynamic_testing=13,
    )
    f.set_estimator('combo')
    f.manual_forecast()
    
    
    
    pipeline_aut = Pipeline(
    steps = [
        ('Transform',transformer_aut),
        ('Forecast',forecaster_aut),
        ('Revert',reverter_aut),
    ]
)

f_pipe_aut = pipeline_aut.fit_predict(
    f_pipe_aut,
    models=[
        'mlr',
        'elasticnet',
        'xgboost',
        'lightgbm',
        'knn','rf',
    ],
)

I'm getting keyerror "t". when I have checked and found "t" is missing from currnt_xreg

Xvars ['t', 'monthsin', 'monthcos', 'quartersin', 'quartercos', 'AR1', 'AR2', 'AR3', 'AR4', 'AR5', 'AR6']
self.current_xreg dict_keys(['monthsin', 'monthcos', 'quartersin', 'quartercos', 'AR1', 'AR2', 'AR3', 'AR4', 'AR5', 'AR6', 'lnt'])

instead of t lnt is coming in current_xreg

please help to resolve this issue, let me know if you need more details

PDEP datetime warnings.

Hello Mike, there are some changes in pandas and Forecaster now raises some warnings,

https://pandas.pydata.org/pdeps/0004-consistent-to-datetime-parsing.html

Forecaster.py:1296: UserWarning: The argument 'infer_datetime_format' is deprecated and will be removed in a future version. A strict version of it is now the default, see https://pandas.pydata.org/pdeps/0004-consistent-to-datetime-parsing.html. You can safely remove this argument.
self.future_dates = pd.to_datetime(

Forecaster.py:1305: UserWarning: The argument 'infer_datetime_format' is deprecated and will be removed in a future version. A strict version of it is now the default, see https://pandas.pydata.org/pdeps/0004-consistent-to-datetime-parsing.html. You can safely remove this argument.
self.future_dates = pd.to_datetime(

Issue when running auto_forecast() or tune_test_forecast() with rf

Here is the error. Typically I can rerun the codeblock in my notebook and after 1-2 tries it will fix itself.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_3112\911625238.py in <module>
      3     j.ingest_grid(model)
      4     j.cross_validate(dynamic_tuning=26)
----> 5     j.auto_forecast()
      6     j.save_summary_stats()
      7     print(model)

~\AppData\Roaming\Python\Python37\site-packages\scalecast\Forecaster.py in auto_forecast(self, call_me, dynamic_testing, test_only)

~\AppData\Roaming\Python\Python37\site-packages\scalecast\Forecaster.py in manual_forecast(self, call_me, dynamic_testing, test_only, **kwargs)

~\AppData\Roaming\Python\Python37\site-packages\scalecast\Forecaster.py in _forecast_sklearn(self, fcster, dynamic_testing, tune, Xvars, normalizer, test_only, **kwargs)

~\AppData\Roaming\Python\Python37\site-packages\scalecast\Forecaster.py in evaluate_model(scaler, regr, X, y, Xvars, fcst_horizon, future_xreg, dynamic_testing, true_forecast)

~\Anaconda3\envs\time\lib\site-packages\sklearn\ensemble\_forest.py in fit(self, X, y, sample_weight)
    465                     n_samples_bootstrap=n_samples_bootstrap,
    466                 )
--> 467                 for i, t in enumerate(trees)
    468             )
    469 

~\Anaconda3\envs\time\lib\site-packages\joblib\parallel.py in __call__(self, iterable)
   1041             # remaining jobs.
   1042             self._iterating = False
-> 1043             if self.dispatch_one_batch(iterator):
   1044                 self._iterating = self._original_iterator is not None
   1045 

~\Anaconda3\envs\time\lib\site-packages\joblib\parallel.py in dispatch_one_batch(self, iterator)
    859                 return False
    860             else:
--> 861                 self._dispatch(tasks)
    862                 return True
    863 

~\Anaconda3\envs\time\lib\site-packages\joblib\parallel.py in _dispatch(self, batch)
    777         with self._lock:
    778             job_idx = len(self._jobs)
--> 779             job = self._backend.apply_async(batch, callback=cb)
    780             # A job can complete so quickly than its callback is
    781             # called before we get here, causing self._jobs to

~\Anaconda3\envs\time\lib\site-packages\joblib\_parallel_backends.py in apply_async(self, func, callback)
    206     def apply_async(self, func, callback=None):
    207         """Schedule a func to be run"""
--> 208         result = ImmediateResult(func)
    209         if callback:
    210             callback(result)

~\Anaconda3\envs\time\lib\site-packages\joblib\_parallel_backends.py in __init__(self, batch)
    570         # Don't delay the application, to avoid keeping the input
    571         # arguments in memory
--> 572         self.results = batch()
    573 
    574     def get(self):

~\Anaconda3\envs\time\lib\site-packages\joblib\parallel.py in __call__(self)
    261         with parallel_backend(self._backend, n_jobs=self._n_jobs):
    262             return [func(*args, **kwargs)
--> 263                     for func, args, kwargs in self.items]
    264 
    265     def __reduce__(self):

~\Anaconda3\envs\time\lib\site-packages\joblib\parallel.py in <listcomp>(.0)
    261         with parallel_backend(self._backend, n_jobs=self._n_jobs):
    262             return [func(*args, **kwargs)
--> 263                     for func, args, kwargs in self.items]
    264 
    265     def __reduce__(self):

~\Anaconda3\envs\time\lib\site-packages\sklearn\utils\fixes.py in __call__(self, *args, **kwargs)
    214     def __call__(self, *args, **kwargs):
    215         with config_context(**self.config):
--> 216             return self.function(*args, **kwargs)
    217 
    218 

~\Anaconda3\envs\time\lib\site-packages\sklearn\ensemble\_forest.py in _parallel_build_trees(tree, forest, X, y, sample_weight, tree_idx, n_trees, verbose, class_weight, n_samples_bootstrap)
    171 
    172         indices = _generate_sample_indices(
--> 173             tree.random_state, n_samples, n_samples_bootstrap
    174         )
    175         sample_counts = np.bincount(indices, minlength=n_samples)

~\Anaconda3\envs\time\lib\site-packages\sklearn\ensemble\_forest.py in _generate_sample_indices(random_state, n_samples, n_samples_bootstrap)
    127 
    128     random_instance = check_random_state(random_state)
--> 129     sample_indices = random_instance.randint(0, n_samples, n_samples_bootstrap)
    130 
    131     return sample_indices

mtrand.pyx in numpy.random.mtrand.RandomState.randint()

_bounded_integers.pyx in numpy.random._bounded_integers._rand_int32()

TypeError: 'numpy.float64' object cannot be interpreted as an integer

Silencing Warning and printing

Hello,

How can I silence some warnings ?

/config/workspace/my_venv/lib/python3.11/site-packages/scalecast/Forecaster.py:1902: Warning: Trend decomposition did not work and raised this error: You must specify a period or x must be a pandas object with a PeriodIndex or a DatetimeIndex with a freq not set to None Switching to the non-decomp method.
warnings.warn(
/config/workspace/my_venv/lib/python3.11/site-packages/scalecast/Forecaster.py:2034: Warning: No seasonalities are currently associated with the None frequency.
warnings.warn(
/config/workspace/my_venv/lib/python3.11/site-packages/scalecast/Forecaster.py:1902: Warning: Trend decomposition did not work and raised this error: You must specify a period or x must be a pandas object with a PeriodIndex or a DatetimeIndex with a freq not set to None Switching to the non-decomp method.
warnings.warn(
/config/workspace/my_venv/lib/python3.11/site-packages/scalecast/Forecaster.py:2034: Warning: No seasonalities are currently associated with the None frequency.
warnings.warn(
/config/workspace/my_venv/lib/python3.11/site-packages/scalecast/Forecaster.py:1902: Warning: Trend decomposition did not work and raised this error: You must specify a period or x must be a pandas object with a PeriodIndex or a DatetimeIndex with a freq not set to None Switching to the non-decomp method.
warnings.warn(
/config/workspace/my_venv/lib/python3.11/site-packages/scalecast/Forecaster.py:2034: Warning: No seasonalities are currently associated with the None frequency.
warnings.warn(
/config/workspace/my_venv/lib/python3.11/site-packages/scalecast/Forecaster.py:1902: Warning: Trend decomposition did not work and raised this error: You must specify a period or x must be a pandas object with a PeriodIndex or a DatetimeIndex with a freq not set to None Switching to the non-decomp method.
warnings.warn(
/config/workspace/my_venv/lib/python3.11/site-packages/scalecast/Forecaster.py:2034: Warning: No seasonalities are currently associated with the None frequency.
warnings.warn(
/config/workspace/my_venv/lib/python3.11/site-packages/scalecast/Forecaster.py:1902: Warning: Trend decomposition did not work and raised this error: You must specify a period or x must be a pandas object with a PeriodIndex or a DatetimeIndex with a freq not set to None Switching to the non-decomp method.
warnings.warn(
/config/workspace/my_venv/lib/python3.11/site-packages/scalecast/Forecaster.py:2034: Warning: No seasonalities are currently associated with the None frequency.

This is my code:

`
df = load_data(database_filename,FILTERED_ITEM_NUMBER)

#GridGenerator.get_example_grids() # example hyperparameter grids

data = df
f = Forecaster(
y = data['Monthly _ Ordered quantity _ basic U_M'], # required
current_dates = data['Month Number'], # required
#future_dates = length_forecast_horizon_training , # length of the forecast horizon, 
#test_length = 30, # set a test set length or fraction to validate all models if desired
cis = False, # choose whether or not to evaluate confidence intervals for all models, 
metrics = ['rmse','mae','mape','r2'], # the metrics to evaluate when testing/tuning models
)

f.add_metric(custom_metric_3)
f.set_validation_metric('custom_metric_3')

#f.generate_future_dates(length_forecast_horizon_deployement)
f.set_last_future_date(FORECAST_DATE)
f.get_freq()
f.infer_freq()

f.set_validation_length(length_forecast_horizon_training)
f.set_test_length(.25)
f.eval_cis() # tell the object to build confidence intervals for all models
f.add_ar_terms(8)
f.add_AR_terms((4,8))

f.add_seasonal_regressors('month','quarter','week','dayofyear',raw=False,sincos=True)
f.add_seasonal_regressors('dayofweek','is_leap_year','week',raw=False,dummy=True,drop_first=True)
f.add_seasonal_regressors('year')

f.add_sklearn_estimator(StackingRegressor,called='stacking')
f.add_sklearn_estimator(AdaBoostRegressor,called='adaboost')

models = ('elasticnet', 'knn', 'xgboost', 'lasso', 'ridge','mlp')

for m in models:

    f.set_estimator(m)
    f.auto_Xvar_select(estimator=m) 
    f.determine_best_series_length(estimator =m)
    f.tune() # by default, will pull the grid with the same name as the estimator (mlr will pull the mlr grid, etc.)
    f.cross_validate(k = 2,verbose=False) 
    f.auto_forecast()

f.infer_freq()
f.plot_fitted(order_by='TestSetR2') # plot fitted values of all models ordered by r2
models = plot_test_export_summaries(f)
#f.plot(order_by='TestSetR2') # plot fitted values of all models ordered by


data_forecast = f.export(to_excel=True,excel_name=forecasting_file, cis = True)
display(models)

`

Also, is there a progression bar ?

Thank you in advance,

No option to save LSTM model

I trained an LSTM model and couldn't figure out a way to save my model in any format. I've been through all of the docs provided but there's no way to get the job done. Need help.

Is it possible to pickle only trained model and call it back for test and/or forecast without any training process in another .py folder?

I am trying to pickle a trained xgboost model and call it in another .py folder to only do forecast without any training process. Is it possible to do that with auto_forecast() function, if not how can I do that? (code is below)

"""### XGBoost"""

xgboost_grid = {
'max_depth': [15],
'tree_method': 'gpu_hist'
}
for i, f in enumerate(forecasts):
print('Forecast', i)
f.set_estimator('xgboost')
f.ingest_grid(xgboost_grid)
f.tune()
f.auto_forecast()

Fitting twice with manual forecast lstm

I have created a forecaster like below

f = Forecaster( y=df_data['y'], current_dates=df_data['ds'], test_length = test_data_size, future_dates = test_data_size, cis = True, metrics = ['rmse','mape','mae','r2'], ) alidation_split=.2, shuffle=True, activation='tanh', optimizer='Adam', learning_rate=0.0001, lstm_layer_sizes=(200,)*no_of_stack_lstm_layers, dropout=(0,)*no_of_stack_lstm_layers, callbacks=EarlyStopping( monitor='val_loss', min_delta = 0.0001, patience=5 ), plot_loss=True, verbose=True, )

@mikekeith52
Why is it fitting twice?
Epoch 1/2
251/251 [==============================] - 10s 34ms/step - loss: 0.1126 - val_loss: 0.0990
Epoch 2/2
251/251 [==============================] - 9s 36ms/step - loss: 0.0957 - val_loss: 0.0981
1/1 [==============================] - 0s 465ms/step

Epoch 1/2
270/270 [==============================] - 21s 64ms/step - loss: 0.1123 - val_loss: 0.0942
Epoch 2/2
270/270 [==============================] - 13s 47ms/step - loss: 0.0962 - val_loss: 0.0937
1/1 [==============================] - 0s 363ms/step
85/85 [==============================] - 2s 29ms/step

from scalecast.Forecaster import Forecaster gives error

While importing scalecast "from scalecast.Forecaster import Forecaster", I get the below error.
scalecast version - 0.18.4
pandas version 2.0.1
packages/lightgbm/init.py:8), in
2 """LightGBM, Light Gradient Boosting Machine.
3
4 Contributors: https://github.com/microsoft/LightGBM/graphs/contributors.
5 """
6 from pathlib import Path
----> 8 from .basic import Booster, Dataset, Sequence, register_logger
9 from .callback import early_stopping, log_evaluation, print_evaluation, record_evaluation, reset_parameter
10 from .engine import CVBooster, cv, train
...
279 def split(self, pat=None, n=-1, expand=False):
280 """Known inconsistencies: expand=True with unknown n will raise a NotImplementedError."""
281 return self._split("split", pat=pat, n=n, expand=expand)

AttributeError: module 'pandas.core.strings' has no attribute 'StringMethods'
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...

Issue when running .reduce_Xvars with method='shap'

See code below. I am not sure if I need to add another argument to the method call.

f.reduce_Xvars(
    method='shap',
    estimator='knn',
    keep_at_least="sqrt",
    grid_search=True,
    dynamic_testing=False,
    overwrite=False,
)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_18400\1329642131.py in <module>
      5     grid_search=True,
      6     dynamic_testing=False,
----> 7     overwrite=False,
      8 )

~\Anaconda3\envs\time\lib\site-packages\scalecast\Forecaster.py in reduce_Xvars(self, method, estimator, keep_at_least, keep_this_many, grid_search, use_loaded_grid, dynamic_tuning, monitor, overwrite, cross_validate, cvkwargs, **kwargs)
   2080             coef_fi_lasso = pd.DataFrame(
   2081                 {
-> 2082                     x: [np.abs(co)] for x, co in zip(
   2083                         f.history["lasso"]["Xvars"],
   2084                         f.regr.coef_,

~\Anaconda3\envs\time\lib\site-packages\scalecast\Forecaster.py in export_feature_importance(self, model)
   4235                 "LastTestSetActual",
   4236                 "CILevel",
-> 4237                 "CIPlusMinus",
   4238                 "InSampleRMSE",
   4239                 "InSampleMAPE",

KeyError: 'feature_importance'

Forecasting with per minute time series

Hello,

I am trying to perform time-series forecasting using scalecast. My data contains a Date column with the 10T (10 minutes) frequency.
When I try to perform Scaled Automated Forecasting, with this frequency, it always throws me a warning because I cannot perform forecasting on the dataset.

These are the warning currently I am facing.

Warning 1
WARNING:py.warnings:/usr/local/lib/python3.8/dist-packages/scalecast/Forecaster.py:2594: UserWarning: trend decomposition did not work and raised this error: freq T not understood. Please report if you think this is in error. switching to non-decomp method
warnings.warn(

Warning 2
WARNING:py.warnings:/usr/local/lib/python3.8/dist-packages/scalecast/Forecaster.py:2703: UserWarning: no seasonalities are currently associated with the 10T frequency
warnings.warn(f'no seasonalities are currently associated with the {f.freq} frequency')

I would appreciate a solution to my query.

fbprophet is now named prophet

The prophet forecaster still uses the old 'fbprophet' dependency, this has been changed to 'prophet' and installing the previous versions of the library causes some issues if you have the new version/name installed

Got Tuple index out of range issue when calling manual_forecast() for rnn

Hi Michael,

I got the IndexError: tuple index out of range when calling manual forecast() for rnn. Below are the details:

Error

IndexError Traceback (most recent call last)
Cell In[18], line 2
1 f.set_estimator('rnn')
----> 2 f.manual_forecast(
3 lags = 24,
4 layers_struct=[
5 ('LSTM',{'units':10,'activation':'tanh'}),
6 ('LSTM',{'units':10,'activation':'tanh'}),
7 ('LSTM',{'units':10,'activation':'tanh'}),
8 ],
9 optimizer = 'Adam',
10 epochs = 15,
11 plot_loss = True,
12 validation_split=0.2,
13 call_me = 'rnn_tanh_activation',
14 )

735 self.call_me = self.estimator if call_me is None else call_me
737 if test_again and self.test_length > 0 and self.estimator != 'combo':

--> 738 self.test(
739 **kwargs,
740 dynamic_testing=dynamic_testing,
741 call_me=call_me,
742 )
743 elif bank_history:
744 if self.call_me not in self.history.keys():

1319 f1.eval_cis(False)
1320 f1.actuals = actuals
-> 1321 f1.manual_forecast(
1322 dynamic_testing = dynamic_testing,
1323 test_again = False,
1324 call_me = call_me,
1325 **kwargs,
1326 )
1327 fcst = f1.forecast
1329 if not already_existed:

744     if self.call_me not in self.history.keys():
745         self.history[self.call_me] = {}
747 preds = (
748     self._forecast_sklearn(
749         fcster=self.estimator,
750         dynamic_testing=dynamic_testing,
751         **kwargs,
752     )
753     if self.estimator in self.sklearn_estimators

--> 754 else getattr(self, f"forecast{self.estimator}")(
755 dynamic_testing=dynamic_testing, **kwargs
756 )
757 )
758 self.forecast = preds
759 if bank_history:

 12 with warnings.catch_warnings(record=True) as warn_list:
 13     warnings.simplefilter("always")

---> 14 result = func(*args, **kwargs)
15 for warn in warn_list:
16 logging.warning(warn.message)

978 X = X.reshape(X.shape[0], X.shape[1], 1)
979 fut = fut.reshape(fut.shape[0], fut.shape[1], 1)
--> 980 model = get_compiled_model(y)
981 hist = model.fit(X, y, **kwargs)
982 fcst = model.predict(fut)

850                 kv[1]["return_sequences"] = (
851                     layers_struct[i + 1][0] != "Dense"
852                 )
854         model.add(layer(**kv[1]))

--> 855 model.add(Dense(y.shape[1])) # output layer
857 # compile model
858 model.compile(optimizer=local_optimizer, loss=loss)

IndexError: tuple index out of range

Code:

f.set_estimator('rnn')
f.manual_forecast(
lags = 24,
layers_struct=[
('LSTM',{'units':10,'activation':'tanh'}),
('LSTM',{'units':10,'activation':'tanh'}),
('LSTM',{'units':10,'activation':'tanh'}),
],
optimizer = 'Adam',
epochs = 15,
plot_loss = True,
validation_split=0.2,
call_me = 'rnn_tanh_activation',
)

Code from:

https://towardsdatascience.com/stacking-time-series-models-to-improve-accuracy-7977c6667d29

Could you please help? Thank you so much!

Thank you,
Lily

Data size impacting tune_test_forecast() and find_optimal_transformation()

Hello,

In an attempt to try to deploy automatic forecasting on different dataset (the optimal goal is to try to find optimal model automatically for each input TS data), I noticed the the two functions tune_test_forecast() and find_optimal_transformation() encounters a "shape".

ValueError: Found array with 0 sample(s) (shape=(0, 45)) while a minimum of 1 is required by MinMaxScaler.

Or maybe does it has to be with the add_ar_terms ?

In the case of the following dataset, I noticed that the problem is mainly on the f.auto_forecast().

However, the find_statistical_transformation() works well.

Dataset attached.

CODE:

`forecast_months_horizon = 18 #Select number of months to be forecasted in the future
performance_metric = "mae"
data = df
f = Forecaster(
y = data['Monthly_Ordered quantity _ basic U_M'], # required
current_dates = data['first_day_of_month'], # required
future_dates=forecast_months_horizon,
cis = False, # choose whether or not to evaluate confidence intervals for all models,
metrics = ['mae','r2','rmse','mape'], # the metrics to evaluate when testing/tuning models
)

f.add_metric(custom_metric_3)

f.set_validation_metric(performance_metric)
f.set_validation_length(int(len(f.y).2) + number_months_validation0)
f.set_test_length(int(len(f.y).25)+number_months_test0)

def forecaster_0(f):

f.add_sklearn_estimator(StackingRegressor,called='stacking')
f.add_sklearn_estimator(AdaBoostRegressor,called='adaboost')
f.add_covid19_regressor()
            
f.add_metric(custom_metric_3)
f.set_validation_metric(performance_metric)

models = ('lasso','gbt','ridge','elasticnet')
for m in tqdm(models):

    f.drop_all_Xvars()
    f.set_estimator(m)
    f.auto_Xvar_select(estimator=m, irr_cycles=[12],cross_validate=True) 
    #f.determine_best_series_length(estimator =m, monitor='ValidationMetricValue' ,cross_validate=True, dynamic_tuning = 18)
    f.tune() # by default, will pull the grid with the same name as the estimator (mlr will pull the mlr grid, etc.)
    f.cross_validate(k = 5,verbose=True, dynamic_tuning=True) 
    f.auto_forecast(call_me = m + '_0')
    f.restore_series_length()

auto_arima(f,m=12) # saves a model called auto_arima    

def forecaster_1(f):

#f.eval_cis() # tell the object to build confidence intervals for all models
for i in range(11): f.add_ar_terms(i)

f.add_AR_terms((2,12))
f.add_time_trend()

f.add_seasonal_regressors('month','quarter','week','dayofyear',raw=False,sincos=True)
f.add_seasonal_regressors('dayofweek','is_leap_year','week',raw=False,dummy=True,drop_first=True)
f.add_seasonal_regressors('year')

#f.add_sklearn_estimator(StackingRegressor,called='stacking')
#f.add_sklearn_estimator(AdaBoostRegressor,called='adaboost')

models = ('lasso', 'xgboost')
# f.tune_test_forecast(models, dynamic_testing=True, 
#                      cross_validate= True, summary_stats = True, dynamic_tuning=True,verbose=True)
#f.tune_test_forecast(models, suffix = "_1") 
for m in tqdm(models): 
    f.set_estimator(m) 
    f.tune(dynamic_tuning=True)
    f.cross_validate(k=2,dynamic_tuning=True,verbose=True)
    f.auto_forecast() 

auto_arima(f,m=12) # saves a model called auto_arima
f.add_covid19_regressor()

def Plot_Analysis(f):

print("Plotting AutoCorrelation & Seasonal Decomposition Graph")

f.plot_acf()
plt.title("ACF")

f.plot_pacf()
plt.title("PACF")

f.seasonal_decompose().plot()
plt.title("Seasonal Decompose")
plt.show()

def Plot_Forecasts(f):

f.plot_fitted(order_by='TestSetMAE') # plot fitted values of all models ordered by r2
plt.title('fitted_results results',size=16)
plt.show()
df_models = plot_test_export_summaries(f)

f.plot(order_by='TestSetMAE')
plt.title('Forecasting results',size=16)
plt.show()

#transformer, reverter = find_statistical_transformation(f)

forecaster_1(f)
Plot_Forecasts(f)`

df_A0430151.xlsx

Generating future values does not show in plot

Hello,

I am using scalecast for a timeseries project consisting of predicting future asset prices. I am currently deploying my model in production but I cannot generate any future values beyond my testing dataset. At the beginning of my script, I have written "f.generate_future_dates(20)" but the f.plot() method does not return the predictions for the next 20 units.

Would you please guide me for how to generate and plot these next 20 units?

Thank you.

Martin

HWES estimator produces forecasts of much larger magnitude with statsforecast 1.5.0

First time submitting a bug so please excuse...

Using Release 0.18.6

Noticed a friend and I were getting drastically different HWES forecasts (his were orders of magnitude off and clearly appeared to be a bug). Identified I was running on statsforecast 1.4.0 while he had statsforecast 1.5.0. When I upgraded to 1.5.0 I too received the same bug.

I have uploaded the monthly data being forecasted for reproducability.

test_model = Forecaster(
            y = fcst_data['quantity_lbs'], # required
            current_dates = fcst_data['bwg_month_beg'], # required
            future_dates = 12, # length of the forecast horizon
            test_length = .15, # set a test set length or fraction to validate all models if desired
            cis = False, # choose whether or not to evaluate confidence intervals for all models
            metrics = ['rmse','mae','mape','r2'], # the metrics to evaluate when testing/tuning␣ models
    )
    

#Sets Estimators
test_model.set_estimator('hwes')

test_model.manual_forecast(
    trend=None,
    seasonal='mul',
    use_boxcox=True
)


test_model_results = test_model.export(['lvl_fcsts','model_summaries']) 

display(test_model_results['model_summaries'])
display(test_model_results['lvl_fcsts'])

scalecast_bug_data.csv

[Errno 2] No such file or directory when install

when i try to install scalecast as ' pip install scalecast ', 'have this error:

FileNotFoundError: [Errno 2] No such file or directory: './docs/source/Forecaster/examples/eCommerce.ipynb'

my system is a OSX 12.5 M1

use_boxcox parameter in holt winters

with this grid:

hwes = {
'trend':['add','mul'],
'seasonal':['add','mul'],
'damped_trend':[True,False],
'initialization_method':[None,'estimated','heuristic'],
'use_boxcox':[True,False],
'seasonal_periods':[168],
}

I get this result which I do not understand as it is True or False:

`File ~/.local/share/virtualenvs/scalecast-0HQw5DtN/lib/python3.10/site-packages/statsmodels/tsa/holtwinters/model.py:337, in ExponentialSmoothing._boxcox(self)
335 y = boxcox(self._y, self._use_boxcox)
336 else:
--> 337 raise TypeError("use_boxcox must be True, False or a float.")
338 return y

TypeError: use_boxcox must be True, False or a float.`

I think the issue may be here:
File ~/.local/share/virtualenvs/scalecast-0HQw5DtN/lib/python3.10/site-packages/statsmodels/tsa/holtwinters/model.py:291, in ExponentialSmoothing.__init__(self, endog, trend, damped_trend, seasonal, seasonal_periods, initialization_method, initial_level, initial_trend, initial_seasonal, use_boxcox, bounds, dates, freq, missing) 289 self._use_boxcox = use_boxcox 290 self._lambda = np.nan --> 291 self._y = self._boxcox() 292 self._initialize() 293 self._fixed_parameters = {}

Scalecast on Apple M1

Hello!

I've hit a bit of a wall trying to use Scalecast on Apple M1 silicon. It looks like Scalecast is requesting specifically for "tensorflow" package as a prerequisite when installing.

Would it be possible to have the requirement be either "tensorflow" or tensorflow for M1 macs named "tensorflow-macos"?

Best regards,
Jaanus

scalecast starter example won't import on mac

I get the following issue when trying to run the minimal example from this repo, simply on the initial import statements:

(error from python with line numbers removed)

from scalecast.Forecaster import Forecaster
from lightgbm import LGBMRegressor
from .basic import Booster, Dataset, Sequence, register_logger
from .compat import PANDAS_INSTALLED, concat, dt_DataTable, pd_CategoricalDtype, pd_DataFrame, pd_Series
from dask.dataframe import DataFrame as dask_DataFrame
import dask.dataframe._pyarrow_compat
copyreg.dispatch_table[pd.arrays.ArrowStringArray] = reduce_arrowextensionarray

AttributeError: module 'pandas.arrays' has no attribute 'ArrowStringArray'

I've played with different pandas installation versions- any idea why this is remaining stuck?

pip install --upgrade scalecast
runs fine and says nothing needs to be changed.

add pydlm and check skforecast

it is a good method for uni and multivariate forecasting to see the impact of exog. Also, check skforecast, it seems good for forecasting.

Generating new dates / Frequency not understood

When creating the forecaster object, and inputing the database, it seems that the ovject doesn't detect the "Freq", as it shows Freq = None, when displaying the forecaster obeject:

f = Forecaster( y = data['Original Date'], # required current_dates = data['Month Date'], # required future_dates=18, cis = False, # choose whether or not to evaluate confidence intervals for all models, metrics = ['mae','r2','rmse','mape'], # the metrics to evaluate when testing/tuning models )

df_.xlsx

Either I use the "Month Date" of the "Original date", it is displaying always None as Frequency.

Actually, the idea was to transform the Quantity with a non organised Original date to Montly Quantity by summing up over each month and perform the prediction to 18 months in the future, that's why I put future_dates = 18.

The full code:

` def forecaster_0(f):
for m in models:

        f.set_estimator(m)
        f.auto_Xvar_select(estimator=m) 
        f.determine_best_series_length(estimator =m)
        f.tune() # by default, will pull the grid with the same name as the estimator (mlr will pull the mlr grid, etc.)
        f.cross_validate(k = 5,verbose=True) 
        f.auto_forecast()
        f.drop_all_Xvars()

def forecaster_1(f): 
     
    f.add_metric(custom_metric_3)
    f.set_validation_metric('custom_metric_3')

    #f.generate_future_dates(length_forecast_horizon_deployement)
    #f.set_last_future_date(FORECAST_DATE)
    #f.generate_future_dates(18)
    lenghts_to_train_in_past = 20 
    f.set_validation_length(lenghts_to_train_in_past)
    f.set_test_length(.25)
    #f.eval_cis() # tell the object to build confidence intervals for all models
    f.add_ar_terms(2)
    f.add_AR_terms((2,8))
    f.add_time_trend()
    
    f.add_seasonal_regressors('month','quarter','week','dayofyear',raw=False,sincos=True)
    f.add_seasonal_regressors('dayofweek','is_leap_year','week',raw=False,dummy=True,drop_first=True)
    f.add_seasonal_regressors('year')

    f.add_sklearn_estimator(StackingRegressor,called='stacking')
    f.add_sklearn_estimator(AdaBoostRegressor,called='adaboost')
    models = ('lasso', 'gbt','ridge','adaboost', 'xgboost')
    f.tune_test_forecast(models, dynamic_testing=18, 
                                cross_validate= True, summary_stats = True, dynamic_tuning=True,verbose=True)

transformer, reverter = find_optimal_transformation(f)
display(transformer)

pipeline = Pipeline(
steps = [
    #('Transform',transformer),
    ('Forecast',forecaster_1),
    #('Revert',reverter),
])

f = pipeline.fit_predict(f)

# for m in models:

#     # f.set_estimator(m)
#     # f.auto_Xvar_select(estimator=m) 
#     # f.determine_best_series_length(estimator =m)
#     # f.tune() # by default, will pull the grid with the same name as the estimator (mlr will pull the mlr grid, etc.)
#     # f.cross_validate(k = 5,verbose=False) 
#     # f.auto_forecast()
#     f.drop_all_Xvars()
#     f.set_estimator(m)
#     f.auto_Xvar_select(estimator=m)
#     f.determine_best_series_length(estimator=m)
#     f.tune()
#     f.cross_validate()
#     f.auto_forecast()
#     f.restore_series_length()


f.plot_fitted(order_by='TestSetMAE') # plot fitted values of all models ordered by r2
plt.title(f'{f.estimator} fitted_results results',size=16)
plt.show()
df_models = plot_test_export_summaries(f)

f.plot(order_by='TestSetMAE')
plt.title(f'{f.estimator} Forecasting results',size=16)
plt.show()

data_forecast = f.export(to_excel=True,excel_name=forecasting_file, cis = False)
display(df_models)

df_forecast = pd.read_excel(forecasting_file, sheet_name="lvl_fcsts")
df_forecast['DATE'] = pd.to_datetime(df_forecast['DATE'])
df_forecast = df_forecast[df_forecast['DATE'].dt.weekday == 0]
display(df_forecast) 
print("Plotting AutoCorrelation")
f.plot_acf()`

**OUTPUTS/RESULTS: **

Despite the results on the Test set doesn't seem to be very terrible, the forecasts on the future aren't well generated, I suspect again the non detection of the Frequency, maybe another reason I am missing ?

image

image

image

ModelNickname HyperParams InSampleMAE TestSetMAE InSampleR2 InSampleRMSE TestSetR2 TestSetRMSE
ridge {} 53.592252 130.605114 0.869073 66.893779 0.299019 165.251654
adaboost {} 19.599311 151.450000 0.972589 30.607988 0.065381 190.813967
lasso {} 29.156306 170.330127 0.968061 33.039497 -0.204901 216.654821
gbt {} 0.115958 196.614226 0.999999 0.132265 -0.162170 212.778432
xgboost {} 0.000439 197.913553 1.000000 0.000614 -0.532267 244.320503

FORECASTING VALUES (Supposed to be 18 months in future)

  DATE lasso gbt ridge adaboost xgboost
2023-05-08 385.178400 660.264735 436.787649 640.0 473.736572
2023-05-15 431.244985 637.779493 463.456754 640.0 473.736572

image

And as a consequence, the f.seasonal_decompose() as well as the pipeline_backtest don't work.

Also, the find_optimal_transformation wasn't useful and it did degraded significantly the results.

low-level output error generated RuntimeError: Detected a call to `Model.fit` inside a `tf.function`. `Model.fit is a high-level endpoint that manages its own `tf.function`. Please move the call to `Model.fit` outside of all enclosing `tf.function`s. Note that you can call a `Model` directly on `Tensor`s inside a `tf.function` like: `model(x)`.

---------------------------------------------------------------------------

RuntimeError                              Traceback (most recent call last)

[<ipython-input-98-85af94263904>](https://localhost:8080/#) in <cell line: 19>()
     17 f.set_validation_metric('rmse')
     18 f.set_metrics(['rmse'])
---> 19 f.manual_forecast(
     20     call_me='lstm_latest',
     21     lags=input_size,

8 frames

[/usr/local/lib/python3.10/dist-packages/keras/engine/training.py](https://localhost:8080/#) in _disallow_inside_tf_function(method_name)
   4043             "`model(x)`."
   4044         ).format(method_name=method_name)
-> 4045         raise RuntimeError(error_msg)
   4046 
   4047 

RuntimeError: Detected a call to `Model.fit` inside a `tf.function`. `Model.fit is a high-level endpoint that manages its own `tf.function`. Please move the call to `Model.fit` outside of all enclosing `tf.function`s. Note that you can call a `Model` directly on `Tensor`s inside a `tf.function` like: `model(x)`.

This is my cell code:

#@title Prognosa Short Term
input_size = 6 #@param {"type":"integer"}
output_size = 3 #@param {"type":"integer"}

unit = 'unit1' #@param {"type":"string"}
outage = 'foh' #@param {"type":"string"}

f = Forecaster(
    y=kinerja_df_extended_nanremoved_standardized[f'{unit}_{outage}s'],
    current_dates=kinerja_df_extended_nanremoved_standardized['date'],
    test_length = 0,
    future_dates = output_size,
    cis = False,
)
f.set_estimator('lstm')
f.set_validation_metric('rmse')
f.set_metrics(['rmse'])
f.manual_forecast(
    call_me='lstm_latest',
    lags=input_size,
    batch_size=1,
    epochs=128,
    validation_split=0,
    shuffle=False,
    activation='tanh',
    optimizer='Adam',
    learning_rate=0.001,
    lstm_layer_sizes=(64,128,256,128,64,)*1,
    dropout=(0.05,0.05,0.05,0.05,0.05,)*1,
    plot_loss=True
)
display(f.tf_model.summary())

I ran it on Google Colab.

Feature Imps not storing with Forecaster.tune_test_forecast

Hello,

Thank you for your development and support of this valuable package.

I cannot get feature_importance=True and summary_stats=True to behave as expected. All models seem to be affected.

I ran --upgrade yesterday.

Environment:

  • Mac with M2 Pro and Sonoma 14.0
  • Jupyterlab running with AMD64 emulation on Docker - up-to-date :latest tag and no other package installs (I can think of, at least)

My forecaster objects are generated by:

import pandas as pd
import numpy as np
from scalecast.Forecaster import Forecaster
from scalecast import GridGenerator
from scalecast.multiseries import export_model_summaries
from datetime import datetime
import matplotlib.pyplot as plt
import seaborn as sns

forecasters= {}
for k,v in dfsd.items():
    f = Forecaster(y=v['GROSS_COUNT'],
                  current_dates = v.index)
    f.generate_future_dates(360)    
    f.set_test_length(.1)
    f.set_validation_length(28)
    f.add_seasonal_regressors(
        'dayofyear',
        'week',
        'month',
        'quarter',
        raw=False,
        sincos=True,
    )
    f.add_seasonal_regressors('year')
    f.add_time_trend()
    f.add_covid19_regressor(end=datetime(2022,2,1,0,0))
    forecasters[k] = f

tune_test_forecast is looped with:

for f in forecasters.values():
    f.tune_test_forecast(models, feature_importance=True, summary_stats=True)

The warnings/errors I get are below. Prophet verbose INFO has been removed:

/opt/conda/lib/python3.11/site-packages/scalecast/Forecaster.py:2729: Warning: rf does not have summary stats.
  warnings.warn(
/opt/conda/lib/python3.11/site-packages/scalecast/Forecaster.py:2705: Warning: Cannot set pfi feature importance on rf. Here is the error: cannot import name 'if_delegate_has_method' from 'sklearn.utils.metaestimators' (/opt/conda/lib/python3.11/site-packages/sklearn/utils/metaestimators.py)
  warnings.warn(
/opt/conda/lib/python3.11/site-packages/scalecast/Forecaster.py:2729: Warning: gbt does not have summary stats.
  warnings.warn(
/opt/conda/lib/python3.11/site-packages/scalecast/Forecaster.py:2705: Warning: Cannot set pfi feature importance on gbt. Here is the error: cannot import name 'if_delegate_has_method' from 'sklearn.utils.metaestimators' (/opt/conda/lib/python3.11/site-packages/sklearn/utils/metaestimators.py)
  warnings.warn(
/opt/conda/lib/python3.11/site-packages/scalecast/Forecaster.py:2729: Warning: xgboost does not have summary stats.
  warnings.warn(
/opt/conda/lib/python3.11/site-packages/scalecast/Forecaster.py:2705: Warning: Cannot set pfi feature importance on xgboost. Here is the error: cannot import name 'if_delegate_has_method' from 'sklearn.utils.metaestimators' (/opt/conda/lib/python3.11/site-packages/sklearn/utils/metaestimators.py)
/opt/conda/lib/python3.11/site-packages/scalecast/Forecaster.py:2729: Warning: prophet does not have summary stats.
  warnings.warn(
/opt/conda/lib/python3.11/site-packages/scalecast/Forecaster.py:2705: Warning: Cannot set pfi feature importance on prophet. Here is the error: 'Forecaster' object has no attribute 'X'
  warnings.warn(

I would expect FI for most of these sklearn models. Can you please help me understand this miss?

Prophet can't be found in grid.py

Hello! I am running this code below from your medium article: https://towardsdatascience.com/introducing-scalecast-a-forecasting-library-pt-1-33b556d9b019

f.set_validation_length(6)

automatically tune and forecast with a series of models

models = ('mlr','knn','svr','xgboost','gbt','elasticnet','mlp', 'arima','prophet' )
for m in models:
f.set_estimator(m)
f.tune() # by default, will pull grids from Grids.py
f.auto_forecast()

I got this error: ModuleNotFoundError: No module named 'prophet'

ModuleNotFoundError: No module named 'src.scalecast'

Failing to install on intel macOS Monterey 12.6.
Python 3.10.7
pip 22.2.2

Tried multiple versions (latest, 0.14.7, 0.13.11 all produce the same results:

Collecting scalecast
Using cached SCALECAST-0.15.1.tar.gz (403 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/private/var/folders/0f/m_0sfrcn7c56zl0026b1k62c0000gq/T/pip-install-k0tc2z79/scalecast_d8f7a8ae59984787adfbedc8a557540a/setup.py", line 4, in
from src.scalecast.init import version as version
ModuleNotFoundError: No module named 'src.scalecast'
[end of output]

VECM

Hi Michael,

VECM has been showing a frequency error when you have gaps in your data. I would like to know if it's possible to correct that for all type of frequency even if we have gaps in the data like other models in scalecast that works well for this cases.

Best regards,

Michelle

Error while installing with pip

I have got this error while running pip install --upgrade scalecast in a fresh new environment created with mambaconda (with only jupyterlab coming preinstalled):

(scalecast) ricardo@ricardo-XPS-8940:~$ pip install --upgrade scalecast
Collecting scalecast
  Using cached SCALECAST-0.15.12.tar.gz (680 kB)
  Preparing metadata (setup.py) ... done
Collecting scikit-learn
  Using cached scikit_learn-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (9.5 MB)
Collecting scalecast
  Using cached SCALECAST-0.15.11.tar.gz (680 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.15.10.tar.gz (680 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.15.9.tar.gz (679 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.15.8.tar.gz (679 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.15.7.tar.gz (677 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.15.6.tar.gz (411 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.15.5.tar.gz (410 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.15.4.tar.gz (408 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.15.3.tar.gz (408 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.15.2.tar.gz (408 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.15.1.tar.gz (403 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.15.0.tar.gz (400 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.14.8.tar.gz (382 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.14.7.tar.gz (368 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.14.6.tar.gz (368 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.14.5.tar.gz (368 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.14.4.tar.gz (368 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.14.3.tar.gz (367 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.14.1.tar.gz (346 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.14.0.tar.gz (268 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.13.11.tar.gz (257 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.13.10.tar.gz (256 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.13.9.tar.gz (256 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.13.8.tar.gz (256 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.13.6.tar.gz (245 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.13.5.tar.gz (245 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.13.4.tar.gz (244 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.13.3.tar.gz (242 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.13.2.tar.gz (242 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.13.1.tar.gz (242 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.13.0.tar.gz (232 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.12.9.tar.gz (230 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.12.8.tar.gz (229 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.12.7.tar.gz (228 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.12.6.tar.gz (226 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.12.5.tar.gz (132 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.12.4.tar.gz (131 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.12.3.tar.gz (130 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.11.2.tar.gz (1.1 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.11.1.tar.gz (2.5 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.11.0.tar.gz (1.0 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.10.5.tar.gz (1.0 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.10.4.tar.gz (1.0 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.10.3.tar.gz (1.0 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.10.2.tar.gz (1.1 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.10.1.tar.gz (1.0 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.10.0.tar.gz (1.1 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.9.9.tar.gz (1.0 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.9.8.tar.gz (397 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.9.7.tar.gz (397 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.9.6.tar.gz (397 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.9.4.tar.gz (396 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.9.2.tar.gz (791 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.9.1.tar.gz (395 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.9.0.tar.gz (785 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.8.4.tar.gz (389 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.8.3.tar.gz (389 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.8.2.tar.gz (389 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.8.1.tar.gz (389 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.8.0.tar.gz (389 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.7.6.tar.gz (388 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.7.5.tar.gz (388 kB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.7.4.tar.gz (3.6 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.7.3.tar.gz (3.6 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.7.2.tar.gz (22.1 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.7.1.tar.gz (54.0 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.7.0.tar.gz (27.0 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.6.9.tar.gz (27.0 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.6.8.tar.gz (29.3 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.6.7.tar.gz (59.1 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.6.6.tar.gz (54.4 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.6.4.tar.gz (45.2 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.6.2.tar.gz (45.2 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.6.1.tar.gz (45.1 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.6.0.tar.gz (44.2 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.5.9.tar.gz (44.4 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.5.8.tar.gz (43.9 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.5.7.tar.gz (43.9 MB)
  Preparing metadata (setup.py) ... done
  Using cached SCALECAST-0.5.6.tar.gz (24.8 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-db64hpf6/scalecast_da5dfa67998b4328acbac9c7a883f4c5/setup.py", line 6, in <module>
          shutil.copy('./examples/eCommerce.ipynb','./docs/source/Forecaster/examples/eCommerce.ipynb')
        File "/home/ricardo/mambaforge/envs/scalecast/lib/python3.11/shutil.py", line 419, in copy
          copyfile(src, dst, follow_symlinks=follow_symlinks)
        File "/home/ricardo/mambaforge/envs/scalecast/lib/python3.11/shutil.py", line 258, in copyfile
          with open(dst, 'wb') as fdst:
               ^^^^^^^^^^^^^^^
      FileNotFoundError: [Errno 2] No such file or directory: './docs/source/Forecaster/examples/eCommerce.ipynb'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

It seems that a missing jupyter notebook is causing the issue. Can you check it?

Question: models save

Hi! After all, how can I save a tuned model, feed new incoming data to it, and reuse it? Or this is out of the project stack?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.