Written by Prasun Biswas and Chandan Durgia

Prelude: __ "Margin Call" is believed to be one of the best movies made around the 2008 Financial Crisis. A must watch if you haven’t. With an astounding story of capitalism and a great cast – it was indeed a success. Though there are many great dialogues in the movie, but one dialogue stayed with me, wherein the CEO/Chairman of the bank mentions to his subordinates "Do you care to know why I’m in this chair with you all? I mean, why I earn the big bucks. I’m here for one reason and one reason alone. I’m here to guess what the music might do a week, a month, a year from now. That’s it. Nothing more".
In this context music means "situation". i.e. it’s all about predicting the future "a week, a month, a year from now", the better you can forecast the bigger games one can win…
There are already a good number of statistical tools like Arima(X), Exponential smoothing, LSTM, ECM etc which are heavily used for forecasting. However, with these techniques usually the quality of the model is sub-par as tuning these models isn’t easy – unless you have an erudite in your team. This is where, with extremely intuitive hyperparameters, Prophet is a game changer.
As they say, Banking is the business of managing risk, and you know you are running the show when your department is called "Bank in a Bank".
The Asset Liability Management (ALM) department of any bank, in simple words, handles two key functions: managing the supply of money (deposits) and catering to the demand of loan books. These functions in turn drive two most important KPIs – liquidity and profitability (related to difference in interest rates between lending and borrowing) of the bank.
From a traditional banking perspective, ALM has always been and is still the core function of any bank. However, with increased competitive pressure, there is significant focus on optimization of the ALM desk and it makes perfect business sense. Assuming a loan book of $500M, even if ALM manages to improve the 100 basis point return for a bank over a year. This translates into savings of $5M dollars.
Market variables like interest rates etc. are driven by the global economy and are always difficult to predict accurately. However, if ALM desk is able to forecast the loan balance drawdowns/prepayments and the deposits inflow/withdrawal with good accuracy, the bank would be able to manage funds optimally in turn improving both liquidity and profitability.
Forecasting loans and deposit balances is challenging as there are too many factors that come into play:
- Trend (e.g. a particular deposit product could be a hit in the market and as the word of mouth spreads the deposits could increase significantly before it saturates)
- Optionality (e.g. loan prepayment, behavioral based deposit withdrawal)
- Seasonality (e.g. deposits balances increase in certain months as people get their refund from tax department)
- Holidays (e.g. deposits balances decrease during festive season holidays)
- Bank’s Strategy (e.g. to improve salability of a particular product, bank might provide better returns to the customer or have a strong marketing campaign)
- Other behavioral dimensions.
Given these, traditional techniques do not yield strong models. The key issue being – these techniques can be hard to tune and are usually too inflexible to incorporate certain assumptions or heuristics.
This is where Facebook’s Prophet model is gaining immense acceptance. Prophet frames the forecasting problem as a curve-fitting exercise rather than looking explicitly at the time-based dependence of each observation within a time series. Furthermore, it logically divides the time series function as:

