<jupyter_start><jupyter_text><jupyter_code>try:
  import pycaret
except:
  !pip install pycaret-ts-alpha
import numpy as np
from pycaret.internal.pycaret_experiment import TimeSeriesExperiment
from pycaret.datasets import get_data<jupyter_output>/usr/local/lib/python3.7/dist-packages/distributed/config.py:20: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  defaults = yaml.load(f)<jupyter_text>Solution Overview in PyCaret  Setup For this exercise, we will use the "Airline" dataset available through `sktime` python package under BSD 3-Clause License. `pycaret` provides a useful wrapper to get this from `sktime` using the `get_data` function.<jupyter_code>#### Get data ----
y = get_data("airline", verbose=False)
#### Setup Experiment ----
exp = TimeSeriesExperiment()

#### Forecast Horizon = 12 months and 3 fold cross validation ----
exp.setup(data=y, fh=12, fold=3, session_id=42)<jupyter_output><empty_output><jupyter_text>Train-Test Split<jupyter_code>exp.plot_model(plot="train_test_split")<jupyter_output><empty_output><jupyter_text>Cross Validation<jupyter_code>exp.plot_model(plot="cv")<jupyter_output><empty_output><jupyter_text>Creating Initial Model<jupyter_code>model = exp.create_model("lr_cds_dt")
print(exp.predict_model(model))
exp.plot_model(model)<jupyter_output><empty_output><jupyter_text>Tuning the Model to Improve Performance<jupyter_code>tuned_model = exp.tune_model(model)
print(exp.predict_model(tuned_model))
exp.plot_model(tuned_model)<jupyter_output><empty_output><jupyter_text>Finalizing the Model to make Future Predictions<jupyter_code>final_model = exp.finalize_model(tuned_model)
print(exp.predict_model(final_model))
exp.plot_model(final_model)<jupyter_output>1961-01    465.2102
1961-02    432.6099
1961-03    478.4359
1961-04    496.2612
1961-05    500.2707
1961-06    575.5526
1961-07    675.8093
1961-08    636.2125
1961-09    552.5149
1961-10    511.8207
1961-11    423.5578
1961-12    471.5636
Freq: M, Name: Number of airline passengers, dtype: float64
{'fraction_non_alphanumeric': 0.11048158640226628, 'fraction_numerical': 0.08073654390934844, 'mean_word_length': 6.3321799307958475, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '81676', 'license': 'MIT', 'n_tokens_mistral': 871, 'n_tokens_neox': 739, 'n_words': 154, 'path': 'time_series/pycaret/pycaret_bias_variance_tradeoff.ipynb', 'repo_name': 'ngupta23/medium_articles', 'size': '2118'}