Constructing Metatron: State-of-the-Artwork Leads Forecasting utilizing Transformers, Ensembling, and Meta-Learners

Constructing Metatron: State-of-the-Artwork Leads Forecasting utilizing Transformers, Ensembling, and Meta-Learners

Metatron, the what and why

Lead technology is our principal strategy to monetize on our platform in the actual property trade. Correct lead forecasts are paramount to serving to information Gross sales, Product, Knowledge Science, and Finance to set the corporate up for achievement. 

While you underestimate lead forecasts, cash is left on the desk as a result of you’ve gotten extra lead quantity you possibly can promote. While you overestimate, you find yourself with under-fulfillment since you are promoting extra quantity than is coming in. Moreover, under-fulfillment decreases buyer satisfaction, and there’s the next probability of buyer churn, which we vehemently wish to keep away from.

Earlier state-of-the-art time-series fashions corresponding to recurrent neural networks (RNNs) – Fb’s Prophet – and Lengthy-Quick Time period Reminiscence (LSTM) fashions have labored effectively for us prior to now. This time, we needed to push past customary methods and embark on a challenge that was adaptable sufficient to offer correct forecasts within the face of challenges, for instance, shifts from black swan occasions (COVID-19), rising rates of interest, and market uncertainty. 

Enter Metatron

To unravel this downside, we created a stacked ensemble mannequin that mixes varied modeling approaches and incorporates a number of state-of-the-art temporal fusion transformer (TFT)[1] fashions. TFT fashions are efficient for modeling time-series information and could be fed a number of sequential time sequence straight and concurrently. The TFT mannequin makes use of the transformers you’ve gotten heard about in giant language fashions (LLMs) corresponding to ChatGPT and applies the identical methods to’s lead information.

TFT is a formidable method, which we additional improve by ensembling it with conventional fashions. We weight every mannequin in accordance with its latest historic efficiency, optimizing our mixed forecasting energy. Then, we use a meta-learner to construct a remaining stacked ensemble mannequin, which takes within the a number of modeling approaches and outputs a single prediction per zip code and product vertical. The ZIP code predictions are made month-to-month and predicted out 12 months into the long run. We name this progressive and adaptable method “Metatron.” Metratron helped us overcome many challenges within the present actual property local weather and make correct predictions within the face of uncertainty. It’s additionally serving to the enterprise drive income whereas rising buyer satisfaction. 

This publish delves additional into our methodology and the varied modeling approaches used to construct Metatron.

How Did We Construct Metatron?


To successfully handle the numerous variation in lead volumes throughout ZIP codes, the ZIPs are categorized into deciles in accordance with their lead quantity. Decrease-numbered deciles (1, 2, 3, and so forth.) embrace ZIP codes with increased lead counts, whereas higher-numbered deciles (7,8,9,10) include ZIPs with decrease lead volumes. The low and high-volume deciles are educated individually, with deciles 1 by means of 9 forming one coaching group and the lowest-volume decile (10) forming the opposite. This method permits for tailored-modeling methods higher suited to every decile group’s traits.

Observe that we will solely use decile coaching for fashions that enable passing in a number of time sequence. In distinction, the fashions we used from the Darts library work on single time sequence and will likely be known as native fashions any longer. Native fashions make predictions at particular person ZIP code ranges. We are going to talk about these in additional element within the following sections.

The mannequin forecasts are output month-to-month, and the mannequin coaching is up to date month-to-month to make sure essentially the most correct predictions. Now, we are going to discover the standard and varied TFT fashions additional.


Native Fashions Utilizing Darts

In Metatron, we leverage fashions from the Darts[2] library that make the most of conventional and naive forecasting methods. Every mannequin is an area mannequin educated on a person time sequence for every ZIP code, creating a definite mannequin for every product and each ZIP code. Complete fashions = # zip codes x # merchandise, the place every mannequin has a single prediction. 

These fashions embrace:

  • Naive Drift: A mannequin that constructs a straight line from the preliminary to the ultimate information level within the coaching sequence and extends this pattern into the long run.
  • Naive Imply: This mannequin persistently forecasts the common worth of the coaching sequence.
  • Naive Shifting Common: This mannequin employs an autoregressive transferring common (ARMA) method with a specified sliding window parameter.
  • Naive Seasonal: This naive mannequin forecasts primarily based on the worth from Okay time steps prior. In our software, we use Okay=12, reflecting the idea that the patterns noticed within the earlier 12 months will recur within the following 12 months.

Temporal Fusion Transformer 

The opposite key piece of the puzzle in Metatron is the transformer-based mannequin generally known as the TFT. The “Temporal” facet of TFT highlights its concentrate on time-related or sequential information with inherent dependencies (every product and ZIP code’s month-to-month lead quantity). “Fusion” signifies its functionality to amalgamate info from varied information sources. This may be historic time-varying options, that are solely recognized as much as the time of prediction (for instance, the previous lead quantity of all product verticals), static or time-invariant options (for instance, ZIP or latitude/longitude), and recognized future inputs (for instance, months or holidays like Christmas day). “Transformer” denotes its foundation within the Transformer structure that permits it to be taught longer-term dependencies [1] and is similar structure as the idea for the present LLM revolution.

