{"id":26031,"date":"2025-06-13T09:57:39","date_gmt":"2025-06-13T16:57:39","guid":{"rendered":"https:\/\/tdengine.com\/?p=26031"},"modified":"2025-09-17T06:20:05","modified_gmt":"2025-09-17T13:20:05","slug":"tdgpt-introduces-covariate-forecasting","status":"publish","type":"post","link":"https:\/\/tdengine.com\/tdgpt-introduces-covariate-forecasting\/","title":{"rendered":"TDgpt Introduces Covariate Forecasting"},"content":{"rendered":"\n<p>The TDengine team is excited to announce that TDgpt now supports covariate forecasting for time-series data. This is currently implemented using the <a href=\"https:\/\/www.salesforce.com\/blog\/moirai\/\" rel=\"noopener\">Moirai<\/a> time-series foundation model, with additional models to be added in later versions.<\/p>\n\n\n\n<h2 class=\"gb-text\">What Is Covariate Forecasting?<\/h2>\n\n\n\n<p>Covariate forecasting refers to the practice of incorporating additional variables, referred to as <strong>covariates<\/strong>, into a time-series forecasting model. These variables, which may be historical, static, or even known in advance (such as a weather forecast or calendar event), provide context that can help the model make more informed and accurate predictions.<\/p>\n\n\n\n<p>For instance, consider a model forecasting electricity demand. Rather than relying exclusively on past consumption data, the model can also incorporate temperature forecasts, time of day, and weekday\/weekend indicators. These covariates can meaningfully improve the model\u2019s ability to capture patterns and respond to changes in external conditions.<\/p>\n\n\n\n<h2 class=\"gb-text\">Implementation in TDgpt<\/h2>\n\n\n\n<figure class=\"gb-element-0066e3ed\">\n<img decoding=\"async\" width=\"1970\" height=\"1051\" class=\"gb-media-2fddbaf2\" alt=\"\" src=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/covariate-2.png?strip=all&sharp=1\" title=\"covariate-2\" srcset=\"https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/covariate-2.png?strip=all&amp;sharp=1 1970w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/covariate-2-300x160.png?strip=all&amp;sharp=1 300w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/covariate-2-1024x546.png?strip=all&amp;sharp=1 1024w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/covariate-2-768x410.png?strip=all&amp;sharp=1 768w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/covariate-2-1536x819.png?strip=all&amp;sharp=1 1536w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/covariate-2.png?strip=all&amp;sharp=1&amp;w=394 394w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/covariate-2.png?strip=all&amp;sharp=1&amp;w=1182 1182w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/covariate-2.png?strip=all&amp;sharp=1&amp;w=450 450w, https:\/\/eujqw4hwudm.exactdn.com\/wp-content\/uploads\/covariate-2.png?strip=all&amp;sharp=1&amp;w=1920 1920w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/>\n<\/figure>\n\n\n\n<p>In the illustration above, there are two covariates and one target variable :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Target<\/strong> is the variable to be forecast.<\/li>\n\n\n\n<li><strong>Predicted value<\/strong> is the forecast result.<\/li>\n\n\n\n<li><strong>Past real dynamic features<\/strong> are historical covariates.<\/li>\n\n\n\n<li><strong>Real dynamic features<\/strong> are future covariates.<\/li>\n<\/ul>\n\n\n\n<p>Historical covariate data, as well as future covariate data that span the same time range as the target variable, are fetched from TDengine. However, future covariate values after the time range of the target variable (i.e. corresponding to forecast data) must be manually specified.<\/p>\n\n\n\n<h3 class=\"gb-text\">Historical Covariate Forecasting<\/h3>\n\n\n\n<p>When the <code class=\"\" data-line=\"\">FORECAST<\/code> function in TDgpt is given a single input column, it operates in the default single-variable forecasting mode. When multiple columns are provided, the first column is treated as the target variable, and the subsequent columns are treated as covariates.<\/p>\n\n\n\n<p>Each forecast query allows up to 10 covariate columns as historical inputs. An example SQL statement is shown as follows:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-sql\" data-line=\"\">SELECT _frowts, FORECAST(val, past_co_val, &#039;algo=moirai&#039;) FROM foo;<\/code><\/pre>\n\n\n\n<p>This statement forecasts data from the table <code class=\"\" data-line=\"\">foo<\/code> using the column <code class=\"\" data-line=\"\">val<\/code> as the target and <code class=\"\" data-line=\"\">past_co_val<\/code> as the covariate.<\/p>\n\n\n\n<h3 class=\"gb-text\">Future Covariate Forecasting<\/h3>\n\n\n\n<p>When performing future covariate forecasting, you specify both the future input values and the corresponding covariate columns. These values must be provided in the SQL statement. The number of values must match the number of forecast points.<\/p>\n\n\n\n<p>Future covariates must be named using the prefix <code class=\"\" data-line=\"\">dynamic_real_<\/code>. For each future input variable, you must also define the associated covariate column with the parameter <code class=\"\" data-line=\"\">&lt;future-covariate-name&gt;_col<\/code>, for example the column associated with <code class=\"\" data-line=\"\">dynamic_real_1<\/code> is specified using the parameter <code class=\"\" data-line=\"\">dynamic_real_1_col<\/code>. An example SQL statement is shown as follows:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-sql\" data-line=\"\">SELECT _frowts, FORECAST(val, past_co_val, future_co_val, &quot;algo=moirai,rows=4,dynamic_real_1=[1 1 1 1],dynamic_real_1_col=future_co_val&quot;) FROM foo;<\/code><\/pre>\n\n\n\n<p>In this statement, forecasting is performed on the <code class=\"\" data-line=\"\">val<\/code> column, with one historical covariate column <code class=\"\" data-line=\"\">past_co_val<\/code> and one future co-variate column <code class=\"\" data-line=\"\">future_co_val<\/code>.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Four values for the future covariate are provided in the <code class=\"\" data-line=\"\">dynamic_real_1<\/code> parameter.<\/li>\n\n\n\n<li>The association between <code class=\"\" data-line=\"\">dynamic_real_1<\/code> and the future covariate column <code class=\"\" data-line=\"\">future_co_val<\/code> is established using the parameter <code class=\"\" data-line=\"\">dynamic_real_1_col=future_co_val<\/code>.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"gb-text\">Supported Models<\/h2>\n\n\n\n<p>At present, you must use the <a href=\"https:\/\/www.salesforce.com\/blog\/moirai\/\" rel=\"noopener\">Moirai<\/a> foundation model for time-series to perform covariate forecasting in TDgpt. Moirai is Salesforce\u2019s universal time-series forecasting foundation model, designed to deliver accurate predictions across a wide range of domains, frequencies, and variable types without requiring retraining. This model is installed in TDgpt by default in version 3.3.6.4 and later.<\/p>\n\n\n\n<p>For more information about TDgpt, see the <a href=\"https:\/\/docs.tdengine.com\/advanced\/tdgpt\/\">official documentation<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>TDengine is excited to announce that TDgpt now supports covariate forecasting for time-series data.<\/p>\n","protected":false},"author":102,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[22],"tags":[],"ppma_author":[181],"class_list":["post-26031","post","type-post","status-publish","format-standard","hentry","category-news"],"authors":[{"term_id":181,"user_id":102,"is_guest":0,"slug":"tdengine-team","display_name":"TDengine Team","avatar_url":{"url":"https:\/\/tdengine.com\/wp-content\/uploads\/29.03-01-tdengine.png","url2x":"https:\/\/tdengine.com\/wp-content\/uploads\/29.03-01-tdengine.png"},"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/26031","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/users\/102"}],"replies":[{"embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/comments?post=26031"}],"version-history":[{"count":5,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/26031\/revisions"}],"predecessor-version":[{"id":26042,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/posts\/26031\/revisions\/26042"}],"wp:attachment":[{"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/media?parent=26031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/categories?post=26031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/tags?post=26031"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/tdengine.com\/wp-json\/wp\/v2\/ppma_author?post=26031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}