Finally, it provides extremely intuitive hyperparameters to manage each of these components. Some of the key parameters are discussed hereafter.
A. "Trend" related Hyperparameters:
a. changepoints: This is a hyperparameter to capture any abrupt changes in the time series. Cases like planned strategic move (#5 in the list above) for the future can easily be captured using this parameter. Note that if the user doesn’t provide any changepoints Prophet tries to determine them itself.
b. changepoint_prior_scale: Not all strategic changes are impactful. Some are more impactful than the others. This hyperparameter adjusts the strength of the trend. With the default value of 0.05, the value can be decreased to make the trend flexible and vice versa.
c. growth: The trend of a time series could continue to increase/decrease or saturate at certain levels. Again, for example a new marketing campaign could boost the sales in the near term however it would saturate after a while. This parameter can help define the cap and floor of the trend. (#1 in the list above)
B. "Seasonality" related hyperparameters:
This is where Prophet is significantly better than the other models. (#3 in the list above)
a. seasonality_mode: This could be set as "additive" or "multiplicative". If the seasonal patterns are expected to remain similar in the future then "additive" mode is used (2023 seasonality would be similar to 2015 seasonality), otherwise "multiplicative" mode is used.
b. 3 hyperparameters for yearly seasonality, weekly seasonality, daily seasonality. Depending on the data, these can be set as true or false
c. seasonality_prior_scale: Similar to changepoint_prior_scale. This captures the varying degree of seasonality patterns.
C. "Holiday" related parameters:
a. holiday List: We can pass a custom holiday list to the model to capture any (#4 in the list above)
b. holidays_prior_scale: Similar to changepoint_prior_scale. This captures the varying impacts of various holidays.
2 and #6 in the list above is captured as a part of the "Trend" fitting which leverages "additive model" framework.
So, overall, other than the fact that Prophet provides easy hyperparameters to play, it is worth noting that even with the default parameters the model auto-tunes to great accuracy. Therefore, it doesn’t require strong competency in time series modeling.
Here is a generalized code which iterates through various parameters with the objective of getting minimum MAPE.
from fbprophet import Prophet
from sklearn.model_selection import ParameterGrid
params = {'growth_mode':('multiplicative','additive'),
'seasonality_mode':('multiplicative','additive'),
'changepoint_prior_scale':[0.1,0.2,0.3,0.4,0.5],
'holidays_prior_scale':[0.1,0.2,0.3,0.4,0.5],
'n_changepoints' : [50,100,150]}
grid = ParameterGrid(params)
count = 0
for p in grid:
count = count+1
start=start_date
end=end_date
model_parameters = pd.DataFrame(columns = ['MAPE','Parameters'])
for p in grid:
Pred = pd.DataFrame()
random.seed(120)
train_model =Prophet(growth = p['growth_mode'],
changepoint_prior_scale = p['changepoint_prior_scale'],
holidays_prior_scale = p['holidays_prior_scale'],
n_changepoints = p['n_changepoints'],
seasonality_mode = p['seasonality_mode'],
weekly_seasonality=True,
daily_seasonality = True,
yearly_seasonality = True,
holidays=holiday,
interval_width=0.95)
train_model.add_country_holidays(country_name='US')
train_model.fit(X_train)
train_forecast = train_model.make_future_dataframe(periods=42, freq='D')
train_forecast = train_model.predict(train_forecast)
test=train_forecast[['ds','yhat']]
Actual = df[(df['ds']>start) & (df['ds']<=end)]
Mape = mean_absolute_percentage_error(Actual['y'],abs(Pred['yhat']))
print('MAPE is : ',MAPE)
model_parameters = model_parameters.append({'MAPE':Mape,'Parameters':p},ignore_index=True)
_#Once you receive the final parameters, you can build the final model (finalmodel) and can forecast for n number of periods.
future = final_model.make_future_dataframe(periods=18, freq='D')
forecast = final_model.predict(future)
Cherry on the top:
Prophet in a way is just an extension of the Autoregressive (AR) models, wherein in addition to using lagged variables, supplementary features are generated using Fourier transformation of the input variables. This enables better tuning of the model in turn improving performance and providing ability to decompose the results for better interpretability.
The key issue here is that rarely time series data follows a single pattern over the time period. To tackle this, NeuralProphet was introduced which helps to map nonlinear functions to approximate any continuous function, thereby giving better fit. Without getting into much details here are the key properties of NeuralProphet to keep in mind.
- PyTorch’s Gradient Descent optimization engine makes the modeling process much faster than Prophet
- Autocorrelation is modeled using the Auto-Regressive Network
- Lagged regressors are modeled using a separate FeedForward Neural Network
- Configurable nonlinear deep layers of the FeedForward NN
- Custom losses and metrics you can model in python by using "neuralprophet" package.
Conclusion:
Accurate balance forecasting is one of the key necessities of any bank. The other use cases around balance forecasting could be around Financial Planning and Analysis, PPNR (CCAR) modeling, business unit level balance forecasting etc.
Prophet is an excellent package which gives great accuracy for time series prediction. With the increasing popularity this could become one of the key tool banks would rely on in the future for time series forecasting. Till then, it’s a race and some ALM departments will positively churn extra basis points than the other.
Time will tell! .. Till then Happy Learning!!
Disclaimer: The views expressed in this article are opinions of the authors in their personal capacity and not of their respective employers.