TFT is a world mannequin that analyzes the relationships between varied time sequence of ZIP codes collectively moderately than individually. It makes use of a shared illustration to uncover underlying patterns and developments throughout all sequence. By modeling the mixed distribution, TFT can determine complicated patterns and relationships which are troublesome or almost unimaginable for native fashions to extract, even when expertly designed.

Along with being a world mannequin, TFT allows simultaneous coaching and prediction of a number of targets. This implies you should utilize a single mannequin to foretell not solely throughout each zip code but additionally for each product – directly. Not like native fashions, which require separate inputs for every product, you possibly can enter every product’s time sequence (Connections Plus, MarketVIP, Ready Connect Concierge, and Third Social gathering) right into a single mannequin and acquire distinct forecasts for every product (multi-target).

We tried multi-target TFT fashions, which had been predicted utilizing a single mannequin throughout all merchandise, and single-target fashions, which independently predicted every product. The one-target fashions used the identical information because the multi-target fashions (Connections Plus, MarketVIP, Ready Connect Concierge, and Third Social gathering time-series information) however simply had that single product’s predictions output for every mannequin. There have been tradeoffs between utilizing a multi-target and single-target mannequin from modeling, ease of implementation, and outcomes standpoints.

Multi-target TFT Mannequin vs. Single-target Mannequin Tradeoffs

  1. Multi-target had just one set of tuned hyperparameters and one mannequin to run throughout inference, simplifying the code and infrastructure required for coaching.
  2. Single-target allowed for an easier optimization operate and usually faster coaching occasions however required extra fashions with completely different optimum hyperparameters.

For each the multi-target mannequin and single-target mannequin, we educated on deciles 1-9 and decile 10 individually. Due to this fact, the multi-target had a complete of two fashions equal to the variety of decile teams, the place every mannequin has a prediction for every ZIP in that decile group throughout all of the merchandise concurrently. The one-target mannequin had a complete of 8 fashions equal to the variety of decile teams (2) occasions the variety of merchandise (4), the place every mannequin has a prediction on the product stage for every ZIP in that decile group.

Mannequin Ensembling

Weighted Ensemble on Latest Efficiency

Following the event of the TFT and naive fashions in our Metatron framework, we refined our forecasting accuracy by means of a focused ensemble methodology. This method concerned weighting fashions primarily based on their latest efficiency, particularly during the last three months, utilizing  Weighted Common Proportion Error (WAPE) evaluated on the decile stage. We prioritized fashions with decrease error charges and calculated the reciprocal of every mannequin’s WAPE. These reciprocal values had been normalized to find out every mannequin’s proportional contribution to the ensemble. This ensured that weights had been uniquely tailor-made to every decile. 

Lastly, we utilized these weights to the predictions inside every decile, multiplying every ZIP code’s predictions by the corresponding decile weight and summing the outcomes to generate the ultimate ensemble output. This was all computed for every product individually and never globally throughout all merchandise. This technique leverages the strengths of each international and native fashions and dynamically adjusts to the newest information, optimizing prediction accuracy throughout our huge array of ZIP codes and merchandise.

Introducing Metatron: Stacked Ensemble Mannequin (Catboost – Meta-Learner)

Now, we’ve all the mandatory items to unveil the total energy of Metatron, our CatBoost[3] meta-learner that mixes all of the efforts introduced above. This mannequin integrates predictions from international fashions (TFT fashions), native fashions (Darts fashions), and the decile-weighted ensemble mannequin. It additionally incorporates further time-related contextual information corresponding to 12 months, yearly developments, and cyclic time options. The diagram beneath illustrates how the ultimate Metatron predictions are generated:

The bottom fashions feed right into a WAPE-weighted ensemble mannequin, after which all fashions, together with the WAPE-weighted ensemble mannequin, feed into Metatron, a Catboost meta-learner. Additionally, the diagram reveals if the fashions had been educated collectively or individually by product and educated on the zip-level or decile stage. To get the full variety of fashions in every block outputting predictions for every zip code and product, it is advisable to multiply the 2 numbers in parentheses (x) of the dotted coloration containers for that corresponding block. For instance, TFT Single-target can be (4) x (2), so 8 complete fashions giving predictions throughout all zip codes and merchandise.

Moreover, the meta-learner was educated in a different way for low and high-volume decile teams to optimize efficiency higher:

  1. Imply Absolute Error (MAE) was used because the loss operate for increased quantity teams (deciles 1-9) attributable to its robustness for bigger and non-zero biased datasets.
  2. Tweedie loss operate was chosen for the bottom quantity group (decile 10) to deal with situations with excessive incidence of zeros successfully.

The meta-model outperforms all different fashions to successfully piece collectively correct ZIP-level predictions throughout the varied merchandise. It does this by synthesizing insights from the varied fashions and extra options given to the meta-model. This was the ultimate piece of the modeling puzzle to get the specified adaptable state-of-the-art outcomes.


