### Import Necessary Libraries Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/set_random_seed.ipynb Import numpy, orbit, DLT model, and the load_iclaims dataset. These are essential for running the examples. ```python import numpy as np import orbit from orbit.models import DLT from orbit.utils.dataset import load_iclaims ``` -------------------------------- ### Install from GitHub Source: https://github.com/uber/orbit/blob/dev/docs/installation.md Clone the repository and install Orbit ML from source for development or the latest unreleased features. This includes installing dependencies and the package itself. ```bash git clone https://github.com/uber/orbit.git cd orbit pip install -r requirements.txt pip install . ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/uber/orbit/blob/dev/CONTRIBUTING.md Install the necessary dependencies for the Orbit project, including development mode. ```bash cd orbit git checkout feat-my-new-feature pip install -r requirements.txt pip install -e . ``` -------------------------------- ### Install from PyPI Source: https://github.com/uber/orbit/blob/dev/docs/installation.md Use this command to install the latest stable version of Orbit ML from the Python Package Index. ```bash pip install orbit-ml ``` -------------------------------- ### Install Test Dependencies Source: https://github.com/uber/orbit/blob/dev/CONTRIBUTING.md Install the specific dependencies required for running tests in the Orbit project. ```bash pip install -r requirements-test.txt ``` -------------------------------- ### Install Orbit from Dev Branch Source: https://github.com/uber/orbit/blob/dev/README.md Install the development version of Orbit directly from its GitHub repository. Use this if you need the absolute latest code, which may be unstable. ```sh pip install git+https://github.com/uber/orbit.git@dev ``` -------------------------------- ### Import Libraries and Setup Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ktr2.ipynb Imports necessary libraries for KTR modeling, data manipulation, and plotting. Sets up display options and Orbit's style. ```python import pandas as pd import numpy as np from math import pi import matplotlib.pyplot as plt import orbit from orbit.models import KTR from orbit.diagnostics.plot import plot_predicted_components from orbit.utils.plot import get_orbit_style from orbit.constants.palette import OrbitPalette %matplotlib inline pd.set_option('display.float_format', lambda x: '%.5f' % x) orbit_style = get_orbit_style() plt.style.use(orbit_style); ``` -------------------------------- ### Initialize BackTester Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/backtest.ipynb Configure and initialize the BackTester with a DLT model, the dataset, and parameters for training/testing windows. This setup is required to run backtesting simulations. ```python # configs min_train_len = 100 forecast_len = 20 incremental_len = 100 window_type = 'expanding' bt = BackTester( model=dlt, df=data, min_train_len=min_train_len, incremental_len=incremental_len, forecast_len=forecast_len, window_type=window_type, ) ``` -------------------------------- ### Import Libraries and Setup Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ktr4.ipynb Imports necessary libraries for KTR, data manipulation, plotting, and kernel functions. Sets up pandas display options and matplotlib style. ```python import pandas as pd import numpy as np from math import pi import matplotlib.pyplot as plt import orbit from orbit.models import KTR from orbit.diagnostics.plot import plot_predicted_components from orbit.utils.plot import get_orbit_style from orbit.utils.kernels import gauss_kernel from orbit.constants.palette import OrbitPalette %matplotlib inline pd.set_option('display.float_format', lambda x: '%.5f' % x) orbit_style = get_orbit_style() plt.style.use(orbit_style); ``` -------------------------------- ### Import Libraries and Setup Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/model_diagnostics.ipynb Imports necessary libraries including pandas, numpy, matplotlib, ArviZ, and Seaborn. Sets up Orbit models and utility functions, and configures warnings. ```python import pandas as pd import numpy as np import matplotlib.pyplot as plt import arviz as az import seaborn as sns %matplotlib inline import orbit from orbit.models import LGT, DLT from orbit.utils.dataset import load_iclaims import warnings warnings.filterwarnings('ignore') from orbit.diagnostics.plot import params_comparison_boxplot from orbit.constants import palette ``` -------------------------------- ### Test PyPI Deployment Commands Source: https://github.com/uber/orbit/blob/dev/RELEASE.md Commands to test PyPI deployment locally. Ensure you have the 'build' and 'twine' packages installed. ```bash python3 -m build ``` ```bash python3 -m twine check dist/* ``` ```bash python3 -m twine upload --repository testpypi dist/* ``` -------------------------------- ### Install Orbit from Conda Source: https://github.com/uber/orbit/blob/dev/README.md Install Orbit using the conda package manager from the conda-forge channel. This is an alternative installation method. ```sh conda install -c conda-forge orbit-ml ``` -------------------------------- ### Print Orbit Version Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/decompose_prediction.ipynb Prints the installed version of the Orbit package. ```python print(orbit.__version__) ``` -------------------------------- ### Import Libraries and Load Data Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ets_lgt_dlt_missing_response.ipynb Imports necessary libraries and loads the 'iclaims' dataset. This setup is required before proceeding with model training and prediction. ```python import pandas as pd import numpy as np import orbit import matplotlib.pyplot as plt from orbit.utils.dataset import load_iclaims from orbit.diagnostics.plot import plot_predicted_data, plot_predicted_components from orbit.utils.plot import get_orbit_style from orbit.models import ETS, LGT, DLT from orbit.diagnostics.metrics import smape plt.style.use(get_orbit_style()) %load_ext autoreload %autoreload 2 %matplotlib inline ``` -------------------------------- ### Check Orbit Version Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ets_lgt_dlt_missing_response.ipynb Displays the installed version of the Orbit library. Ensure you are using a compatible version for all features to work correctly. ```python orbit.__version__ ``` -------------------------------- ### Import Orbit Libraries and Load Data Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/dlt.ipynb Imports necessary libraries from Orbit and loads the sample 'iclaims' dataset. This is a common setup for time series modeling with Orbit. ```python %matplotlib inline import matplotlib.pyplot as plt import orbit from orbit.models import DLT from orbit.diagnostics.plot import plot_predicted_data, plot_predicted_components from orbit.utils.dataset import load_iclaims ``` ```python # load log-transformed data df = load_iclaims() response_col = 'claims' date_col = 'week' ``` -------------------------------- ### Load Sample Dataset Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/pyro_basic.ipynb Loads the 'iclaims' dataset, a sample dataset commonly used for time series forecasting examples within the Orbit library. ```python df = load_iclaims() ``` -------------------------------- ### Import Libraries for Orbit Simulation Source: https://github.com/uber/orbit/blob/dev/examples/ktr_simulation.ipynb Imports necessary libraries for time-varying coefficient simulations, including pandas, numpy, matplotlib, scipy, and Orbit utilities. Ensure these libraries are installed. ```python import math from math import pi import time import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy import stats from scipy.spatial.distance import cdist # from orbit.estimators.pyro_estimator import PyroEstimatorVI # from orbit.estimators.stan_estimator import StanEstimatorMAP from orbit.diagnostics.metrics import smape from orbit.utils.features import make_fourier_series_df, make_fourier_series from orbit.diagnostics.plot import plot_predicted_data from orbit.utils.plot import get_orbit_style orbit_style = get_orbit_style() plt.style.use(orbit_style) %load_ext autoreload %autoreload 2 ``` -------------------------------- ### Initialize KTR Model with Hierarchical Priors Source: https://github.com/uber/orbit/blob/dev/examples/ktr_simulation.ipynb Initializes a KTR model with hierarchical priors for regressors. This setup is suitable for scenarios where regressor effects are expected to have a latent structure. It configures various parameters including knot scales, segments, learning rates, and prediction percentiles. ```python ktrx_neutral = KTR( response_col='y', date_col='date', level_knot_scale=0.1, regressor_col=regressor_col, regressor_init_knot_loc=[0] * len(regressor_col), regressor_init_knot_scale=[1.0] * len(regressor_col), regressor_knot_scale=[0.5] * len(regressor_col), level_segments=10, regression_segments=10, regression_rho=0.05, prediction_percentiles=[2.5, 97.5], seed=2020, num_steps=501, num_sample=1000, learning_rate=0.2, learning_rate_total_decay=0.05, verbose=True, message=50, flat_multiplier=True, ) ``` -------------------------------- ### Display First Five Dates in Array Source: https://github.com/uber/orbit/blob/dev/examples/ktr_simulation.ipynb Shows the first five entries of a date array to verify its content and format. Useful for a quick inspection of the time series start. ```python date_array[:5] ``` -------------------------------- ### Quick Start: DLT Model Bayesian Prediction Source: https://github.com/uber/orbit/blob/dev/README.md Demonstrates how to load data, initialize the Damped Local Trend (DLT) model, fit it to training data, and prepare for prediction. Requires the 'claims' dataset and specifies response, date, and regressor columns, along with seasonality. ```python from orbit.utils.dataset import load_iclaims from orbit.models import DLT from orbit.diagnostics.plot import plot_predicted_data # log-transformed data df = load_iclaims() # train-test split test_size = 52 train_df = df[:-test_size] test_df = df[-test_size:] dlt = DLT( response_col='claims', date_col='week', regressor_col=['trend.unemploy', 'trend.filling', 'trend.job'], seasonality=52, ) dlt.fit(df=train_df) ``` -------------------------------- ### Define Parameter Grid for Hyperparameter Tuning Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/backtest.ipynb Defines a grid of hyperparameters to search over for tuning model parameters. This example specifies the search space for level smoothing and seasonality smoothing inputs. ```python # defining the search space for level smoothing paramter and seasonality smooth paramter param_grid = { 'level_sm_input': [0.3, 0.5, 0.8], 'seasonality_sm_input': [0.3, 0.5, 0.8], } ``` -------------------------------- ### Import necessary libraries Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/residual_diagnostic.ipynb Imports required libraries for time series analysis, plotting, and data loading within the Orbit framework. Ensure these libraries are installed before running the code. ```python %matplotlib inline import matplotlib.pyplot as plt import orbit from orbit.models import DLT from orbit.diagnostics.plot import residual_diagnostic_plot from orbit.utils.dataset import load_iclaims import pandas as pd import seaborn as sns ``` -------------------------------- ### Create Dual Axis Time Series Plot with Orbit Style Source: https://github.com/uber/orbit/blob/dev/examples/eda_orbit_style.ipynb This example shows how to generate a dual axis time series plot using Orbit style and the default Orbit palette. It plots two different variables against time. ```python # use orbit style and orbit palette _ = eda_plot.dual_axis_ts_plot(df=df, var1='trend.unemploy', var2='claims', date_col='week') ``` -------------------------------- ### Initialize and Run BackTester Source: https://github.com/uber/orbit/blob/dev/examples/backtest_animation.ipynb Creates a BackTester instance with the configured DLT model, data, and backtesting parameters, then executes the fit and predict cycle. ```python bt = BackTester(model=dlt, df=data, incremental_len=incremental_len, n_splits=n_splits, forecast_len=forecast_len) bt.fit_predict() ``` -------------------------------- ### Initialize Prior Parameters Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ktr4.ipynb Sets up parameters for defining prior distributions for regression coefficients, including duration and indices. ```python prior_duration = 50 cof_list_dict = [] prior_idx=[ np.arange(150, 150 + prior_duration), np.arange(200, 200 + prior_duration), ] regressor_idx = range(1, p + 1) plot_dict = {} for i in regressor_idx: plot_dict[i] = {'idx': [], 'val': []} ``` -------------------------------- ### Initialize SVIForecaster with Custom Model Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/build_your_own_model.ipynb Create an SVIForecaster instance, providing the custom BayesLinearRegression model, response column, date column, and estimator type. Configure training parameters like number of steps and random seed. ```python blr = SVIForecaster( model=model, response_col='y', date_col='week', estimator_type=PyroEstimatorSVI, verbose=True, num_steps=501, seed=2021, ) ``` -------------------------------- ### Get TimeSeriesSplitter Instance Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/backtest.ipynb Retrieves the TimeSeriesSplitter instance used by the BackTester. This allows for standalone use or visualization of the splitting strategy. ```python ts_splitter = bt.get_splitter() _ = ts_splitter.plot() ``` -------------------------------- ### Get Posterior Samples for Weights Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/build_your_own_model.ipynb Retrieves the posterior samples for the 'weight' parameter from a fitted Bayesian Linear Regression (BLR) model. ```python estimated_weights = blr.get_posterior_samples()['weight'] ``` -------------------------------- ### Initialize KTR Model Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ktr1.ipynb Instantiate the KTR model with specified parameters for response, date, seed, estimator, and bootstrap sampling. This is the first step before fitting the model. ```python ktr = KTR( response_col=response_col, date_col=date_col, seed=2021, estimator='pyro-svi', # bootstrap sampling to capture uncertainties n_bootstrap_draws=1e4, # pyro training config num_steps=301, message=100, ) ``` -------------------------------- ### Get Fitted Models from Backtester Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/backtest.ipynb Retrieves all fitted models from the BackTester object. This allows for deeper inspection of individual model parameters and coefficients. ```python fitted_models = bt.get_fitted_models() ``` -------------------------------- ### Instantiate and Configure DLT Model Source: https://github.com/uber/orbit/blob/dev/examples/backtest_animation.ipynb Initializes a DLT (Dynamic Linear Trend) model with specified date, response, and regressor columns, seasonality, and estimation method. ```python # instantiate a model dlt = DLT(date_col='week', response_col='claims', regressor_col=['trend.unemploy', 'trend.filling', 'trend.job'], seasonality=52, estimator='stan-map') ``` -------------------------------- ### Initialize LGT Model with MAP Estimator Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/lgt.ipynb Instantiate the LGT model for forecasting using the MAP (Maximum A Posteriori) estimation method. Specify the response and date columns, seasonality, and a random seed for reproducibility. ```python lgt = LGT( response_col=response_col, date_col=date_col, estimator='stan-map', seasonality=52, seed=8888, ) ``` -------------------------------- ### Get Prediction Line Color Source: https://github.com/uber/orbit/blob/dev/examples/ktr_simulation.ipynb Retrieves the hex color code for the prediction line from the `PredictionPaletteClassic`. This color is used in plotting to represent estimated values. ```python PredPal.PREDICTION_LINE.value ``` -------------------------------- ### Import Simulation and Metrics Utilities Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/regression_penalty.ipynb Imports utilities for generating simulated datasets and calculating metrics like Mean Squared Error (MSE). These are essential for testing and evaluating regression models. ```python import pandas as pd from orbit.utils.simulation import make_trend, make_regression from orbit.diagnostics.metrics import mse ``` -------------------------------- ### Legacy PyPI Deployment Command (Deprecated) Source: https://github.com/uber/orbit/blob/dev/RELEASE.md The deprecated command for creating source distributions and wheels. ```bash python3 setup.py sdist bdist_wheel ``` -------------------------------- ### Logarithmic Transformation of Response Variable Source: https://github.com/uber/orbit/blob/dev/examples/dlt_daily_forecast.ipynb Applies a logarithmic transformation to the response variable, anchoring the start at zero. This is a common preprocessing step for time series data. ```python m = df[response_col][0] df[response_col] = np.log(df[response_col]/m) print(df.shape) df.head() ``` -------------------------------- ### Load and Inspect Sample Dataset Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/set_random_seed.ipynb Load the 'iclaims' dataset using orbit.utils.dataset.load_iclaims and display the first 5 rows. This dataset is used for demonstrating model fitting. ```python df = load_iclaims() df.head(5) ``` -------------------------------- ### Get Posterior Samples from LGT MCMC Model Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/lgt.ipynb Retrieve the keys for the posterior samples obtained from the LGT MCMC model. These samples represent the uncertainty in the model parameters. ```python lgt.get_posterior_samples().keys() ``` -------------------------------- ### Initialize KTR with Coefficient Priors Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ktr4.ipynb Initializes the KTR model with specified coefficient priors using the `coef_prior_list` argument. ```python ktr = KTR( response_col='y', date_col='date', regressor_col=regressor_col, regressor_init_knot_scale=[0.1] * p, regressor_knot_scale=[0.1] * p, regressor_sign=['+'] * p, coef_prior_list = coef_list_dict, prediction_percentiles=[2.5, 97.5], seed=2021, estimator='pyro-svi', ) ktr.fit(df=data) ``` -------------------------------- ### Import Grid Search Utility Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/backtest.ipynb Imports the grid_search_orbit utility for hyperparameter tuning. This function helps in searching for optimal model parameters by comparing backtest metrics. ```python from orbit.utils.params_tuning import grid_search_orbit ``` -------------------------------- ### Initialize and Train DLT Model Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/decompose_prediction.ipynb Initializes a DLT model with specified parameters including seasonality and prediction percentiles, then fits the model to the training data. ```python dlt = DLT( response_col=response_col, regressor_col=regressor_col, date_col=date_col, seasonality=52, prediction_percentiles=[5, 95], stan_mcmc_args={'show_progress': False}, ) dlt.fit(train_df) ``` -------------------------------- ### Configure Expanding Window Splitter Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/backtest.ipynb Sets configuration parameters for the TimeSeriesSplitter, including minimum training length, forecast length, and incremental step length for an expanding window. ```python # configs min_train_len = 380 # minimal length of window length forecast_len = 20 # length forecast window incremental_len = 20 # step length for moving forward ``` -------------------------------- ### Fit Linear Regression Model Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/utilities_simulation.ipynb Fits a Linear Regression model from scikit-learn to the generated regression data (x, y) and prints the learned coefficients. This snippet requires scikit-learn to be installed. ```python from sklearn.linear_model import LinearRegression # check if get the coefficients as set up reg = LinearRegression().fit(x, y) print(reg.coef_) ``` -------------------------------- ### Initialize KTR Model Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ktr2.ipynb Creates an instance of the KTR model, specifying response, date, and regressor columns, prediction percentiles, a random seed, and the estimator to use (e.g., 'pyro-svi'). ```python ktr = KTR( response_col=response_col, date_col=date_col, regressor_col=regressor_col, prediction_percentiles=[2.5, 97.5], seed=2021, estimator='pyro-svi', ) ``` -------------------------------- ### Get Knot Index by Knot Distance Source: https://github.com/uber/orbit/blob/dev/examples/ktr_simulation.ipynb Calculates knot indices by specifying the number of observations and the distance between consecutive knots. This method is useful when a fixed interval between knots is required. ```python knot_idx = get_knot_idx(num_of_obs=250, knot_distance=10) knot_idx ``` -------------------------------- ### Get Posterior Samples Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/model_diagnostics.ipynb Retrieves posterior samples from the fitted DLT model. 'relabel=True' is used to relabel regression coefficients, and 'permute=False' ensures all necessary information for plotting is retained. ```python ps = dlt.get_posterior_samples(relabel=True, permute=False) ps.keys() ``` -------------------------------- ### Initialize DLT Forecaster Source: https://github.com/uber/orbit/blob/dev/examples/eda_orbit_style.ipynb Initializes the DLT (Direct Learning Time Series) forecaster with specified response, date, seasonality, and seed parameters. This prepares the model for training. ```python dlt = DLT(response_col='claims', date_col='week', seasonality=52, seed=2020) ``` -------------------------------- ### Initialize LGT Model with MCMC Estimator Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/lgt.ipynb Instantiate the LGT model for forecasting using the MCMC (Markov Chain Monte Carlo) sampling method, which is the default. Configure MCMC arguments such as disabling progress display. ```python lgt = LGT( response_col=response_col, date_col=date_col, seasonality=52, seed=2024, stan_mcmc_args={'show_progress': False}, ) ``` -------------------------------- ### Initialize and Fit KTR Model Source: https://github.com/uber/orbit/blob/dev/examples/ktr_simulation.ipynb Initializes a KTR model with specified parameters and fits it to the provided data. This snippet configures regression, level, and prediction settings for SVI optimization. ```python regressor_col = ['x{}'.format(pp) for pp in range(1, p+1)] ``` ```python ktrx_neutral = KTR( response_col='y', date_col='date', level_knot_scale=.1, regressor_col=regressor_col, regressor_init_knot_loc=[0] * len(regressor_col), regressor_init_knot_scale=[10.0] * len(regressor_col), regressor_knot_scale=[2.0] * len(regressor_col), level_segments=10, regression_segments=10, regression_rho=0.05, prediction_percentiles=[2.5, 97.5], seed=2020, num_steps=501, num_sample=1000, learning_rate=0.2, learning_rate_total_decay=0.05, verbose=True, message=50, flat_multiplier=True, ) ktrx_neutral.fit(df=seas_data) ``` -------------------------------- ### Import Libraries for DLT Regression Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/regression_penalty.ipynb Imports necessary libraries for DLT regression, including plotting, numpy, orbit, and dataset utilities. This setup is required for all subsequent DLT modeling tasks. ```python %matplotlib inline import matplotlib.pyplot as plt import numpy as np import orbit from orbit.utils.dataset import load_iclaims from orbit.models import DLT from orbit.diagnostics.plot import plot_predicted_data from orbit.constants.palette import OrbitPalette ``` -------------------------------- ### Initialize and Fit DLT Model Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/model_diagnostics.ipynb Initializes a DLT (Double Local Time) model with specified parameters and fits it to the dataset. MCMC sampling arguments are configured to suppress progress output. ```python dlt = DLT( response_col=RESPONSE_COL, date_col=DATE_COL, regressor_col=REGRESSOR_COL, seasonality=52, num_warmup=2000, num_sample=2000, chains=4, stan_mcmc_args={'show_progress': False}, ) ``` ```python dlt.fit(df=df) ``` -------------------------------- ### Get Regression Coefficients with Confidence Intervals Source: https://github.com/uber/orbit/blob/dev/examples/ktr_simulation.ipynb Retrieves the estimated regression coefficients, including their confidence intervals, from the fitted KTR model. This is useful for understanding the uncertainty around the estimated effects of regressors. ```python idx = 3 coef_mid, coef_lower, coef_upper = ktrx_neutral.get_regression_coefs(include_ci=True) ``` -------------------------------- ### Initialize LGT Model with Pyro SVI Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/pyro_basic.ipynb Configures and initializes the LGT (Linear Growth Trend) model using Pyro's Stochastic Variational Inference (SVI) estimator. Key parameters include seasonality, number of training steps, sampling size, and learning rate. ```python lgt_vi = LGT( response_col='claims', date_col='week', seasonality=52, seed=8888, estimator='pyro-svi', num_steps=101, num_sample=300, # trigger message per 50 steps message=50, learning_rate=0.1, ) ``` -------------------------------- ### Get Knot Index by Number of Segments Source: https://github.com/uber/orbit/blob/dev/examples/ktr_simulation.ipynb Calculates knot indices based on the total number of observations and the desired number of segments. Useful for evenly distributing knots across a time series. ```python knot_idx = get_knot_idx(num_of_obs=400, num_of_segments=10) knot_idx ``` -------------------------------- ### Get and Plot Regression Coefficients with Confidence Intervals Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ktr2.ipynb Retrieve estimated regression coefficients along with their confidence intervals and plot them against the true values. This helps in visualizing the model's fit and the uncertainty around the estimates. ```python coef_mid, coef_lower, coef_upper = ktr.get_regression_coefs(include_ci=True) fig, axes = plt.subplots(p, 1, figsize=(12, 12), sharex=True) x = np.arange(coef_mid.shape[0]) for idx in range(p): axes[idx].plot(x, coef_mid['x{}'.format(idx + 1)], label='est' if idx == 0 else "", color=OrbitPalette.BLUE.value) axes[idx].fill_between(x, coef_lower['x{}'.format(idx + 1)], coef_upper['x{}'.format(idx + 1)], alpha=0.2, color=OrbitPalette.BLUE.value) axes[idx].scatter(x, sc_data['beta{}'.format(idx + 1)], label='truth' if idx == 0 else "", s=10, alpha=0.6, color=OrbitPalette.BLACK.value) axes[idx].set_title('beta{}'.format(idx + 1)) fig.legend(bbox_to_anchor = (1, 0.5)); ``` -------------------------------- ### Fit the SVIForecaster to Training Data Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/build_your_own_model.ipynb Train the SVIForecaster using the prepared training data. This process involves fitting the custom model to the historical time series data. ```python blr.fit(train_df) ``` -------------------------------- ### Get Knot Index from Date Array and Knot Dates Source: https://github.com/uber/orbit/blob/dev/examples/ktr_simulation.ipynb Calculates knot indices by providing both the main date array and an array of specific knot dates. This is useful for aligning simulation knots with predefined event dates. ```python knot_idx = get_knot_idx(date_array=date_array, knot_dates=knot_dates) knot_idx ``` -------------------------------- ### Initialize DLT Model Source: https://github.com/uber/orbit/blob/dev/examples/dlt_daily_forecast.ipynb Initializes the DLT model with specified parameters, including date and response columns, regressors, seed, forecast horizon, and estimator type. The `forecast_horizon` is set to 90 for quarterly forecasting. ```python dlt = DLT( date_col=date_col, response_col=response_col, regressor_col=fs_cols, seed=2022, forecast_horizon=90, estimator='stan-map', verbose=False, ) ``` -------------------------------- ### Display First Few Rows of Tuned DataFrame Source: https://github.com/uber/orbit/blob/dev/examples/dlt_daily_forecast.ipynb Shows the initial rows of the DataFrame after hyperparameter tuning, displaying tuned parameters and their corresponding metrics. ```python tuned_df.head() ``` -------------------------------- ### Retrieve Knot Dates using Utility Function Source: https://github.com/uber/orbit/blob/dev/examples/ktr_simulation.ipynb Uses the get_knot_dates utility function to retrieve the specific dates for each knot index, starting from the first date in the array and considering the inferred frequency. This provides a clear mapping from knot indices to calendar dates. ```python get_knot_dates(date_array[0], knot_idx, infer_freq) ``` -------------------------------- ### Instantiate a DLT model Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/backtest.ipynb Initialize a DLT (Dynamic Linear Model) model with specified columns for date, response, and regressors, along with seasonality and estimator type. Set verbose to False to reduce output messages. ```python # instantiate a model dlt = DLT( date_col='week', response_col='claims', regressor_col=['trend.unemploy', 'trend.filling', 'trend.job'], seasonality=52, estimator='stan-map', # reduce number of messages verbose=False, ) ``` -------------------------------- ### Fit DLT Model with MCMC Source: https://github.com/uber/orbit/blob/dev/examples/dlt_daily_forecast.ipynb Initializes and fits a DLT model using MCMC for comprehensive uncertainty estimation. This is done after identifying the best hyperparameters from a previous tuning step. The model is configured with specific seasonality, seed, and MCMC sampling parameters. ```python dlt = DLT( date_col=date_col, response_col=response_col, regressor_col=fs_cols, seasonality=7, seed=2022, estimator='stan-mcmc', **best_params[0], num_warmup=500, num_sample=500, ) dlt.fit(train_df); ``` -------------------------------- ### Imageio Version Output Source: https://github.com/uber/orbit/blob/dev/examples/dlt-animation.ipynb Prints the version of the imageio library being used. This is typically shown after importing imageio. ```text 2.16.2 ``` -------------------------------- ### Load and prepare electricity demand data Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ktr1.ipynb Loads a dataset of daily electricity demand, applies a logarithmic transformation to the response variable, and prints the shape of the resulting DataFrame. This prepares the data for time series modeling. ```python # from 2000-01-01 to 2008-12-31 df = load_electricity_demand() date_col = 'date' response_col = 'electricity' df[response_col] = np.log(df[response_col]) print(df.shape) df.head() ``` -------------------------------- ### Import Libraries for Orbit Backtesting Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/backtest.ipynb Imports necessary libraries for time series analysis, modeling, and backtesting with Orbit. Includes pandas, numpy, matplotlib, and specific Orbit modules. ```python %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt import orbit from orbit.models import LGT, DLT from orbit.diagnostics.backtest import BackTester, TimeSeriesSplitter from orbit.diagnostics.plot import plot_bt_predictions from orbit.diagnostics.metrics import smape, wmape from orbit.utils.dataset import load_iclaims import warnings warnings.filterwarnings('ignore') ``` -------------------------------- ### Displaying Best Parameters Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/backtest.ipynb Outputs the best parameters found by the grid search that optimize the specified criteria. ```python best_params # output best parameters ``` -------------------------------- ### Run Tests and Check Coverage Source: https://github.com/uber/orbit/blob/dev/CONTRIBUTING.md Execute all tests and ensure a minimum test coverage of 70% using pytest. ```bash pytest -vs tests/ --cov orbit/ ``` -------------------------------- ### Load and Prepare Data Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/decompose_prediction.ipynb Loads the 'iclaims' dataset and splits it into training and testing sets. Defines columns for response, date, and regressors. ```python # load log-transformed data df = load_iclaims() train_df = df[df['week'] < '2017-01-01'] test_df = df[df['week'] >= '2017-01-01'] response_col = 'claims' date_col = 'week' regressor_col = ['trend.unemploy', 'trend.filling', 'trend.job'] ``` -------------------------------- ### Configure Backtester Parameters Source: https://github.com/uber/orbit/blob/dev/examples/backtest_animation.ipynb Sets the number of backtesting splits and the forecast length for future predictions. ```python n_splits = 6 forecast_len = 28 # future 4 week projection incremental_len = 28 ``` -------------------------------- ### Define Regressor and Response Columns Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ktr2.ipynb Sets up the column names for regressors, the response variable, and the date column. This is a prerequisite for fitting the KTR model. ```python # num of predictors p = 3 regressor_col = ['x{}'.format(pp) for pp in range(1, p + 1)] response_col = 'y' date_col='date' ``` -------------------------------- ### Show Black Code Changes Without Applying Source: https://github.com/uber/orbit/blob/dev/CONTRIBUTING.md Preview the code changes that Black would make to a file without actually modifying it. ```bash black --diff ``` -------------------------------- ### Initialize BayesLinearRegression Model Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/build_your_own_model.ipynb Instantiate the custom BayesLinearRegression model, specifying the regressor columns to be used as input features. ```python model = BayesLinearRegression( regressor_col=['x1','x2'], ) ``` -------------------------------- ### Load and prepare dataset Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/exploratory_data_analysis.ipynb Loads the 'iclaims' dataset and converts the 'week' column to datetime objects. This prepares the data for time series analysis and plotting. ```python df = load_iclaims() df['week'] = pd.to_datetime(df['week']) ``` -------------------------------- ### Initialize and Train DLT Model Source: https://github.com/uber/orbit/blob/dev/examples/dlt_daily_forecast.ipynb Initializes a DLT model with weekly seasonality, Fourier terms, and holiday regressors, using the 'stan-mcmc' estimator. The model is then trained on the training data. Execution time is measured. ```python %%time dlt = DLT( response_col='y', date_col='date', seasonality=7, seed=2020, regressor_col=fs_cols + regressor_col, estimator='stan-mcmc', ) dlt.fit(train_df) ``` -------------------------------- ### Import Orbit Knot Utilities Source: https://github.com/uber/orbit/blob/dev/examples/ktr_simulation.ipynb Imports necessary functions for knot index calculation and date retrieval from Orbit's utility module. ```python from orbit.utils.knots import get_knot_idx_by_dist, get_knot_idx, get_knot_dates ``` -------------------------------- ### Load and Inspect Dataset Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/model_diagnostics.ipynb Loads the 'iclaims' dataset and displays its data types and the first five rows. ```python df = load_iclaims() df.dtypes ``` ```python df.head(5) ``` -------------------------------- ### Load and Inspect Dataset Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ets_lgt_dlt_missing_response.ipynb Loads the 'iclaims' dataset and displays its data types and the first few rows. This step is crucial for understanding the data structure before splitting it into training and testing sets. ```python # can also consider transform=False raw_df = load_iclaims(transform=True) raw_df.dtypes df = raw_df.copy() df.head() ``` -------------------------------- ### Initialize KTR with Dual Seasonality Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ktr1.ipynb Initialize a KTR object specifying weekly (7 days) and yearly (365.25 days) seasonality. This is useful when the time series exhibits multiple cyclical patterns. Ensure the `seasonality` periods are appropriate for your daily data. ```python ktr_with_seas = KTR( response_col=response_col, date_col=date_col, seed=2021, seasonality=[7, 365.25], estimator='pyro-svi', n_bootstrap_draws=1e4, # pyro training config num_steps=301, message=100, ) ``` -------------------------------- ### Split Data into Training and Testing Sets Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/build_your_own_model.ipynb Partition the DataFrame into training and testing sets. This is a standard practice for evaluating model performance on unseen data. ```python test_size = 20 train_df = df[:-test_size] test_df = df[-test_size:] ``` -------------------------------- ### Configure Rolling Window Splitter Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/backtest.ipynb Sets configuration parameters for the TimeSeriesSplitter, specifying minimum training length (as fixed window length), forecast length, and incremental step length for a rolling window. ```python # configs min_train_len = 380 # in case of rolling window, this specify the length of window length forecast_len = 20 # length forecast window incremental_len = 20 # step length for moving forward ``` -------------------------------- ### Create and Display Knot Dates Array Source: https://github.com/uber/orbit/blob/dev/examples/ktr_simulation.ipynb Creates a NumPy array of specific knot dates and displays the first five entries. Ensures the dates are correctly formatted as datetime64. ```python knot_dates=['2018-01-01','2018-07-01','2018-09-09'] knot_dates = np.array(knot_dates, dtype='datetime64') knot_dates[:5] ``` -------------------------------- ### Initialize KTR with Strictly Positive Regressor Coefficients Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ktr4.ipynb Initializes the KTR model with strictly positive coefficients for all regressors using the `regressor_sign` argument. ```python ktr = KTR( response_col='y', date_col='date', regressor_col=regressor_col, regressor_init_knot_scale=[0.1] * p, regressor_knot_scale=[0.1] * p, regressor_sign=['+'] * p, prediction_percentiles=[2.5, 97.5], seed=2021, estimator='pyro-svi', ) ktr.fit(df=data) ``` -------------------------------- ### Import necessary libraries Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/other_utilities.ipynb Imports pandas, numpy, and specific utility functions from Orbit. It also suppresses warnings. ```python import pandas as pd import numpy as np from orbit.utils.general import expand_grid, regenerate_base_df import warnings warnings.filterwarnings('ignore') ``` -------------------------------- ### Initialize KTR with Custom Knot Priors and Segments Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ktr2.ipynb Initialize the KTR model specifying prior knot locations, scales, and the number of regression segments. Use this when you have prior knowledge about potential change points or want to control the flexibility of the regression. ```python ktr = KTR( response_col=response_col, date_col=date_col, regressor_col=regressor_col, regressor_init_knot_loc=[0] * len(regressor_col), regressor_init_knot_scale=[10.0] * len(regressor_col), regressor_knot_scale=[2.0] * len(regressor_col), regression_segments=6, prediction_percentiles=[2.5, 97.5], seed=2021, estimator='pyro-svi', ) ktr.fit(df=sc_data) ``` -------------------------------- ### Load M5 Daily Sales Data Source: https://github.com/uber/orbit/blob/dev/examples/dlt_daily_forecast.ipynb Loads the M5 daily sales dataset. A subset of holiday regressors is selected for demonstration purposes. ```python df = load_m5daily() # get a subset of regressor for demo purpose regressor_col = ["Christmas","Halloween","LaborDay","Thanksgiving","Mother's day","PresidentsDay","NewYear"] ``` -------------------------------- ### Create Fourier Series and Preprocess Data Source: https://github.com/uber/orbit/blob/dev/examples/dlt_daily_forecast.ipynb Generates Fourier terms for annual seasonality using `make_fourier_series_df`. The response variable 'sales' is log-transformed and divided by the first observation to create a multiplicative model. ```python df, fs_cols = make_fourier_series_df(df, period=365.25, order=3) # trim data with useful columns only df = df[["date", "sales"] + fs_cols + regressor_col] m = df['sales'][0] df['y'] = np.log(df['sales']/m) ``` -------------------------------- ### Generate Trace Plot for Regression Coefficients Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/model_diagnostics.ipynb Creates a trace plot using ArviZ to visualize the convergence of MCMC samples for the regression coefficients ('trend.unemploy', 'trend.filling', 'trend.job'). Different colors are assigned to each chain. ```python az.style.use('arviz-darkgrid') az.plot_trace( ps, var_names=['trend.unemploy', 'trend.filling', 'trend.job'], chain_prop={"color": ['r', 'b', 'g', 'y']}, figsize=(10, 8), ); ``` -------------------------------- ### Import Libraries for Orbit and Data Handling Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/pyro_basic.ipynb Imports necessary libraries for data manipulation, modeling, plotting, and loading sample datasets within the Orbit framework. Includes specific imports for LGT, diagnostics, and dataset utilities. ```python %matplotlib inline import pandas as pd import numpy as np import matplotlib.pyplot as plt import orbit from orbit.models import LGT from orbit.diagnostics.plot import plot_predicted_data from orbit.diagnostics.plot import plot_predicted_components from orbit.utils.dataset import load_iclaims from orbit.constants.palette import OrbitPalette import warnings warnings.filterwarnings('ignore') ``` -------------------------------- ### Initialize TimeSeriesSplitter with n_splits Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/backtest.ipynb Initialize TimeSeriesSplitter by specifying the number of splits (n_splits) instead of the minimum training length. The minimum training length will be calculated automatically. ```python ex_splitter2 = TimeSeriesSplitter( data, min_train_len=min_train_len, incremental_len=incremental_len, forecast_len=forecast_len, n_splits=5, window_type='expanding', date_col='week' ) ``` -------------------------------- ### Import KTR Model Source: https://github.com/uber/orbit/blob/dev/examples/ktr_simulation.ipynb Imports the KTR model from the orbit.models module. This is the first step before initializing any KTR model. ```python from orbit.models import KTR ``` -------------------------------- ### Simulate Seasonal Data Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ktr2.ipynb Generates a simulated dataset with seasonal patterns. Use this to create sample data for time series modeling. ```python sc_data = sim_data_seasonal(n=80, RS=2021) sc_data.head(10) ``` -------------------------------- ### Initialize Bayesian ETS model Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/quick_start.ipynb Initializes a Bayesian ETS model using CmdStanPy. Sets the response and date columns, seasonality, random seed, and specifies the estimator as 'stan-mcmc'. Progress display for MCMC sampling is turned off. ```python ets = ETS( response_col=response_col, date_col=date_col, seasonality=52, seed=2024, estimator="stan-mcmc", stan_mcmc_args={'show_progress': False}, ) ``` -------------------------------- ### Fit DLT Model With Regression Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/regression_prior.ipynb Initializes and fits a DLT model including specified external regressors ('trend.unemploy', 'trend.job', 'sp500', 'vix'). This model incorporates additional features for potentially improved forecasting accuracy. Requires the 'orbit' library. ```python dlt_reg = DLT( response_col=response_col, date_col=date_col, regressor_col=['trend.unemploy', 'trend.job', 'sp500', 'vix'], seasonality=52, seed=8888, num_warmup=4000, stan_mcmc_args={'show_progress': False} ) dlt_reg.fit(df=train_df) predicted_df_reg = dlt_reg.predict(test_df) ``` -------------------------------- ### Lint All Files in Directory with Black Source: https://github.com/uber/orbit/blob/dev/CONTRIBUTING.md Run Black linting on all files within the current directory to ensure consistent code style. ```bash black . ``` -------------------------------- ### Configure DLT with Informative Priors and Sign Constraints Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/regression_prior.ipynb Use `regressor_beta_prior`, `regressor_sigma_prior`, and `regressor_sign` to customize the prior distributions and sign constraints for regressors in the DLT model. This allows incorporating domain knowledge into the model. ```python dlt_reg_adjust = DLT( response_col=response_col, date_col=date_col, regressor_col=['trend.unemploy', 'trend.job', 'sp500','vix'], regressor_sign=['+','=','-','+'], regressor_sigma_prior=[0.3, 0.1, 0.05, 0.1], num_warmup=4000, num_sample=1000, estimator='stan-mcmc', seed=2022, stan_mcmc_args={'show_progress': False} ) dlt_reg_adjust.fit(df=train_df) predicted_df_reg_adjust = dlt_reg_adjust.predict(test_df) ``` -------------------------------- ### Prepare Data for DLT Model Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/regression_prior.ipynb Prepares the DataFrame by calculating the difference for the 'sp500' column and resetting the index. Splits the data into training and testing sets. ```python df[['sp500']] = df[['sp500']].diff() df = df[1:].reset_index(drop=True) test_size = 12 train_df = df[:-test_size] test_df = df[-test_size:] ``` -------------------------------- ### Import Orbit EDA and Dataset Utilities Source: https://github.com/uber/orbit/blob/dev/examples/eda_orbit_style.ipynb Imports necessary modules from the Orbit library for data loading and EDA plotting, along with common data science libraries like seaborn, pandas, and numpy. Also imports plotting and model diagnostic tools. ```python from orbit.utils.dataset import load_iclaims from orbit.eda import eda_plot import orbit.constants.palette as palette import seaborn as sns import pandas as pd import numpy as np from orbit.models import LGT, DLT import arviz as az from orbit.diagnostics.plot import plot_predicted_data from orbit.utils.plot import get_orbit_style import matplotlib.pyplot as plt %matplotlib inline ``` -------------------------------- ### Create Output Directory Source: https://github.com/uber/orbit/blob/dev/examples/dlt-animation.ipynb Creates a temporary directory named 'temp' to store generated plot images if it does not already exist. This is a common practice for organizing output files. ```python # create a new directory because it does not exist fig_dir = './temp' is_exist = os.path.exists(fig_dir) if not is_exist: os.makedirs(fig_dir) ``` -------------------------------- ### Visualize Expanding Window Splits Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/backtest.ipynb Generates and displays a plot visualizing the data splits created by the TimeSeriesSplitter for the expanding window strategy. Shows training and testing periods. ```python _ = ex_splitter.plot() ``` -------------------------------- ### Rebase and Merge Release Branch to Master Source: https://github.com/uber/orbit/blob/dev/RELEASE.md Commands to rebase and merge the release branch into the master branch, followed by tagging and pushing. ```bash git checkout master git rebase --no-ff release-v1.0.15 git tag -a v1.0.15 git push origin master ``` -------------------------------- ### Define time series keys and datetime range Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/other_utilities.ipynb Creates a list of series keys and a date range for the time series. The output shows the generated keys and the datetime index. ```python dt = pd.date_range('2020-01-31', '2022-12-31', freq='M') keys = ['x' + str(x) for x in range(10)] print(keys) print(dt) ``` -------------------------------- ### Compare Estimated Coefficients with Truth Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/build_your_own_model.ipynb Prints the true coefficients and the median of the estimated coefficients from posterior samples. Requires pre-defined 'coefs' and 'estimated_weights'. ```python print("True Coef: {:.3f}, {:.3f}".format(coefs[0], coefs[1]) ) estimated_coef = np.median(estimated_weights, axis=0) print("Estimated Coef: {:.3f}, {:.3f}".format(estimated_coef[0], estimated_coef[1])) ``` -------------------------------- ### Plot Backtest Predictions (Animated GIF) Source: https://github.com/uber/orbit/blob/dev/examples/backtest_animation.ipynb Generates an animated GIF of the backtest predictions using plot_bt_predictions2 with `export_gif=True`. Includes configuration for imageio arguments like frames per second (fps). ```python plot_bt_predictions2(bt_pred_df=predicted_df, metrics=smape, figsize=(16, 8), is_visible=False, fig_dir='temp/', export_gif=True, markersize=80, imageio_args={'fps': 2.5}) ``` -------------------------------- ### Load and prepare dataset Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/residual_diagnostic.ipynb Loads the 'iclaims' dataset, which contains weekly insurance claims data. It then defines the column names for the response variable and the date. ```python # load log-transformed data df = load_iclaims() response_col = 'claims' date_col = 'week' ``` -------------------------------- ### Initialize and fit DLT model Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/residual_diagnostic.ipynb Initializes a Discounted Linear Trend (DLT) model with specified parameters, including seasonality and regressors, then fits the model to the provided DataFrame. The 'stan-map' estimator is used for fitting. ```python dlt = DLT( response_col=response_col, date_col=date_col, estimator='stan-map', seed=8888, seasonality=52, regressor_col=['trend.unemploy', 'trend.filling'], regressor_beta_prior=[0.1, 0.3], regressor_sigma_prior=[0.5, 2.0], ) dlt.fit(df) predicted_df = dlt.predict(df, decompose=False) ``` -------------------------------- ### Display First 5 Rows of Coefficients Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ktr2.ipynb View the first five rows of the extracted mid-point coefficients to quickly inspect the data structure and initial values. ```python coef_mid.head(5) ``` -------------------------------- ### Display DataFrame head Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/exploratory_data_analysis.ipynb Shows the first few rows of the DataFrame to inspect the data structure and content after loading and initial preparation. ```python df.head() ``` -------------------------------- ### Clone Orbit Repository Source: https://github.com/uber/orbit/blob/dev/CONTRIBUTING.md Clone the Orbit repository from GitHub, specifically the 'dev' branch, to begin contributing. ```bash git clone --single-branch --branch dev https://github.com/uber/orbit.git ``` -------------------------------- ### Orbit Palette Initialization Source: https://github.com/uber/orbit/blob/dev/docs/tutorials/ets_lgt_dlt_missing_response.ipynb This code initializes a list of colors from the Orbit Palette. These colors are used for plotting to maintain a consistent visual theme. ```python from orbit.constants.palette import OrbitPalette # just to get some color from orbit palette orbit_palette = [ OrbitPalette.BLACK.value, OrbitPalette.BLUE.value, OrbitPalette.GREEN.value, OrbitPalette.YELLOW.value, ] ```