We evaluated the efficiency of our fashions utilizing a number of metrics, together with complete share error, the share of ZIP codes with errors inside 20%, and WAPE. WAPE helps us consider how correct every mannequin is by measuring the scale of errors in relation to precise values. It’s calculated just by taking the full of all absolute errors between predicted and precise values, dividing that by the sum of all precise values, after which changing that quantity right into a share.

This metric is especially helpful for evaluating efficiency persistently throughout completely different ZIP codes and deciles, making certain we perceive which fashions carry out finest during which areas.

How Does It Carry out?

When evaluating mannequin efficiency at each the ZIP code stage and the mixture decile stage, Metatron, our Catboost stacked ensemble mannequin, persistently stands out as essentially the most correct and dependable mannequin.

ZIP Code Degree Evaluation:

Metatron excels with 60.95% of ZIP codes inside the ±20% error threshold, and it captures 64.54% of complete precise leads inside this vary, as proven within the determine beneath. The Present Champion and TFT fashions have round 47% ZIP codes inside the ±20% threshold. Due to this fact, the common % relative accuracy improve with Metatron on the zip code stage is 30%. This means Metatron’s superior prediction accuracy over the present champion or TFT fashions by themselves.

Moreover, we see this elevated accuracy secure over month-to-month predictions. The plot beneath reveals the prediction for the month after the plot above. Metatron once more excels, with 60.46% of ZIP codes inside the ±20% error threshold and 62.89% of complete precise leads inside this vary captured. For this month, one of many TFT fashions dropped to 34.32% of ZIP codes with the ±20% error threshold from 47%, highlighting the upper month-to-month volatility in particular person fashions. Notably, this month’s common % relative accuracy improve is 42%. As soon as once more, Metatron gives vastly improved relative prediction accuracy, and this pattern is anticipated to proceed in future months not proven right here.

Mixture Decile Degree Evaluation

Metatron maintains the bottom WAPE throughout all deciles, highlighting its superior efficiency. The Naive Seasonal mannequin reveals the very best WAPE, indicating the bottom accuracy. Different fashions, together with the Present Champion, TFT Multi-Goal, TFT Single-Goal, Naive Ensemble, and Decile Ensemble, persistently have increased WAPE values than Metatron.

Greater-volume ZIP codes (deciles 1 and a pair of, for instance), which have higher information distributions and fewer noise, profit extra from single-target fashions. In distinction, lower-volume ZIP codes, that are noisier and sparse (containing many zeros), profit from the joint optimization throughout all product verticals supplied by multi-target fashions. The plot beneath reveals that the single-target mannequin performs higher within the decrease deciles, and the multi-target mannequin performs finest in decile 10.

Total Efficiency

Metatron stands out as essentially the most dependable mannequin and has demonstrated superior accuracy, minimizing the width of the error distribution on the ZIP code stage and reducing WAPE on the decile stage. This reinforces Metatron’s effectiveness in using predictions from particular person fashions to boost the general efficiency throughout all ZIPs. Comparable outcomes had been noticed throughout completely different forecasting intervals, making it the popular mannequin and new champion. Lengthy dwell Metatron!


Lead technology is paramount to an organization’s success, significantly in the actual property trade. We launched into a journey to get higher and higher at predicting future lead forecasts and developed a strong, state-of-the-art method – Metatron – to generate lead forecasts. Metatron has a foundation in fashionable transformer networks utilizing TFT mixed with many different modeling methods, corresponding to ensembling, meta-learning, and innate information about how the actual property market works, to ship correct month-to-month forecasts that predict 12 months into the long run. 

Metatron allows better income by not underpredicting lead quantity, which may end up in cash left on the desk for Gross sales. On the identical time, we will delight prospects by delivering on our promise and never promoting an excessive amount of lead quantity out there. This gives with extra correct lead forecasting talents and a aggressive edge regardless of market uncertainties.

Please contact Jeff Spencer or Siddharth Arora with any feedback or questions. We’re at all times serious about speaking to others within the trade.

Prepared to succeed in new heights on the forefront of digital actual property? Join us as we construct a approach dwelling for everybody.


  1. Lim, Bryan, Sercan Ö. Arık, Nicolas Loeff, and Tomas Pfister. “Temporal fusion transformers for interpretable multi-horizon time sequence forecasting.” Worldwide Journal of Forecasting 37, no. 4 (2021): 1748-1764.
  2. Herzen, Julien, Francesco Lässig, Samuele Giuliano Piazzetta, Thomas Neuer, Léo Tafti, Guillaume Raille, Tomas Van Pottelbergh, et al. “Darts: Person-friendly fashionable machine studying for time sequence.” Journal of Machine Studying Analysis 23, no. 124 (2022): 1-6.
  3. Dorogush, Anna Veronika, Vasily Ershov, and Andrey Gulin. “CatBoost: gradient boosting with categorical options help.” arXiv preprint arXiv:1810.11363 (2018).

Read More

Read Previous

Greatest Recliners 2024

Read Next

Debtors face surge in curiosity cost after CBN’s price hike

Leave a Reply

Your email address will not be published. Required fields are marked *