<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – Transformation functions</title>
    <link>/en/sql-reference/functions/ml-functions/transformation-functions/</link>
    <description>Recent content in Transformation functions on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/sql-reference/functions/ml-functions/transformation-functions/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Sql-Reference: APPLY_BISECTING_KMEANS</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/apply-bisecting-kmeans/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/apply-bisecting-kmeans/</guid>
      <description>
        
        
        &lt;p&gt;Applies a trained bisecting k-means model to an input relation, and assigns each new data point to the closest matching cluster in the trained model.

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

If the input relation is defined in Hive, use
&lt;code&gt;&lt;a href=&#34;../../../../../en/sql-reference/functions/hadoop-functions/sync-with-hcatalog-schema/#&#34;&gt;SYNC_WITH_HCATALOG_SCHEMA&lt;/a&gt;&lt;/code&gt; to sync the &lt;code&gt;hcatalog&lt;/code&gt; schema, and then run the machine learning function.

&lt;/div&gt;&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT APPLY_BISECTING_KMEANS( &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;&amp;#39;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
            [, num_clusters = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;num-clusters&lt;/span&gt;&amp;#39;]
            [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;] ] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns. Input columns must be of data type &lt;a href=&#34;../../../../../en/sql-reference/data-types/numeric-data-types/&#34;&gt;numeric&lt;/a&gt;.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;num_clusters&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Integer between 1 and &lt;em&gt;&lt;code&gt;k&lt;/code&gt;&lt;/em&gt; inclusive, where &lt;em&gt;&lt;code&gt;k&lt;/code&gt;&lt;/em&gt; is the number of centers in the model, specifies the number of clusters to use for prediction.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; Value that the model specifies for &lt;em&gt;&lt;code&gt;k&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;privileges&#34;&gt;Privileges&lt;/h2&gt;
&lt;p&gt;Non-superusers: model owner, or USAGE privileges on the model&lt;/p&gt;


      </description>
    </item>
    
    <item>
      <title>Sql-Reference: APPLY_IFOREST</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/apply-iforest/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/apply-iforest/</guid>
      <description>
        
        
        &lt;p&gt;Applies an isolation forest (iForest) model to an input relation. For each input row, the function returns an output row with two fields:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;anomaly_score&lt;/code&gt;: A float value that represents the average path length across all trees in the model normalized by the training sample size.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;is_anomaly&lt;/code&gt;: A Boolean value that indicates whether the input row is an anomaly. This value is true when &lt;code&gt;anomaly_score&lt;/code&gt; is equal to or larger than a given threshold; otherwise, it&#39;s false.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;APPLY_IFOREST( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt; USING PARAMETERS &lt;span class=&#34;code-variable&#34;&gt;param&lt;/span&gt;=&lt;span class=&#34;code-variable&#34;&gt;value&lt;/span&gt;[,...] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns. Column types must match the types of the predictors in &lt;code&gt;model_name&lt;/code&gt;.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;threshold&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Optional. Float in the range (0.0, 1.0), specifies the threshold that determines if a data point is an anomaly. If the &lt;code&gt;anomaly_score&lt;/code&gt; for a data point is equal to or larger than the value of &lt;code&gt;threshold&lt;/code&gt;, the data point is marked as an outlier.
&lt;p&gt;Alternatively, you can specify a &lt;code&gt;contamination&lt;/code&gt; value that sets a threshold where the percentage of training data points labeled as outliers is approximately equal to the value of &lt;code&gt;contamination&lt;/code&gt;. You cannot set both &lt;code&gt;contamination&lt;/code&gt; and &lt;code&gt;threshold&lt;/code&gt; in the same function call.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; 0.7&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Optional. Boolean value that specifies how input columns are matched to model columns:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt;: Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; false&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;contamination&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Optional. Float in the range (0.0, 1.0), the approximate ratio of data points in the training data that are labeled as outliers. The function calculates a threshold based on this &lt;code&gt;contamination&lt;/code&gt; value. If you do not set this parameter, the function marks outliers using the specified or default &lt;code&gt;threshold&lt;/code&gt; value.
&lt;p&gt;You cannot set both &lt;code&gt;contamination&lt;/code&gt; and &lt;code&gt;threshold&lt;/code&gt; in the same function call.&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;privileges&#34;&gt;Privileges&lt;/h2&gt;
&lt;p&gt;Non-superusers:&lt;br /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;USAGE privileges on the model&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;SELECT privileges on the input relation&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example demonstrates how different &lt;code&gt;threshold&lt;/code&gt; values can affect outlier detection on an input relation:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM (SELECT first_name, last_name, APPLY_IFOREST(team, hr, hits, avg, salary USING PARAMETERS model_name=&amp;#39;baseball_anomalies&amp;#39;,
   threshold=0.75) AS predictions FROM baseball) AS outliers WHERE predictions.is_anomaly IS true;
 first_name | last_name |                      predictions
------------+-----------+-------------------------------------------------------
 Jacqueline | Richards  | {&amp;#34;anomaly_score&amp;#34;:0.777757463074347,&amp;#34;is_anomaly&amp;#34;:true}
(1 row)

=&amp;gt; SELECT * FROM (SELECT first_name, last_name, APPLY_IFOREST(team, hr, hits, avg, salary USING PARAMETERS model_name=&amp;#39;baseball_anomalies&amp;#39;,
   threshold=0.55) AS predictions FROM baseball) AS outliers WHERE predictions.is_anomaly IS true;
 first_name | last_name |                      predictions
------------+-----------+--------------------------------------------------------
 Jacqueline | Richards  | {&amp;#34;anomaly_score&amp;#34;:0.777757463074347,&amp;#34;is_anomaly&amp;#34;:true}
 Debra      | Hall      | {&amp;#34;anomaly_score&amp;#34;:0.5714649698133808,&amp;#34;is_anomaly&amp;#34;:true}
 Gerald     | Fuller    | {&amp;#34;anomaly_score&amp;#34;:0.5980549926114661,&amp;#34;is_anomaly&amp;#34;:true}
(3 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can also use different &lt;code&gt;contamination&lt;/code&gt; values to alter the outlier threshold:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM (SELECT first_name, last_name, APPLY_IFOREST(team, hr, hits, avg, salary USING PARAMETERS model_name=&amp;#39;baseball_anomalies&amp;#39;,
   contamination = 0.1) AS predictions FROM baseball) AS outliers WHERE predictions.is_anomaly IS true;
 first_name | last_name |                      predictions
------------+-----------+--------------------------------------------------------
 Marie      | Fields    | {&amp;#34;anomaly_score&amp;#34;:0.5307715717521868,&amp;#34;is_anomaly&amp;#34;:true}
 Jacqueline | Richards  | {&amp;#34;anomaly_score&amp;#34;:0.777757463074347,&amp;#34;is_anomaly&amp;#34;:true}
 Debra      | Hall      | {&amp;#34;anomaly_score&amp;#34;:0.5714649698133808,&amp;#34;is_anomaly&amp;#34;:true}
 Gerald     | Fuller    | {&amp;#34;anomaly_score&amp;#34;:0.5980549926114661,&amp;#34;is_anomaly&amp;#34;:true}
(4 rows)

=&amp;gt; SELECT * FROM (SELECT first_name, last_name, APPLY_IFOREST(team, hr, hits, avg, salary USING PARAMETERS model_name=&amp;#39;baseball_anomalies&amp;#39;,
   contamination = 0.01) AS predictions FROM baseball) AS outliers WHERE predictions.is_anomaly IS true;
 first_name | last_name |                      predictions
------------+-----------+--------------------------------------------------------
 Jacqueline | Richards  | {&amp;#34;anomaly_score&amp;#34;:0.777757463074347,&amp;#34;is_anomaly&amp;#34;:true}
 Debra      | Hall      | {&amp;#34;anomaly_score&amp;#34;:0.5714649698133808,&amp;#34;is_anomaly&amp;#34;:true}
 Gerald     | Fuller    | {&amp;#34;anomaly_score&amp;#34;:0.5980549926114661,&amp;#34;is_anomaly&amp;#34;:true}
(3 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/data-preparation/detect-outliers/#&#34;&gt;Detect outliers&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/data-preparation/iforest/#&#34;&gt;IFOREST&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-evaluation/read-tree/#&#34;&gt;READ_TREE&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: APPLY_INVERSE_PCA</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/apply-inverse-pca/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/apply-inverse-pca/</guid>
      <description>
        
        
        &lt;p&gt;Inverts the &lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/apply-pca/#&#34;&gt;APPLY_PCA&lt;/a&gt;-generated transform back to the original coordinate system.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;APPLY_INVERSE_PCA ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
            [, exclude_columns = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;excluded-columns&lt;/span&gt;&amp;#39;]
            [, key_columns = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;key-columns&lt;/span&gt;&amp;#39;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns. The following requirements apply:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;All columns must be a &lt;a href=&#34;../../../../../en/sql-reference/data-types/numeric-data-types/&#34;&gt;numeric&lt;/a&gt; data type.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enclose the column name in double quotes if it contains special characters.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;exclude_columns&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Comma-separated list of column names from &lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt; to exclude from processing.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;key_columns&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of column names from &lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt; that identify its data rows. These columns are included in the output table.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example shows how to use the APPLY_INVERSE_PCA function. It shows the output for the first record.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; SELECT PCA (&amp;#39;pcamodel&amp;#39;, &amp;#39;world&amp;#39;,&amp;#39;country,HDI,em1970,em1971,em1972,em1973,em1974,em1975,em1976,em1977,
em1978,em1979,em1980,em1981,em1982,em1983,em1984 ,em1985,em1986,em1987,em1988,em1989,em1990,em1991,em1992,
em1993,em1994,em1995,em1996,em1997,em1998,em1999,em2000,em2001,em2002,em2003,em2004,em2005,em2006,em2007,
em2008,em2009,em2010,gdp1970,gdp1971,gdp1972,gdp1973,gdp1974,gdp1975,gdp1976,gdp1977,gdp1978,gdp1979,gdp1980,
gdp1981,gdp1982,gdp1983,gdp1984,gdp1985,gdp1986,gdp1987,gdp1988,gdp1989,gdp1990,gdp1991,gdp1992,gdp1993,
gdp1994,gdp1995,gdp1996,gdp1997,gdp1998,gdp1999,gdp2000,gdp2001,gdp2002,gdp2003,gdp2004,gdp2005,gdp2006,
gdp2007,gdp2008,gdp2009,gdp2010&amp;#39; USING PARAMETERS exclude_columns=&amp;#39;HDI,country&amp;#39;);
PCA
---------------------------------------------------------------
Finished in 1 iterations.
Accepted Rows: 96  Rejected Rows: 0
(1 row)
=&amp;gt; CREATE TABLE worldPCA AS SELECT
APPLY_PCA (HDI,country,em1970,em1971,em1972,em1973,em1974,em1975,em1976,em1977,em1978,em1979,
em1980,em1981,em1982,em1983,em1984 ,em1985,em1986,em1987,em1988,em1989,em1990,em1991,em1992,em1993,em1994,
em1995,em1996,em1997,em1998,em1999,em2000,em2001,em2002,em2003,em2004,em2005,em2006,em2007,em2008,em2009,
em2010,gdp1970,gdp1971,gdp1972,gdp1973,gdp1974,gdp1975,gdp1976,gdp1977,gdp1978,gdp1979,gdp1980,gdp1981,gdp1982,
gdp1983,gdp1984,gdp1985,gdp1986,gdp1987,gdp1988,gdp1989,gdp1990,gdp1991,gdp1992,gdp1993,gdp1994,gdp1995,
gdp1996,gdp1997,gdp1998,gdp1999,gdp2000,gdp2001,gdp2002,gdp2003,gdp2004,gdp2005,gdp2006,gdp2007,gdp2008,
gdp2009,gdp2010 USING PARAMETERS model_name=&amp;#39;pcamodel&amp;#39;, exclude_columns=&amp;#39;HDI, country&amp;#39;, key_columns=&amp;#39;HDI,
country&amp;#39;,cutoff=.3)OVER () FROM world;
CREATE TABLE

=&amp;gt; SELECT * FROM worldPCA;
HDI   |       country       |       col1
------+---------------------+-------------------
0.886 | Belgium             |  79002.2946705704
0.699 | Belize              | -25631.6670012556
0.427 | Benin               | -40373.4104598122
0.805 | Chile               | -16805.7940082156
0.687 | China               | -37279.2893141103
0.744 | Costa Rica          | -19505.5631231635
0.4   | Cote d&amp;#39;Ivoire       | -38058.2060339272
0.776 | Cuba                | -23724.5779612041
0.895 | Denmark             |  117325.594028813
0.644 | Egypt               | -34609.9941604549
...
(96 rows)

=&amp;gt; SELECT APPLY_INVERSE_PCA (HDI, country, col1
    USING PARAMETERS model_name = &amp;#39;pcamodel&amp;#39;, exclude_columns=&amp;#39;HDI,country&amp;#39;,
    key_columns = &amp;#39;HDI, country&amp;#39;) OVER () FROM worldPCA;
HDI  |       country       |      em1970       |      em1971       |      em1972      |      em1973      |
      em1974      |      em1975       |      em1976|      em1977      |      em1978       |      em1979
   |      em1980       |      em1981      |      em1982       |      em1983       |      em1984       |em1985
|      em1986       |      em1987       |      em1988       |      em1989      |      em1990      |      em1991
|      em1992       |      em1993|      em1994      |      em1995       |      em1996       |      em1997
    |      em1998       |      em1999       |      em2000       |      em2001       |em2002       |
em2003      |      em2004       |      em2005      |      em2006       |      em2007       |      em2008
|      em2009      |      em2010       |     gdp1970      |     gdp1971      |     gdp1972      |     gdp1973
|     gdp1974      |     gdp1975      |     gdp1976      |     gdp1977      |gdp1978      |     gdp1979
 |     gdp1980      |     gdp1981      |     gdp1982      |     gdp1983      |     gdp1984      |     gdp1985
      |     gdp1986|    gdp1987      |     gdp1988      |     gdp1989      |     gdp1990      |     gdp1991
     |     gdp1992      |     gdp1993      |     gdp1994      |     gdp1995      |     gdp1996      |
gdp1997      |     gdp1998      |     gdp1999      |     gdp2000      |     gdp2001      |     gdp2002
|     gdp2003      |gdp2004      |     gdp2005      |     gdp2006      |     gdp2007      |     gdp2008
  |     gdp2009      |     gdp2010
-------+---------------------+-------------------+-------------------+------------------+------------------
+------------------+-------------------+------------------+------------------+-------------------+---------
----------+-------------------+------------------+-------------------+-------------------+-----------------
--+------------------+-------------------+-------------------+-------------------+------------------+-------
-----------+------------------+-------------------+-------------------+------------------+------------------
-+-------------------+------------------+-------------------+-------------------+-------------------+-------
------------+--------------------+------------------+-------------------+------------------+----------------
---+-------------------+-------------------+------------------+-------------------+------------------+------
------------+------------------+------------------+------------------+------------------+------------------+
------------------+------------------+------------------+------------------+------------------+-------------
-----+------------------+------------------+------------------+------------------+------------------+-------
-----------+------------------+------------------+------------------+------------------+------------------+-
-----------------+------------------+------------------+------------------+------------------+--------------
----+------------------+------------------+------------------+------------------+------------------+--------
----------+------------------+------------------+------------------+------------------+------------------
0.886 | Belgium             |  18585.6613572407 | -16145.6374560074 |  26938.956253415 | 8094.30475779595 |
 12073.5461203817 | -11069.0567600181 | 19133.8584911727|   5500.312894949 | -4227.94863799987 |  6265.77925410752
|  -10884.749295608 | 30929.4669575201 | -7831.49439429977 |  3235.81760508742 | -22765.9285442662 | 27200
.6767714485 | -10554.9550160917 |   1169.4144482273 | -16783.7961289161 | 27932.2660829329 | 17227.9083196848
| 13956.0524012749 | -40175.6286481088 | -10889.4785920499 | 22703.6576872859 | -14635.5832197402 |
2857.12270512168 | 20473.5044214494 | -52199.4895696423 | -11038.7346460738 |  18466.7298633088 | -17410.4225137703 |
-3475.63826305462 | 29305.6753822341 |   1242.5724942049 | 17491.0096310849 | -12609.9984515902 | -17909.3603476248
|  6276.58431412381 | 21851.9475485178 | -2614.33738160397 | 3777.74134131349 | 4522.08854282736 | 4251.90446379366
| 4512.15101396876 | 4265.49424538129 | 5190.06845330997 | 4543.80444817989 | 5639.81122679089 | 4420.44705213467
|  5658.8820279283 | 5172.69025294376 | 5019.63640408663 | 5938.84979495903 | 4976.57073629812 | 4710.49525137591
| 6523.65700286465 | 5067.82520773578 | 6789.13070219317 | 5525.94643553563 | 6894.68336419297 | 5961.58442474331
| 5661.21093840818 | 7721.56088518218 |  5959.7301109143 | 6453.43604137202 | 6739.39384033096 | 7517.97645468455
| 6907.49136910647 | 7049.03921764209 | 7726.49091035527 | 8552.65909911844 | 7963.94487647115 | 7187.45827585515
| 7994.02955410523 | 9532.89844418041 | 7962.25713582666 | 7846.68238907624 | 10230.9878908643 | 8642.76044946519
| 8886.79860331866 |  8718.3731386891
...
(96 rows)
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/apply-pca/#&#34;&gt;APPLY_PCA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/data-preparation/pca/#&#34;&gt;PCA&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: APPLY_INVERSE_SVD</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/apply-inverse-svd/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/apply-inverse-svd/</guid>
      <description>
        
        
        &lt;p&gt;Transforms the data back to the original domain. This essentially computes the approximated version of the original data by multiplying three matrices: matrix U (input to this function), matrices S and V (stored in the model).&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;APPLY_INVERSE_SVD ( &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;&amp;#39;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
            [, exclude_columns = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;excluded-columns&lt;/span&gt;&amp;#39;]
            [, key_columns = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;key-columns&lt;/span&gt;&amp;#39;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns. The following requirements apply:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;All columns must be a &lt;a href=&#34;../../../../../en/sql-reference/data-types/numeric-data-types/&#34;&gt;numeric&lt;/a&gt; data type.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enclose the column name in double quotes if it contains special characters.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;exclude_columns&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Comma-separated list of column names from &lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt; to exclude from processing.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;key_columns&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of column names from &lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt; that identify its data rows. These columns are included in the output table.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT SVD (&amp;#39;svdmodel&amp;#39;, &amp;#39;small_svd&amp;#39;, &amp;#39;x1,x2,x3,x4&amp;#39;);
SVD
--------------------------------------------------------------
Finished in 1 iterations.
Accepted Rows: 8  Rejected Rows: 0
(1 row)

=&amp;gt; CREATE TABLE transform_svd AS SELECT
     APPLY_SVD (id, x1, x2, x3, x4 USING PARAMETERS model_name=&amp;#39;svdmodel&amp;#39;, exclude_columns=&amp;#39;id&amp;#39;, key_columns=&amp;#39;id&amp;#39;)
     OVER () FROM small_svd;
CREATE TABLE

=&amp;gt; SELECT * FROM transform_svd;
id  |       col1        |        col2         |        col3         |        col4
----+-------------------+---------------------+---------------------+--------------------
4   |  0.44849499240202 |  -0.347260956311326 |   0.186958376368345 |  0.378561270493651
6   |  0.17652411036246 | -0.0753183783382909 |  -0.678196192333598 | 0.0567124770173372
1   | 0.494871802886819 |   0.161721379259287 |  0.0712816417153664 | -0.473145877877408
2   |  0.17652411036246 | -0.0753183783382909 |  -0.678196192333598 | 0.0567124770173372
3   | 0.150974762654569 |   0.589561842046029 | 0.00392654610109522 |  0.360011163271921
5   | 0.494871802886819 |   0.161721379259287 |  0.0712816417153664 | -0.473145877877408
8   |  0.44849499240202 |  -0.347260956311326 |   0.186958376368345 |  0.378561270493651
7   | 0.150974762654569 |   0.589561842046029 | 0.00392654610109522 |  0.360011163271921
(8 rows)

=&amp;gt; SELECT APPLY_INVERSE_SVD (* USING PARAMETERS model_name=&amp;#39;svdmodel&amp;#39;, exclude_columns=&amp;#39;id&amp;#39;,
key_columns=&amp;#39;id&amp;#39;) OVER () FROM transform_svd;
id  |        x1        |        x2        |        x3        |        x4
----+------------------+------------------+------------------+------------------
4 | 91.4056627665577 | 44.7629617207482 | 83.1704961993117 | 38.9274292265543
6 | 20.6468626294368 | 9.30974906868751 | 8.71006863405534 |  6.5855928603967
7 | 31.2494347777156 | 20.6336519003026 | 27.5668287751507 | 5.84427645886865
1 |  107.93376580719 | 51.6980548011917 | 97.9665796560552 | 40.4918236881051
2 | 20.6468626294368 | 9.30974906868751 | 8.71006863405534 |  6.5855928603967
3 | 31.2494347777156 | 20.6336519003026 | 27.5668287751507 | 5.84427645886865
5 |  107.93376580719 | 51.6980548011917 | 97.9665796560552 | 40.4918236881051
8 | 91.4056627665577 | 44.7629617207482 | 83.1704961993117 | 38.9274292265543
(8 rows)
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/apply-svd/#&#34;&gt;APPLY_SVD&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/data-preparation/svd/#&#34;&gt;SVD&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: APPLY_KMEANS</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/apply-kmeans/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/apply-kmeans/</guid>
      <description>
        
        
        &lt;p&gt;Assigns each row of an input relation to a cluster center from an existing k-means model.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;APPLY_KMEANS ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
       USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39; [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;privileges&#34;&gt;Privileges&lt;/h2&gt;
&lt;p&gt;Non-superusers: model owner, or USAGE privileges on the model&lt;/p&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example creates k-means model &lt;code&gt;myKmeansModel&lt;/code&gt; and applies it to input table &lt;code&gt;iris1&lt;/code&gt;. The call to &lt;code&gt;APPLY_KMEANS&lt;/code&gt; mixes column names and constants. When a constant is passed in place of a column name, the constant is substituted for the value of the column in all rows:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT KMEANS(&amp;#39;myKmeansModel&amp;#39;, &amp;#39;iris1&amp;#39;, &amp;#39;*&amp;#39;, 5
USING PARAMETERS max_iterations=20, output_view=&amp;#39;myKmeansView&amp;#39;, key_columns=&amp;#39;id&amp;#39;, exclude_columns=&amp;#39;Species, id&amp;#39;);
           KMEANS
----------------------------
 Finished in 12 iterations

(1 row)
=&amp;gt; SELECT id, APPLY_KMEANS(Sepal_Length, 2.2, 1.3, Petal_Width
USING PARAMETERS model_name=&amp;#39;myKmeansModel&amp;#39;, match_by_pos=&amp;#39;true&amp;#39;) FROM iris2;
 id  | APPLY_KMEANS
-----+--------------
   5 |            1
  10 |            1
  14 |            1
  15 |            1
  21 |            1
  22 |            1
  24 |            1
  25 |            1
  32 |            1
  33 |            1
  34 |            1
  35 |            1
  38 |            1
  39 |            1
  42 |            1
...
 (60 rows)
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/clustering-algorithms/k-means/clustering-data-using-k-means/#&#34;&gt;Clustering data using k-means&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/kmeans/#&#34;&gt;KMEANS&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: APPLY_KPROTOTYPES</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/apply-kprototypes/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/apply-kprototypes/</guid>
      <description>
        
        
        &lt;p&gt;Assigns each row of an input relation to a cluster center from an existing k-prototypes model.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;APPLY_KPROTOTYPES ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
       USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39; [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;privileges&#34;&gt;Privileges&lt;/h2&gt;
&lt;p&gt;Non-superusers: model owner, or USAGE privileges on the model&lt;/p&gt;

&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example creates k-prototypes model &lt;code&gt;small_model&lt;/code&gt; and applies it to input table &lt;code&gt;small_test_mixed&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT KPROTOTYPES(&amp;#39;small_model_initcenters&amp;#39;, &amp;#39;small_test_mixed&amp;#39;, &amp;#39;x0, country&amp;#39;, 3 USING PARAMETERS initial_centers_table=&amp;#39;small_test_mixed_centers&amp;#39;, key_columns=&amp;#39;pid&amp;#39;);
      KPROTOTYPES
---------------------------
Finished in 2 iterations

(1 row)

=&amp;gt; SELECT country, x0, APPLY_KPROTOTYPES(country, x0
USING PARAMETERS model_name=&amp;#39;small_model&amp;#39;)
FROM small_test_mixed;
  country   | x0  | apply_kprototypes
------------+-----+-------------------
 &amp;#39;China&amp;#39;    |  20 |                 0
 &amp;#39;US&amp;#39;       |  85 |                 2
 &amp;#39;Russia&amp;#39;   |  80 |                 1
 &amp;#39;Brazil&amp;#39;   |  78 |                 1
 &amp;#39;US&amp;#39;       |  23 |                 0
 &amp;#39;US&amp;#39;       |  50 |                 0
 &amp;#39;Canada&amp;#39;   |  24 |                 0
 &amp;#39;Canada&amp;#39;   |  18 |                 0
 &amp;#39;Russia&amp;#39;   |  90 |                 2
 &amp;#39;Russia&amp;#39;   |  98 |                 2
 &amp;#39;Brazil&amp;#39;   |  89 |                 2
...
(45 rows)
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/kprototypes/&#34;&gt;KPROTOTYPES&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/clustering-algorithms/k-means/clustering-data-using-k-means/#&#34;&gt;Clustering data using k-means&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/kmeans/#&#34;&gt;KMEANS&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: APPLY_NORMALIZE</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/apply-normalize/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/apply-normalize/</guid>
      <description>
        
        
        &lt;p&gt;A UDTF function that applies the normalization parameters saved in a model to a set of specified input columns. If any column specified in the function is not in the model, its data passes through unchanged to &lt;code&gt;APPLY_NORMALIZE&lt;/code&gt;.

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

&lt;strong&gt;Note&lt;/strong&gt;: If a column contains only one distinct value, &lt;code&gt;APPLY_NORMALIZE&lt;/code&gt; returns NaN for values in that column.

&lt;/div&gt;&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;APPLY_NORMALIZE ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt; USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;);
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns. If you supply an asterisk, &lt;code&gt;APPLY_NORMALIZE&lt;/code&gt; normalizes all columns in the model.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example creates a model with &lt;code&gt;NORMALIZE_FIT&lt;/code&gt; using the &lt;code&gt;wt&lt;/code&gt; and &lt;code&gt;hp&lt;/code&gt; columns in table &lt;code&gt;mtcars&lt;/code&gt; , and then uses this model in successive calls to &lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/apply-normalize/#&#34;&gt;APPLY_NORMALIZE&lt;/a&gt; and &lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/reverse-normalize/#&#34;&gt;REVERSE_NORMALIZE&lt;/a&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT NORMALIZE_FIT(&amp;#39;mtcars_normfit&amp;#39;, &amp;#39;mtcars&amp;#39;, &amp;#39;wt,hp&amp;#39;, &amp;#39;minmax&amp;#39;);
NORMALIZE_FIT
---------------
Success
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The following call to &lt;code&gt;APPLY_NORMALIZE&lt;/code&gt; specifies the &lt;code&gt;hp&lt;/code&gt; and &lt;code&gt;cyl&lt;/code&gt; columns in table &lt;code&gt;mtcars&lt;/code&gt;, where &lt;code&gt;hp&lt;/code&gt; is in the normalization model and &lt;code&gt;cyl&lt;/code&gt; is not in the normalization model:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE TABLE mtcars_normalized AS SELECT APPLY_NORMALIZE (hp, cyl USING PARAMETERS model_name = &amp;#39;mtcars_normfit&amp;#39;) FROM mtcars;
CREATE TABLE
=&amp;gt; SELECT * FROM mtcars_normalized;
          hp        | cyl
--------------------+-----
  0.434628975265018 | 8
  0.681978798586572 | 8
  0.434628975265018 | 6
                  1 | 8
  0.540636042402827 | 8
                  0 | 4
  0.681978798586572 | 8
 0.0459363957597173 | 4
  0.434628975265018 | 8
  0.204946996466431 | 6
  0.250883392226148 | 6
  0.049469964664311 | 4
  0.204946996466431 | 6
  0.201413427561837 | 4
  0.204946996466431 | 6
  0.250883392226148 | 6
  0.049469964664311 | 4
  0.215547703180212 | 4
 0.0353356890459364 | 4
  0.187279151943463 | 6
  0.452296819787986 | 8
  0.628975265017668 | 8
  0.346289752650177 | 8
  0.137809187279152 | 4
  0.749116607773852 | 8
  0.144876325088339 | 4
  0.151943462897526 | 4
  0.452296819787986 | 8
  0.452296819787986 | 8
  0.575971731448763 | 8
  0.159010600706714 | 4
  0.346289752650177 | 8
(32 rows)

=&amp;gt; SELECT REVERSE_NORMALIZE (hp, cyl USING PARAMETERS model_name=&amp;#39;mtcars_normfit&amp;#39;) FROM mtcars_normalized;
  hp | cyl
-----+-----
 175 | 8
 245 | 8
 175 | 6
 335 | 8
 205 | 8
  52 | 4
 245 | 8
  65 | 4
 175 | 8
 110 | 6
 123 | 6
  66 | 4
 110 | 6
 109 | 4
 110 | 6
 123 | 6
  66 | 4
 113 | 4
  62 | 4
 105 | 6
 180 | 8
 230 | 8
 150 | 8
  91 | 4
 264 | 8
  93 | 4
  95 | 4
 180 | 8
 180 | 8
 215 | 8
  97 | 4
 150 | 8
(32 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The following call to &lt;code&gt;REVERSE_NORMALIZE&lt;/code&gt; also specifies the &lt;code&gt;hp&lt;/code&gt; and &lt;code&gt;cyl&lt;/code&gt; columns in table &lt;code&gt;mtcars&lt;/code&gt;, where &lt;code&gt;hp&lt;/code&gt; is in normalization model &lt;code&gt;mtcars_normfit&lt;/code&gt;, and &lt;code&gt;cyl&lt;/code&gt; is not in the normalization model.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT REVERSE_NORMALIZE (hp, cyl USING PARAMETERS model_name=&amp;#39;mtcars_normfit&amp;#39;) FROM mtcars_normalized;
       hp        | cyl
-----------------+-----
205.000005722046 |   8
150.000000357628 |   8
150.000000357628 |   8
93.0000016987324 |   4
 174.99999666214 |   8
94.9999992102385 |   4
214.999997496605 |   8
97.0000009387732 |   4
245.000006556511 |   8
 174.99999666214 |   6
             335 |   8
245.000006556511 |   8
62.0000002086163 |   4
 174.99999666214 |   8
230.000002026558 |   8
              52 |   4
263.999997675419 |   8
109.999999523163 |   6
123.000002324581 |   6
64.9999996386468 |   4
66.0000005029142 |   4
112.999997898936 |   4
109.999999523163 |   6
180.000000983477 |   8
180.000000983477 |   8
108.999998658895 |   4
109.999999523163 |   6
104.999999418855 |   6
123.000002324581 |   6
180.000000983477 |   8
66.0000005029142 |   4
90.9999999701977 |   4
(32 rows)
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/data-preparation/normalize/#&#34;&gt;NORMALIZE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/data-preparation/normalize-fit/#&#34;&gt;NORMALIZE_FIT&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/data-preparation/normalizing-data/#&#34;&gt;Normalizing data&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/reverse-normalize/#&#34;&gt;REVERSE_NORMALIZE&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: APPLY_ONE_HOT_ENCODER</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/apply-one-hot-encoder/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/apply-one-hot-encoder/</guid>
      <description>
        
        
        &lt;p&gt;A user-defined transform function (UDTF) that loads the one hot encoder model and writes out a table that contains the encoded columns.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;APPLY_ONE_HOT_ENCODER( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
            [, drop_first = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;is-first&lt;/span&gt;&amp;#39;]
            [, ignore_null = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;ignore&lt;/span&gt;&amp;#39;]
            [, separator = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;separator-character&lt;/span&gt;&amp;#39;]
            [, column_naming = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;name-output&lt;/span&gt;&amp;#39;]
            [, null_column_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;null-column-name&lt;/span&gt;&amp;#39;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;

, stores the categories and their corresponding levels.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;drop_first&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Boolean value, one of the following:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt; (default): Treat the first level of the categorical variable as the reference level.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt;: Every level of the categorical variable has a corresponding column in the output view&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;ignore_null&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Boolean value, one of the following:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt; (default): Null values set all corresponding one-hot binary columns to null.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt;: Null values in &lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt; are treated as a categorical level&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;separator&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;The character that separates the input variable name and the indicator variable level in the output table.To avoid using any separator, set this parameter to null value.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; Underscore (&lt;code&gt;_&lt;/code&gt;)&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;column_naming&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Appends categorical levels to column names according to the specified method:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;indices&lt;/code&gt; (default): Uses integer indices to represent categorical levels.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;values&lt;/code&gt;/&lt;code&gt;values_relaxed&lt;/code&gt;: Both methods use categorical level names. If duplicate column names occur, the function attempts to disambiguate them by appending &lt;code&gt;_&lt;/code&gt;&lt;em&gt;&lt;code&gt;n&lt;/code&gt;&lt;/em&gt;, where &lt;em&gt;&lt;code&gt;n&lt;/code&gt;&lt;/em&gt; is a zero-based integer index (&lt;code&gt;_0&lt;/code&gt;, &lt;code&gt;_1&lt;/code&gt;,...).&lt;/p&gt;
&lt;p&gt;If the function cannot produce unique column names , it handles this according to the chosen method:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;values&lt;/code&gt; returns an error.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;values_relaxed&lt;/code&gt; reverts to using indices.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&#34;admonition important&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Important&lt;/h4&gt;
&lt;p&gt;The following column naming rules apply if &lt;code&gt;column_naming&lt;/code&gt; is set to &lt;code&gt;values&lt;/code&gt; or &lt;code&gt;values_relaxed&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Input column names with more than 128 characters are truncated.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Column names can contain special characters.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If parameter &lt;code&gt;ignore_null&lt;/code&gt; is set to true, &lt;code&gt;APPLY_ONE_HOT_ENCODER&lt;/code&gt; constructs the column name from the value set in parameter &lt;code&gt;null_column_name&lt;/code&gt;. If this parameter is omitted, the string &lt;code&gt;null&lt;/code&gt; is used.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;null_column_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;The string used in naming the indicator column for null values, used only if &lt;code&gt;ignore_null&lt;/code&gt; is set to &lt;code&gt;false&lt;/code&gt; and &lt;code&gt;column_naming&lt;/code&gt; is set to &lt;code&gt;values&lt;/code&gt; or &lt;code&gt;values_relaxed&lt;/code&gt;.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt;&lt;code&gt;null&lt;/code&gt;&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

&lt;strong&gt;Note&lt;/strong&gt;: If an input row contains a level not stored in the model, the output row columns corresponding to that categorical level are returned as null values.

&lt;/div&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT APPLY_ONE_HOT_ENCODER(cyl USING PARAMETERS model_name=&amp;#39;one_hot_encoder_model&amp;#39;,
drop_first=&amp;#39;true&amp;#39;, ignore_null=&amp;#39;false&amp;#39;) FROM mtcars;
cyl | cyl_1 | cyl_2
----+-------+-------
8   |     0 |     1
4   |     0 |     0
4   |     0 |     0
8   |     0 |     1
8   |     0 |     1
8   |     0 |     1
4   |     0 |     0
8   |     0 |     1
8   |     0 |     1
4   |     0 |     0
8   |     0 |     1
6   |     1 |     0
4   |     0 |     0
4   |     0 |     0
6   |     1 |     0
6   |     1 |     0
8   |     0 |     1
8   |     0 |     1
4   |     0 |     0
4   |     0 |     0
6   |     1 |     0
8   |     0 |     1
8   |     0 |     1
6   |     1 |     0
4   |     0 |     0
8   |     0 |     1
8   |     0 |     1
8   |     0 |     1
6   |     1 |     0
6   |     1 |     0
4   |     0 |     0
4   |     0 |     0
(32 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/data-preparation/encoding-categorical-columns/#&#34;&gt;Encoding categorical columns&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/data-preparation/one-hot-encoder-fit/#&#34;&gt;ONE_HOT_ENCODER_FIT&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: APPLY_PCA</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/apply-pca/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/apply-pca/</guid>
      <description>
        
        
        &lt;p&gt;Transforms the data using a PCA model. This returns new coordinates of each data point.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;APPLY_PCA ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
            [, num_components = &lt;span class=&#34;code-variable&#34;&gt;num-components&lt;/span&gt;]
            [, cutoff = &lt;span class=&#34;code-variable&#34;&gt;cutoff-value&lt;/span&gt;]
            [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;]
            [, exclude_columns = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;excluded-columns&lt;/span&gt;&amp;#39;]
            [, key_columns = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;key-columns&lt;/span&gt;&amp;#39;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns that contain the data matrix, or asterisk (*) to select all columns. The following requirements apply:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;All columns must be a &lt;a href=&#34;../../../../../en/sql-reference/data-types/numeric-data-types/&#34;&gt;numeric&lt;/a&gt; data type.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enclose the column name in double quotes if it contains special characters.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;num_components&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;The number of components to keep in the model. This is the number of output columns that will be generated. If you omit this parameter and the &lt;code&gt;cutoff&lt;/code&gt; parameter, all model components are kept.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;cutoff&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Set to 1, specifies the minimum accumulated explained variance. Components are taken until the accumulated explained variance reaches this value.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;exclude_columns&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Comma-separated list of column names from &lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt; to exclude from processing.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;key_columns&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of column names from &lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt; that identify its data rows. These columns are included in the output table.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; SELECT PCA (&amp;#39;pcamodel&amp;#39;, &amp;#39;world&amp;#39;,&amp;#39;country,HDI,em1970,em1971,em1972,em1973,em1974,em1975,em1976,em1977,
em1978,em1979,em1980,em1981,em1982,em1983,em1984 ,em1985,em1986,em1987,em1988,em1989,em1990,em1991,em1992,
em1993,em1994,em1995,em1996,em1997,em1998,em1999,em2000,em2001,em2002,em2003,em2004,em2005,em2006,em2007,
em2008,em2009,em2010,gdp1970,gdp1971,gdp1972,gdp1973,gdp1974,gdp1975,gdp1976,gdp1977,gdp1978,gdp1979,gdp1980,
gdp1981,gdp1982,gdp1983,gdp1984,gdp1985,gdp1986,gdp1987,gdp1988,gdp1989,gdp1990,gdp1991,gdp1992,gdp1993,
gdp1994,gdp1995,gdp1996,gdp1997,gdp1998,gdp1999,gdp2000,gdp2001,gdp2002,gdp2003,gdp2004,gdp2005,gdp2006,
gdp2007,gdp2008,gdp2009,gdp2010&amp;#39; USING PARAMETERS exclude_columns=&amp;#39;HDI,country&amp;#39;);
PCA
---------------------------------------------------------------
Finished in 1 iterations.
Accepted Rows: 96  Rejected Rows: 0
(1 row)
=&amp;gt; CREATE TABLE worldPCA AS SELECT
APPLY_PCA (HDI,country,em1970,em1971,em1972,em1973,em1974,em1975,em1976,em1977,em1978,em1979,
em1980,em1981,em1982,em1983,em1984 ,em1985,em1986,em1987,em1988,em1989,em1990,em1991,em1992,em1993,em1994,
em1995,em1996,em1997,em1998,em1999,em2000,em2001,em2002,em2003,em2004,em2005,em2006,em2007,em2008,em2009,
em2010,gdp1970,gdp1971,gdp1972,gdp1973,gdp1974,gdp1975,gdp1976,gdp1977,gdp1978,gdp1979,gdp1980,gdp1981,gdp1982,
gdp1983,gdp1984,gdp1985,gdp1986,gdp1987,gdp1988,gdp1989,gdp1990,gdp1991,gdp1992,gdp1993,gdp1994,gdp1995,
gdp1996,gdp1997,gdp1998,gdp1999,gdp2000,gdp2001,gdp2002,gdp2003,gdp2004,gdp2005,gdp2006,gdp2007,gdp2008,
gdp2009,gdp2010 USING PARAMETERS model_name=&amp;#39;pcamodel&amp;#39;, exclude_columns=&amp;#39;HDI, country&amp;#39;, key_columns=&amp;#39;HDI,
country&amp;#39;,cutoff=.3)OVER () FROM world;
CREATE TABLE

=&amp;gt; SELECT * FROM worldPCA;
HDI   |       country       |       col1
------+---------------------+-------------------
0.886 | Belgium             |  79002.2946705704
0.699 | Belize              | -25631.6670012556
0.427 | Benin               | -40373.4104598122
0.805 | Chile               | -16805.7940082156
0.687 | China               | -37279.2893141103
0.744 | Costa Rica          | -19505.5631231635
0.4   | Cote d&amp;#39;Ivoire       | -38058.2060339272
0.776 | Cuba                | -23724.5779612041
0.895 | Denmark             |  117325.594028813
0.644 | Egypt               | -34609.9941604549
...
(96 rows)

=&amp;gt; SELECT APPLY_INVERSE_PCA (HDI, country, col1
    USING PARAMETERS model_name = &amp;#39;pcamodel&amp;#39;, exclude_columns=&amp;#39;HDI,country&amp;#39;,
    key_columns = &amp;#39;HDI, country&amp;#39;) OVER () FROM worldPCA;
HDI  |       country       |      em1970       |      em1971       |      em1972      |      em1973      |
      em1974      |      em1975       |      em1976|      em1977      |      em1978       |      em1979
   |      em1980       |      em1981      |      em1982       |      em1983       |      em1984       |em1985
|      em1986       |      em1987       |      em1988       |      em1989      |      em1990      |      em1991
|      em1992       |      em1993|      em1994      |      em1995       |      em1996       |      em1997
    |      em1998       |      em1999       |      em2000       |      em2001       |em2002       |
em2003      |      em2004       |      em2005      |      em2006       |      em2007       |      em2008
|      em2009      |      em2010       |     gdp1970      |     gdp1971      |     gdp1972      |     gdp1973
|     gdp1974      |     gdp1975      |     gdp1976      |     gdp1977      |gdp1978      |     gdp1979
 |     gdp1980      |     gdp1981      |     gdp1982      |     gdp1983      |     gdp1984      |     gdp1985
      |     gdp1986|    gdp1987      |     gdp1988      |     gdp1989      |     gdp1990      |     gdp1991
     |     gdp1992      |     gdp1993      |     gdp1994      |     gdp1995      |     gdp1996      |
gdp1997      |     gdp1998      |     gdp1999      |     gdp2000      |     gdp2001      |     gdp2002
|     gdp2003      |gdp2004      |     gdp2005      |     gdp2006      |     gdp2007      |     gdp2008
  |     gdp2009      |     gdp2010
-------+---------------------+-------------------+-------------------+------------------+------------------
+------------------+-------------------+------------------+------------------+-------------------+---------
----------+-------------------+------------------+-------------------+-------------------+-----------------
--+------------------+-------------------+-------------------+-------------------+------------------+-------
-----------+------------------+-------------------+-------------------+------------------+------------------
-+-------------------+------------------+-------------------+-------------------+-------------------+-------
------------+--------------------+------------------+-------------------+------------------+----------------
---+-------------------+-------------------+------------------+-------------------+------------------+------
------------+------------------+------------------+------------------+------------------+------------------+
------------------+------------------+------------------+------------------+------------------+-------------
-----+------------------+------------------+------------------+------------------+------------------+-------
-----------+------------------+------------------+------------------+------------------+------------------+-
-----------------+------------------+------------------+------------------+------------------+--------------
----+------------------+------------------+------------------+------------------+------------------+--------
----------+------------------+------------------+------------------+------------------+------------------
0.886 | Belgium             |  18585.6613572407 | -16145.6374560074 |  26938.956253415 | 8094.30475779595 |
 12073.5461203817 | -11069.0567600181 | 19133.8584911727|   5500.312894949 | -4227.94863799987 |  6265.77925410752
|  -10884.749295608 | 30929.4669575201 | -7831.49439429977 |  3235.81760508742 | -22765.9285442662 | 27200
.6767714485 | -10554.9550160917 |   1169.4144482273 | -16783.7961289161 | 27932.2660829329 | 17227.9083196848
| 13956.0524012749 | -40175.6286481088 | -10889.4785920499 | 22703.6576872859 | -14635.5832197402 |
2857.12270512168 | 20473.5044214494 | -52199.4895696423 | -11038.7346460738 |  18466.7298633088 | -17410.4225137703 |
-3475.63826305462 | 29305.6753822341 |   1242.5724942049 | 17491.0096310849 | -12609.9984515902 | -17909.3603476248
|  6276.58431412381 | 21851.9475485178 | -2614.33738160397 | 3777.74134131349 | 4522.08854282736 | 4251.90446379366
| 4512.15101396876 | 4265.49424538129 | 5190.06845330997 | 4543.80444817989 | 5639.81122679089 | 4420.44705213467
|  5658.8820279283 | 5172.69025294376 | 5019.63640408663 | 5938.84979495903 | 4976.57073629812 | 4710.49525137591
| 6523.65700286465 | 5067.82520773578 | 6789.13070219317 | 5525.94643553563 | 6894.68336419297 | 5961.58442474331
| 5661.21093840818 | 7721.56088518218 |  5959.7301109143 | 6453.43604137202 | 6739.39384033096 | 7517.97645468455
| 6907.49136910647 | 7049.03921764209 | 7726.49091035527 | 8552.65909911844 | 7963.94487647115 | 7187.45827585515
| 7994.02955410523 | 9532.89844418041 | 7962.25713582666 | 7846.68238907624 | 10230.9878908643 | 8642.76044946519
| 8886.79860331866 |  8718.3731386891
...
(96 rows)
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/apply-inverse-pca/#&#34;&gt;APPLY_INVERSE_PCA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/data-preparation/pca/#&#34;&gt;PCA&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: APPLY_SVD</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/apply-svd/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/apply-svd/</guid>
      <description>
        
        
        &lt;p&gt;Transforms the data using an SVD model. This computes the matrix U of the SVD decomposition.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;APPLY_SVD ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
            [, num_components = &lt;span class=&#34;code-variable&#34;&gt;num-components&lt;/span&gt;]
            [, cutoff = &lt;span class=&#34;code-variable&#34;&gt;cutoff-value&lt;/span&gt;]
            [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;]
            [, exclude_columns = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;excluded-columns&lt;/span&gt;&amp;#39;]
            [, key_columns = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;key-columns&lt;/span&gt;&amp;#39;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns that contain the data matrix, or asterisk (*) to select all columns. The following requirements apply:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;All columns must be a &lt;a href=&#34;../../../../../en/sql-reference/data-types/numeric-data-types/&#34;&gt;numeric&lt;/a&gt; data type.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enclose the column name in double quotes if it contains special characters.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;num_components&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;The number of components to keep in the model. This is the number of output columns that will be generated. If neither this parameter nor the &lt;code&gt;cutoff&lt;/code&gt; parameter is provided, all components from the model are kept.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;cutoff&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Set to 1, specifies the minimum accumulated explained variance. Components are taken until the accumulated explained variance reaches this value. If you omit this parameter and the &lt;code&gt;num_components&lt;/code&gt; parameter, all model components are kept.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Boolean value that specifies how input columns are matched to model columns:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;exclude_columns&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Comma-separated list of column names from &lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt; to exclude from processing.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;key_columns&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of column names from &lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt; that identify its data rows. These columns are included in the output table.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT SVD (&amp;#39;svdmodel&amp;#39;, &amp;#39;small_svd&amp;#39;, &amp;#39;x1,x2,x3,x4&amp;#39;);
SVD
--------------------------------------------------------------
Finished in 1 iterations.
Accepted Rows: 8  Rejected Rows: 0
(1 row)

=&amp;gt; CREATE TABLE transform_svd AS SELECT
     APPLY_SVD (id, x1, x2, x3, x4 USING PARAMETERS model_name=&amp;#39;svdmodel&amp;#39;, exclude_columns=&amp;#39;id&amp;#39;, key_columns=&amp;#39;id&amp;#39;)
     OVER () FROM small_svd;
CREATE TABLE

=&amp;gt; SELECT * FROM transform_svd;
id  |       col1        |        col2         |        col3         |        col4
----+-------------------+---------------------+---------------------+--------------------
4   |  0.44849499240202 |  -0.347260956311326 |   0.186958376368345 |  0.378561270493651
6   |  0.17652411036246 | -0.0753183783382909 |  -0.678196192333598 | 0.0567124770173372
1   | 0.494871802886819 |   0.161721379259287 |  0.0712816417153664 | -0.473145877877408
2   |  0.17652411036246 | -0.0753183783382909 |  -0.678196192333598 | 0.0567124770173372
3   | 0.150974762654569 |   0.589561842046029 | 0.00392654610109522 |  0.360011163271921
5   | 0.494871802886819 |   0.161721379259287 |  0.0712816417153664 | -0.473145877877408
8   |  0.44849499240202 |  -0.347260956311326 |   0.186958376368345 |  0.378561270493651
7   | 0.150974762654569 |   0.589561842046029 | 0.00392654610109522 |  0.360011163271921
(8 rows)

=&amp;gt; SELECT APPLY_INVERSE_SVD (* USING PARAMETERS model_name=&amp;#39;svdmodel&amp;#39;, exclude_columns=&amp;#39;id&amp;#39;,
key_columns=&amp;#39;id&amp;#39;) OVER () FROM transform_svd;
id  |        x1        |        x2        |        x3        |        x4
----+------------------+------------------+------------------+------------------
4 | 91.4056627665577 | 44.7629617207482 | 83.1704961993117 | 38.9274292265543
6 | 20.6468626294368 | 9.30974906868751 | 8.71006863405534 |  6.5855928603967
7 | 31.2494347777156 | 20.6336519003026 | 27.5668287751507 | 5.84427645886865
1 |  107.93376580719 | 51.6980548011917 | 97.9665796560552 | 40.4918236881051
2 | 20.6468626294368 | 9.30974906868751 | 8.71006863405534 |  6.5855928603967
3 | 31.2494347777156 | 20.6336519003026 | 27.5668287751507 | 5.84427645886865
5 |  107.93376580719 | 51.6980548011917 | 97.9665796560552 | 40.4918236881051
8 | 91.4056627665577 | 44.7629617207482 | 83.1704961993117 | 38.9274292265543
(8 rows)
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/apply-inverse-svd/#&#34;&gt;APPLY_INVERSE_SVD&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/data-preparation/svd/#&#34;&gt;SVD&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_ARIMA</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-arima/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-arima/</guid>
      <description>
        
        
        &lt;p&gt;Applies an autoregressive integrated moving average (&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/arima/#&#34;&gt;ARIMA&lt;/a&gt;) model to an input relation or makes predictions using the in-sample data. ARIMA models make predictions based on preceding time series values and errors of previous predictions. The function, by default, returns the predicted values plus the mean of the model.&lt;/p&gt;
&lt;h2 id=&#34;behavior-type&#34;&gt;Behavior type&lt;/h2&gt;
&lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/immutable-invariant-functions/&#34; title=&#34;&#34;&gt;Immutable&lt;/a&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;p&gt;Apply to an input relation:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_ARIMA ( &lt;span class=&#34;code-variable&#34;&gt;timeseries-column&lt;/span&gt;
        USING PARAMETERS &lt;span class=&#34;code-variable&#34;&gt;param&lt;/span&gt;=&lt;span class=&#34;code-variable&#34;&gt;value&lt;/span&gt;[,...] )
        OVER (ORDER BY &lt;span class=&#34;code-variable&#34;&gt;timestamp-column&lt;/span&gt;)
        FROM &lt;span class=&#34;code-variable&#34;&gt;input-relation&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Make predictions using the in-sample data:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_ARIMA ( USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;ARIMA-model&lt;/span&gt;&amp;#39;
        [, start = &lt;span class=&#34;code-variable&#34;&gt;prediction-start&lt;/span&gt; ]
        [, npredictions = &lt;span class=&#34;code-variable&#34;&gt;num-predictions&lt;/span&gt; ]
        [, output_standard_errors = &lt;span class=&#34;code-variable&#34;&gt;boolean&lt;/span&gt; ] )
        OVER ()
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;timeseries-column&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Name of a NUMERIC column in &lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt; used to make predictions.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;timestamp-column&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Name of an INTEGER, FLOAT, or TIMESTAMP column in &lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt; that represents the timestamp variable. The timestep between consecutive entries should be consistent throughout the &lt;em&gt;&lt;code&gt;timestamp-column&lt;/code&gt;&lt;/em&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Input relation containing &lt;em&gt;&lt;code&gt;timeseries-column&lt;/code&gt;&lt;/em&gt; and &lt;em&gt;&lt;code&gt;timestamp-column&lt;/code&gt;&lt;/em&gt;.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Name of a trained ARIMA model.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;start&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;The behavior of the &lt;code&gt;start&lt;/code&gt; parameter and its range of accepted values depends on whether you provide a &lt;em&gt;&lt;code&gt;timeseries-column&lt;/code&gt;&lt;/em&gt;:
&lt;ul&gt;
&lt;li&gt;No provided &lt;em&gt;&lt;code&gt;timeseries-column&lt;/code&gt;&lt;/em&gt;: &lt;code&gt;start&lt;/code&gt; must be an integer ≥0, where zero indicates to start prediction at the end of the in-sample data. If &lt;code&gt;start&lt;/code&gt; is a positive value, the function predicts the values between the end of the in-sample data and the &lt;code&gt;start&lt;/code&gt; index, and then uses the predicted values as time series inputs for the subsequent &lt;code&gt;npredictions&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;timeseries-column&lt;/code&gt;&lt;/em&gt; provided: &lt;code&gt;start&lt;/code&gt; must be an integer ≥1 and identifies the index (row) of the &lt;em&gt;&lt;code&gt;timeseries-column&lt;/code&gt;&lt;/em&gt; at which to begin prediction. If the &lt;code&gt;start&lt;/code&gt; index is greater than the number of rows, &lt;code&gt;N&lt;/code&gt;, in the input data, the function predicts the values between &lt;code&gt;N&lt;/code&gt; and &lt;code&gt;start&lt;/code&gt; and uses the predicted values as time series inputs for the subsequent &lt;code&gt;npredictions&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Default&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;No provided &lt;em&gt;&lt;code&gt;timeseries-column&lt;/code&gt;&lt;/em&gt;: prediction begins from the end of the in-sample data.&lt;br /&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;&lt;code&gt;timeseries-column&lt;/code&gt;&lt;/em&gt; provided: prediction begins from the end of the provided input data.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;npredictions&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Integer ≥1, the number of predicted timesteps.
&lt;p&gt;&lt;strong&gt;Default&lt;/strong&gt;: 10&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;missing&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Methods for handling missing values, one of the following strings:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&#39;drop&#39;: Missing values are ignored.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&#39;error&#39;: Missing values raise an error.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&#39;zero&#39;: Missing values are replaced with 0.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&#39;linear_interpolation&#39;: Missing values are replaced by linearly-interpolated values								based on the nearest valid entries before and after the missing value. 							If all values before or after a missing value in the prediction range are missing or invalid, interpolation is impossible and the function errors.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; Method used when training the model&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;add_mean&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Boolean, whether to add the model mean to the predicted value.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; True&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;output_standard_errors&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Boolean, whether to return estimates of the standard error of each prediction.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; False&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example makes predictions using the in-sample data that the &lt;code&gt;arima_temp&lt;/code&gt; model was trained on:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;SELECT&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;PREDICT_ARIMA&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;USING&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;PARAMETERS&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;model_name&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;arima_temp&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;npredictions&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;OVER&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;index&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;prediction&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;-------+------------------
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;9794640462952&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3759980774506&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;4596213753292&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;4&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;4670492239575&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;5&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;4559956810351&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;6&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;4405315951159&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;7&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;424086943584&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;8&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;4074973032696&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;9&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3909657020137&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;374540947803&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;rows&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can also apply the model to an input relation:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;SELECT&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;PREDICT_ARIMA&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;temperature&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;USING&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;PARAMETERS&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;model_name&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;arima_temp&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;start&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;100&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;npredictions&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;OVER&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;ORDER&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;BY&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;time&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;FROM&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;temp_data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;index&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;prediction&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;-------+------------------
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;15&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0373821404594&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;4707358943239&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;5714574755414&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;4&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1957213344543&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;5&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;5606204019976&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;6&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1604413418938&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;7&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3998222399722&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;8&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;6110939669533&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;9&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;9015211253485&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2382768006631&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;rows&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For an in-depth example that trains and makes predictions with an ARIMA model, see &lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/time-series-forecasting/arima-model-example/#&#34;&gt;ARIMA model example&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/time-series-forecasting/#&#34;&gt;Time series forecasting&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-management/get-model-summary/#&#34;&gt;GET_MODEL_SUMMARY&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-management/get-model-attribute/#&#34;&gt;GET_MODEL_ATTRIBUTE&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_AUTOREGRESSOR</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-autoregressor/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-autoregressor/</guid>
      <description>
        
        
        &lt;p&gt;Applies an autoregressor (AR) or vector autoregression (VAR) model to an input relation. The function returns predictions for each value column specified during model creation.&lt;/p&gt;
&lt;p&gt;AR and VAR models use previous values to make predictions. During model training, the user specifies the number of lagged timesteps taken into account during computation. The model predicts future values as a linear combination of the timeseries values at each lag.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_AUTOREGRESSOR ( &lt;span class=&#34;code-variable&#34;&gt;timeseries-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39; [, &lt;span class=&#34;code-variable&#34;&gt;param&lt;/span&gt;=&lt;span class=&#34;code-variable&#34;&gt;value&lt;/span&gt;[,...] ] )
        OVER (ORDER BY &lt;span class=&#34;code-variable&#34;&gt;timestamp-column&lt;/span&gt;)
        FROM &lt;span class=&#34;code-variable&#34;&gt;input-relation&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

&lt;p&gt;The following argument, as written, is required and cannot be omitted nor substituted with another type of clause.&lt;/p&gt;
&lt;pre class=&#34;table-pre&#34;&gt;OVER (ORDER BY &lt;span class=&#34;code-variable&#34;&gt;timestamp-column&lt;/span&gt;)&lt;/pre&gt;


&lt;/div&gt;

&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;timeseries-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The timeseries columns used to make predictions. The number of &lt;em&gt;&lt;code&gt;timeseries-columns&lt;/code&gt;&lt;/em&gt; must be the same as the number of value columns provided during model training.
&lt;p&gt;For each prediction, the model only considers the previous &lt;code&gt;P&lt;/code&gt; values of each column, where &lt;code&gt;P&lt;/code&gt; is the lag set during model creation.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;timestamp-column&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The timestamp column, with consistent timesteps, used to make the prediction.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The input relation containing the &lt;em&gt;&lt;code&gt;timeseries-columns&lt;/code&gt;&lt;/em&gt; and &lt;em&gt;&lt;code&gt;timestamp-column&lt;/code&gt;&lt;/em&gt;.
&lt;p&gt;The &lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt; cannot have missing values in any of the &lt;code&gt;P&lt;/code&gt; rows preceding &lt;code&gt;start&lt;/code&gt;, where &lt;code&gt;P&lt;/code&gt; is the lag set during model creation. To handle missing values, see &lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/data-preparation/impute/#&#34;&gt;IMPUTE&lt;/a&gt; or &lt;a href=&#34;../../../../../en/data-analysis/time-series-analytics/gap-filling-and-interpolation-gfi/linear-interpolation/#&#34;&gt;Linear interpolation&lt;/a&gt;.&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;start&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;INTEGER &amp;gt;p or ≤0, the index (row) of the &lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt; at which to start the prediction. If omitted, the prediction starts at the end of the &lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt;.
&lt;p&gt;If the &lt;code&gt;start&lt;/code&gt; index is greater than the number of rows &lt;code&gt;N&lt;/code&gt; in &lt;em&gt;&lt;code&gt;timeseries-columns&lt;/code&gt;&lt;/em&gt;, then the values between &lt;code&gt;N&lt;/code&gt; and &lt;code&gt;start&lt;/code&gt; are predicted and used for the prediction.&lt;/p&gt;
&lt;p&gt;If negative, the &lt;code&gt;start&lt;/code&gt; index is identified by counting backwards from the end of the &lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;For an &lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt; of N rows, negative values have a lower limit of either -1000 or -(N-p), whichever is greater.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; the end of &lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;npredictions&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;INTEGER ≥1, the number of predicted timesteps.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; 10&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;missing&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;One of the following methods for handling missing values:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;drop&lt;/strong&gt;: Missing values are ignored.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;error&lt;/strong&gt;: Missing values raise an error.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;zero&lt;/strong&gt;: Missing values are replaced with 0.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;linear_interpolation&lt;/strong&gt;: Missing values are replaced by linearly-interpolated values based on the nearest valid entries before and after the missing value. If all values before or after a missing value in the prediction range are missing or invalid, interpolation is impossible and the function errors. VAR models do not support linear interpolation.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; Method used when training the model&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example makes predictions using an AR model for 10 timesteps after the end of the input relation:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;SELECT&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;PREDICT_AUTOREGRESSOR&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Temperature&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;USING&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;PARAMETERS&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;model_name&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;AR_temperature&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;npredictions&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;OVER&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;ORDER&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;BY&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;time&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;FROM&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;temp_data&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;index&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;prediction&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;-------+------------------
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;6235419917807&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;9387860506032&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;6683380680058&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;4&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3886937385419&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;5&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2689506237424&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;6&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1503023330142&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;7&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0211734746741&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;8&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;11&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;9150531529328&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;9&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;11&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;825870404008&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;11&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;7451846722395&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;rows&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The following example makes predictions using a VAR model for 10 timesteps after the end of the input relation:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;SELECT&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;PREDICT_AUTOREGRESSOR&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;temp_location1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;temp_location2&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;USING&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;PARAMETERS&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; 
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;model_name&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;VAR_temperature&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;npredictions&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;OVER&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;ORDER&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;BY&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;time&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;FROM&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;temp_data_VAR&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;  
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;index&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;temp_location1&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;temp_location2&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;-------+------------------+------------------
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;11&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;7583950082813&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;7193948948294&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;11&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;8492948294829&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2400294852222&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;11&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;9917382847772&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;8385038582000&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;4&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;11&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2302988673747&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1174827497563&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;5&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;11&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;8920481717273&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;13&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1948776593788&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;6&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1737583757385&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;7362846366622&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;7&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0397364321183&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;9274628462844&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;8&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0395726450372&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1749275028444&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;     &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;9&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;11&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;8249947849488&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3274926927433&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;11&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1129497288422&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;o&#34;&gt;|&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;12&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1749274927493&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;rows&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;See &lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/time-series-forecasting/ar-and-var.md/autoregressive-model-example/#&#34;&gt;Autoregressive model example&lt;/a&gt; and &lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/time-series-forecasting/ar-and-var.md/var-example/#&#34;&gt;VAR model example&lt;/a&gt; for extended examples.&lt;/p&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/autoregressor/#&#34;&gt;AUTOREGRESSOR&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-management/get-model-summary/#&#34;&gt;GET_MODEL_SUMMARY&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_LINEAR_REG</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-linear-reg/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-linear-reg/</guid>
      <description>
        
        
        &lt;p&gt;Applies a linear regression model on an input relation and returns the predicted value as a FLOAT.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_LINEAR_REG ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39; [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT PREDICT_LINEAR_REG(waiting USING PARAMETERS model_name=&amp;#39;myLinearRegModel&amp;#39;)FROM
faithful ORDER BY id;


 PREDICT_LINEAR_REG
--------------------
   4.15403481386324
   2.18505296804024
   3.76023844469864
    2.8151271587036
   4.62659045686076
   2.26381224187316
   4.86286827835952
   4.62659045686076
   1.94877514654148
   4.62659045686076
   2.18505296804024
...
 (272 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The following example shows how to use the PREDICT_LINEAR_REG function on an input table, using the &lt;code&gt;match_by_pos&lt;/code&gt; parameter. Note that you can replace the column argument with a constant that does not match an input column:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT PREDICT_LINEAR_REG(55 USING PARAMETERS model_name=&amp;#39;linear_reg_faithful&amp;#39;,
                     match_by_pos=&amp;#39;true&amp;#39;)FROM faithful ORDER BY id;
 PREDICT_LINEAR_REG
--------------------
2.28552115094171
2.28552115094171
2.28552115094171
2.28552115094171
2.28552115094171
2.28552115094171
2.28552115094171
...
 (272 rows)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_LOGISTIC_REG</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-logistic-reg/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-logistic-reg/</guid>
      <description>
        
        
        &lt;p&gt;Applies a logistic regression model on an input relation.&lt;/p&gt;
&lt;p&gt;PREDICT_LOGISTIC_REG returns as a FLOAT the predicted class or the probability of the predicted class, depending on how the &lt;code&gt;type&lt;/code&gt; parameter is set. You can cast the return value to INTEGER or another &lt;a href=&#34;../../../../../en/sql-reference/data-types/numeric-data-types/&#34;&gt;numeric&lt;/a&gt; type when the return is in the probability of the predicted class.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_LOGISTIC_REG ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
            [, type = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;prediction-type&lt;/span&gt;&amp;#39;]
            [, cutoff = &lt;span class=&#34;code-variable&#34;&gt;probability-cutoff&lt;/span&gt;]
            [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;type&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Type of prediction for logistic regression, one of the following:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;response&lt;/code&gt; (default): Predicted values are 0 or 1.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;probability&lt;/code&gt;: Output is the probability of the predicted category to be 1.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;cutoff&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Used in conjunction with the &lt;code&gt;type&lt;/code&gt; parameter, a FLOAT between 0 and 1, exclusive. When &lt;code&gt;type&lt;/code&gt; is set to &lt;code&gt;response&lt;/code&gt;, the returned value of prediction is 1 if its corresponding probability is greater than or equal to the value of &lt;code&gt;cutoff&lt;/code&gt;; otherwise, it is 0.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; 0.5&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT car_model,
            PREDICT_LOGISTIC_REG(mpg, cyl, disp, drat, wt, qsec, vs, gear, carb
                                 USING PARAMETERS model_name=&amp;#39;myLogisticRegModel&amp;#39;)
          FROM mtcars;
      car_model      | PREDICT_LOGISTIC_REG
---------------------+----------------------
 Camaro Z28          |                    0
 Fiat 128            |                    1
 Fiat X1-9           |                    1
 Ford Pantera L      |                    1
 Merc 450SE          |                    0
 Merc 450SL          |                    0
 Toyota Corona       |                    0
 AMC Javelin         |                    0
 Cadillac Fleetwood  |                    0
 Datsun 710          |                    1
 Dodge Challenger    |                    0
 Hornet 4 Drive      |                    0
 Lotus Europa        |                    1
 Merc 230            |                    0
 Merc 280            |                    0
 Merc 280C           |                    0
 Merc 450SLC         |                    0
 Pontiac Firebird    |                    0
 Porsche 914-2       |                    1
 Toyota Corolla      |                    1
 Valiant             |                    0
 Chrysler Imperial   |                    0
 Duster 360          |                    0
 Ferrari Dino        |                    1
 Honda Civic         |                    1
 Hornet Sportabout   |                    0
 Lincoln Continental |                    0
 Maserati Bora       |                    1
 Mazda RX4           |                    1
 Mazda RX4 Wag       |                    1
 Merc 240D           |                    0
 Volvo 142E          |                    1
(32 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The following example shows how to use &lt;code&gt;PREDICT_LOGISTIC_REG&lt;/code&gt; on an input table, using the &lt;code&gt;match_by_pos&lt;/code&gt; parameter. Note that you can replace any of the column inputs with a constant that does not match an input column. In this example, column &lt;code&gt;mpg&lt;/code&gt; was replaced with the constant 20:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT car_model,
            PREDICT_LOGISTIC_REG(20, cyl, disp, drat, wt, qsec, vs, gear, carb
                                 USING PARAMETERS model_name=&amp;#39;myLogisticRegModel&amp;#39;, match_by_pos=&amp;#39;true&amp;#39;)
          FROM mtcars;
      car_model     | PREDICT_LOGISTIC_REG
--------------------+----------------------
AMC Javelin         |                    0
Cadillac Fleetwood  |                    0
Camaro Z28          |                    0
Chrysler Imperial   |                    0
Datsun 710          |                    1
Dodge Challenger    |                    0
Duster 360          |                    0
Ferrari Dino        |                    1
Fiat 128            |                    1
Fiat X1-9           |                    1
Ford Pantera L      |                    1
Honda Civic         |                    1
Hornet 4 Drive      |                    0
Hornet Sportabout   |                    0
Lincoln Continental |                    0
Lotus Europa        |                    1
Maserati Bora       |                    1
Mazda RX4           |                    1
Mazda RX4 Wag       |                    1
Merc 230            |                    0
Merc 240D           |                    0
Merc 280            |                    0
Merc 280C           |                    0
Merc 450SE          |                    0
Merc 450SL          |                    0
Merc 450SLC         |                    0
Pontiac Firebird    |                    0
Porsche 914-2       |                    1
Toyota Corolla      |                    1
Toyota Corona       |                    0
Valiant             |                    0
Volvo 142E          |                    1
(32 rows)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_MOVING_AVERAGE</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-moving-average/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-moving-average/</guid>
      <description>
        
        
        &lt;p&gt;Applies a moving-average (MA) model, created by &lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/moving-average/#&#34;&gt;MOVING_AVERAGE&lt;/a&gt;, to an input relation.&lt;/p&gt;
&lt;p&gt;Moving average models use the errors of previous predictions to make future predictions. More specifically, the user-specified &amp;quot;lag&amp;quot; determines how many previous predictions and errors it takes into account during computation.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_MOVING_AVERAGE ( &lt;span class=&#34;code-variable&#34;&gt;timeseries-column&lt;/span&gt;
        USING PARAMETERS
            model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
            [, start = &lt;span class=&#34;code-variable&#34;&gt;starting-index&lt;/span&gt;]
            [, npredictions = &lt;span class=&#34;code-variable&#34;&gt;npredictions&lt;/span&gt;]
            [, missing = &amp;#34;&lt;span class=&#34;code-variable&#34;&gt;imputation-method&lt;/span&gt;&amp;#34; ] )
        OVER (ORDER BY &lt;span class=&#34;code-variable&#34;&gt;timestamp-column&lt;/span&gt;)
        FROM &lt;span class=&#34;code-variable&#34;&gt;input-relation&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

&lt;p&gt;The following argument, as written, is required and cannot be omitted nor substituted with another type of clause.&lt;/p&gt;
&lt;pre class=&#34;table-pre&#34;&gt;OVER (ORDER BY &lt;span class=&#34;code-variable&#34;&gt;timestamp-column&lt;/span&gt;)&lt;/pre&gt;


&lt;/div&gt;

&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;timeseries-column&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The timeseries column used to make the prediction (only the last &lt;code&gt;q&lt;/code&gt; values, specified during model creation, are used).&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;timestamp-column&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The timestamp column, with consistent timesteps, used to make the prediction.&lt;/dd&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The input relation containing the &lt;em&gt;&lt;code&gt;timeseries-column&lt;/code&gt;&lt;/em&gt; and &lt;em&gt;&lt;code&gt;timestamp-column&lt;/code&gt;&lt;/em&gt;.
&lt;p&gt;Note that &lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt; cannot have missing values in any of the &lt;code&gt;q&lt;/code&gt; (set during training) rows preceding &lt;code&gt;start&lt;/code&gt;. To handle missing values, see &lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/data-preparation/impute/#&#34;&gt;IMPUTE&lt;/a&gt; or &lt;a href=&#34;../../../../../en/data-analysis/time-series-analytics/gap-filling-and-interpolation-gfi/linear-interpolation/#&#34;&gt;Linear interpolation&lt;/a&gt;.&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;start&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;INTEGER &amp;gt;q or ≤0, the index (row) of the &lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt; at which to start the prediction. If omitted, the prediction starts at the end of the &lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt;.
&lt;p&gt;If the &lt;code&gt;start&lt;/code&gt; index is greater than the number of rows &lt;code&gt;N&lt;/code&gt; in &lt;em&gt;&lt;code&gt;timeseries-column&lt;/code&gt;&lt;/em&gt;, then the values between &lt;code&gt;N&lt;/code&gt; and &lt;code&gt;start&lt;/code&gt; are predicted and used for the prediction.&lt;/p&gt;
&lt;p&gt;If negative, the &lt;code&gt;start&lt;/code&gt; index is identified by counting backwards from the end of the &lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;For an &lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt; of N rows, negative values have a lower limit of either -1000 or -(N-q), whichever is greater.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; the end of &lt;em&gt;&lt;code&gt;input-relation&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;npredictions&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;INTEGER ≥1, the number of predicted timesteps.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; 10&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;missing&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;One of the following methods for handling missing values:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;drop&lt;/strong&gt;: Missing values are ignored.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;error&lt;/strong&gt;: Missing values raise an error.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;zero&lt;/strong&gt;: Missing values are replaced with 0.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;linear_interpolation&lt;/strong&gt;: Missing values are replaced by linearly-interpolated values								based on the nearest valid entries before and after the missing value. If all values before or after a missing value in the prediction range are missing or invalid, interpolation is impossible and the function errors.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; Method used when training the model&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;See &lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/time-series-forecasting/moving-average-model-example/#&#34;&gt;Moving-average model example&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/moving-average/#&#34;&gt;MOVING_AVERAGE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-management/get-model-summary/#&#34;&gt;GET_MODEL_SUMMARY&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_NAIVE_BAYES</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-naive-bayes/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-naive-bayes/</guid>
      <description>
        
        
        &lt;p&gt;Applies a Naive Bayes model on an input relation.&lt;/p&gt;
&lt;p&gt;Depending on how the &lt;code&gt;type&lt;/code&gt; parameter is set, PREDICT_NAIVE_BAYES returns a VARCHAR that specifies either the predicted class or probability of the predicted class. If the function returns probability, you can cast the return value to an INTEGER or another &lt;a href=&#34;../../../../../en/sql-reference/data-types/numeric-data-types/&#34;&gt;numeric&lt;/a&gt; data type.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_NAIVE_BAYES ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
            [, type = &amp;#39; &lt;span class=&#34;code-variable&#34;&gt;return-type&lt;/span&gt; &amp;#39;]
            [, class = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;user-input-class&lt;/span&gt;&amp;#39;]
            [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;type&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;One of the following:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;response&lt;/code&gt; (default): Returns the class with the highest probability.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;probability&lt;/code&gt;: Valid only if &lt;code&gt;class&lt;/code&gt; parameter is set, returns the probability of belonging to the specified class argument.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;class&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Required if &lt;code&gt;type&lt;/code&gt; parameter is set to &lt;code&gt;probability&lt;/code&gt;. If you omit this parameter, &lt;code&gt;PREDICT_NAIVE_BAYES&lt;/code&gt; returns the class that it predicts as having the highest probability.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT party, PREDICT_NAIVE_BAYES (vote1, vote2, vote3
                                        USING PARAMETERS model_name=&amp;#39;naive_house84_model&amp;#39;,
                                                         type=&amp;#39;response&amp;#39;)
                                        AS Predicted_Party
                                        FROM house84_test;
   party    | Predicted_Party
------------+-----------------
 democrat   | democrat
 democrat   | democrat
 democrat   | democrat
 republican | republican
 democrat   | democrat
 democrat   | democrat
 democrat   | democrat
 democrat   | democrat
 democrat   | democrat
 republican | republican
 democrat   | democrat
 democrat   | democrat
 democrat   | democrat
 democrat   | republican
 republican | republican
 democrat   | democrat
 republican | republican
...
(99 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/classification-algorithms/naive-bayes/classifying-data-using-naive-bayes/#&#34;&gt;Classifying data using naive bayes&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/naive-bayes/#&#34;&gt;NAIVE_BAYES&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/predict-naive-bayes-classes/#&#34;&gt;PREDICT_NAIVE_BAYES_CLASSES&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_NAIVE_BAYES_CLASSES</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-naive-bayes-classes/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-naive-bayes-classes/</guid>
      <description>
        
        
        &lt;p&gt;Applies a Naive Bayes model on an input relation and returns the probabilities of classes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;VARCHAR &lt;code&gt;predicted&lt;/code&gt; column contains the class label with the highest probability.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Multiple FLOAT columns, where the first &lt;code&gt;probability&lt;/code&gt; column contains the probability for the class specified in the predicted column. Other columns contain the probability of belonging to each class specified in the &lt;code&gt;classes&lt;/code&gt; parameter.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_NAIVE_BAYES_CLASSES ( &lt;span class=&#34;code-variable&#34;&gt;predictor-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
            [, key_columns = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;key-columns&lt;/span&gt;&amp;#39;]
            [, exclude_columns = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;excluded-columns&lt;/span&gt;]
            [, classes = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;classes&lt;/span&gt;&amp;#39;]
            [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;] )
OVER( [&lt;span class=&#34;code-variable&#34;&gt;&lt;a href=&#34;../../../../../en/sql-reference/language-elements/window-clauses/window-partition-clause/#&#34;&gt;window-partition-clause&lt;/a&gt;&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;predictor-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;key_columns&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Comma-separated list of predictor column names that identify the output rows. To exclude these and other predictor columns from being used for prediction, include them in the argument list for parameter &lt;code&gt;exclude_columns&lt;/code&gt;.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;exclude_columns&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns from &lt;em&gt;&lt;code&gt;predictor-columns&lt;/code&gt;&lt;/em&gt; to exclude from processing.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;classes&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of class labels in the model. The probability of belonging to this given class as predicted by the classifier. The values are case sensitive.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Boolean value that specifies how predictor columns are matched to model features:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the predictor columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT PREDICT_NAIVE_BAYES_CLASSES (id, vote1, vote2 USING PARAMETERS
model_name=&amp;#39;naive_house84_model&amp;#39;,key_columns=&amp;#39;id&amp;#39;,exclude_columns=&amp;#39;id&amp;#39;,
classes=&amp;#39;democrat, republican&amp;#39;, match_by_pos=&amp;#39;false&amp;#39;)
        OVER() FROM house84_test;
 id  | Predicted  |    Probability    |     democrat      |    republican
-----+------------+-------------------+-------------------+-------------------
  21 | democrat   | 0.775473383353576 | 0.775473383353576 | 0.224526616646424
  28 | democrat   | 0.775473383353576 | 0.775473383353576 | 0.224526616646424
  83 | republican | 0.592510497724379 | 0.407489502275621 | 0.592510497724379
 102 | democrat   | 0.779889432167111 | 0.779889432167111 | 0.220110567832889
 107 | republican | 0.598662714551597 | 0.401337285448403 | 0.598662714551597
 125 | republican | 0.598662714551597 | 0.401337285448403 | 0.598662714551597
 132 | republican | 0.592510497724379 | 0.407489502275621 | 0.592510497724379
 136 | republican | 0.592510497724379 | 0.407489502275621 | 0.592510497724379
 155 | republican | 0.598662714551597 | 0.401337285448403 | 0.598662714551597
 174 | republican | 0.592510497724379 | 0.407489502275621 | 0.592510497724379
...
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/classification-algorithms/naive-bayes/classifying-data-using-naive-bayes/#&#34;&gt;Classifying data using naive bayes&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/predict-naive-bayes/#&#34;&gt;PREDICT_NAIVE_BAYES&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/naive-bayes/#&#34;&gt;NAIVE_BAYES&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_PLS_REG</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-pls-reg/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-pls-reg/</guid>
      <description>
        
        
        &lt;p&gt;Applies a &lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/pls-reg/#&#34;&gt;PLS_REG&lt;/a&gt; model to an input relation and returns a predicted FLOAT value for each row in the input relation.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_PLS_REG ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS &lt;span class=&#34;code-variable&#34;&gt;param&lt;/span&gt;=&lt;span class=&#34;code-variable&#34;&gt;value&lt;/span&gt;[,...] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of predictor columns to use from the input relation or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;The following example uses the &lt;code&gt;monarch_pls&lt;/code&gt; model to make predictions on the &lt;code&gt;monarch_test&lt;/code&gt; input relation:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sql&#34; data-lang=&#34;sql&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;=&amp;gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;SELECT&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;PREDICT_PLS_REG&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;USING&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;PARAMETERS&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;model_name&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;monarch_pls&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;FROM&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;monarch_test&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;n&#34;&gt;PREDICT_PLS_REG&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;------------------
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;88462577469318&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;86535009598611&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;84138719904564&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;7222022770597&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;96163608455087&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;30690898656628&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;99904802221049&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;7&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;k&#34;&gt;rows&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For an in-depth example, see &lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/regression-algorithms/pls-reg-example/#&#34;&gt;PLS regression&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/pls-reg/#&#34;&gt;PLS_REG&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-management/get-model-summary/#&#34;&gt;GET_MODEL_SUMMARY&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-management/get-model-attribute/#&#34;&gt;GET_MODEL_ATTRIBUTE&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_PMML</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-pmml/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-pmml/</guid>
      <description>
        
        
        &lt;p&gt;Applies an imported PMML model on an input relation. The function returns the result that would be expected for the model type encoded in the PMML model.&lt;/p&gt;
&lt;p&gt;PREDICT_PMML returns NULL in the following cases:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The predictor is an invalid or NULL value.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The categorical predictor is of an unknown class.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

&lt;p&gt;PREDICT_PMML returns values of complex type &lt;a href=&#34;../../../../../en/sql-reference/data-types/complex-types/row/#&#34;&gt;ROW&lt;/a&gt; for models that use the &lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/using-external-models-with/using-pmml-models/pmml-features-and-attributes/&#34;&gt;&lt;code&gt;Output&lt;/code&gt; tag&lt;/a&gt;. Currently, OpenText™ Analytics Database does not support directly inserting this data into a table.&lt;/p&gt;
&lt;p&gt;You can work around this limitation by changing the output to JSON with &lt;a href=&#34;../../../../../en/sql-reference/functions/data-type-specific-functions/collection-functions/to-json/#&#34;&gt;TO_JSON&lt;/a&gt; before inserting it into a table:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE TABLE predicted_output AS SELECT TO_JSON(PREDICT_PMML(X1,X2,X3
USING PARAMETERS model_name=&amp;#39;pmml_imported_model&amp;#39;))
AS predicted_value
FROM input_table;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_PMML ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39; [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Name of the model (case-insensitive). For a list of supported PMML model types and tags, see &lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/using-external-models-with/using-pmml-models/pmml-features-and-attributes/#&#34;&gt;PMML features and attributes&lt;/a&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;In this example, the function call uses all the columns from the table as predictors and predicts the value using the &#39;&lt;code&gt;my_kmeans&lt;/code&gt;&#39; model in PMML format:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT PREDICT_PMML(* USING PARAMETERS model_name=&amp;#39;my_kmeans&amp;#39;) AS predicted_label FROM table;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this example, the function call takes only columns &lt;code&gt;col1, col2&lt;/code&gt; as predictors, and predicts the value for each row using the &#39;&lt;code&gt;my_kmeans&lt;/code&gt;&#39; model from schema &#39;&lt;code&gt;my_schema&lt;/code&gt;&#39;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT PREDICT_PMML(col1, col2 USING PARAMETERS model_name=&amp;#39;my_schema.my_kmeans&amp;#39;) AS predicted_label FROM table;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this example, the function call returns an error as neither &lt;em&gt;&lt;code&gt;schema&lt;/code&gt;&lt;/em&gt; nor &lt;em&gt;&lt;code&gt;model-name&lt;/code&gt;&lt;/em&gt; can accept * as a value:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;SELECT PREDICT_PMML(* USING PARAMETERS model_name=&amp;#39;*.*&amp;#39;) AS predicted_label FROM table;
SELECT PREDICT_PMML(* USING PARAMETERS model_name=&amp;#39;*&amp;#39;) AS predicted_label FROM table;
SELECT PREDICT_PMML(* USING PARAMETERS model_name=&amp;#39;models.*&amp;#39;) AS predicted_label FROM table;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-management/import-models/#&#34;&gt;IMPORT_MODELS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-management/export-models/#&#34;&gt;EXPORT_MODELS&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_POISSON_REG</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-poisson-reg/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-poisson-reg/</guid>
      <description>
        
        
        &lt;p&gt;Applies a Poisson regression model on an input relation and returns the predicted value as a FLOAT.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_POISSON_REG ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39; [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT PREDICT_POISSON_REG(waiting USING PARAMETERS model_name=&amp;#39;MYModel&amp;#39;)::numeric(20,10) FROM lin.faithful ORDER BY id;
predict_poisson_reg
---------------------
4.0230080811
2.2284857176
3.5747254723
2.6921731651
4.6357580051
2.2817680621
4.9762900161
4.6357580051
2.0759884314
(9 rows)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_RF_CLASSIFIER</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-rf-classifier/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-rf-classifier/</guid>
      <description>
        
        
        &lt;p&gt;Applies a random forest model on an input relation. PREDICT_RF_CLASSIFIER returns a VARCHAR data type that specifies one of the following, as determined by how the &lt;code&gt;type&lt;/code&gt; parameter is set:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The predicted class (based on popular votes)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Probability of a class for each input instance.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

The predicted class is selected only based on the popular vote of the decision trees in the forest. Therefore, in special cases the calculated probability of the predicted class may not be the highest.

&lt;/div&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_RF_CLASSIFIER ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
            [, type = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;prediction-type&lt;/span&gt;&amp;#39;]
            [, class = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;user-input-class&lt;/span&gt;&amp;#39;]
            [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;type&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Type of prediction to return, one of the following:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;response&lt;/code&gt; (default): The class with the highest probability among all possible classes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;probability&lt;/code&gt;: Valid only if the &lt;code&gt;class&lt;/code&gt; parameter is set, returns the probability of the specified class.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;class&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Class to use when the &lt;code&gt;type&lt;/code&gt; parameter is set to &lt;code&gt;probability&lt;/code&gt;. If you omit this parameter, the function uses the predicted class—the one with the popular vote. Thus, the predict function returns the probability that the input instance belongs to its predicted class.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT PREDICT_RF_CLASSIFIER (Sepal_Length, Sepal_Width, Petal_Length, Petal_Width
       USING PARAMETERS model_name=&amp;#39;myRFModel&amp;#39;) FROM iris;
PREDICT_RF_CLASSIFIER
-----------------------
setosa
setosa
setosa
...
versicolor
versicolor
versicolor
...
virginica
virginica
virginica
...
(150 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This example shows how you can use the PREDICT_RF_CLASSIFIER function, using the &lt;code&gt;match_by_pos&lt;/code&gt; parameter:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT PREDICT_RF_CLASSIFIER (Sepal_Length, Sepal_Width, Petal_Length, Petal_Width
                                USING PARAMETERS model_name=&amp;#39;myRFModel&amp;#39;, match_by_pos=&amp;#39;true&amp;#39;) FROM iris;
PREDICT_RF_CLASSIFIER
-----------------------
setosa
setosa
setosa
...
versicolor
versicolor
versicolor
...
virginica
virginica
virginica
...
(150 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/classification-algorithms/random-forest-classification/classifying-data-using-random-forest/#&#34;&gt;Classifying data using random forest&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/rf-classifier/#&#34;&gt;RF_CLASSIFIER&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/predict-rf-classifier-classes/#&#34;&gt;PREDICT_RF_CLASSIFIER_CLASSES&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-management/get-model-summary/#&#34;&gt;GET_MODEL_SUMMARY&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_RF_CLASSIFIER_CLASSES</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-rf-classifier-classes/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-rf-classifier-classes/</guid>
      <description>
        
        
        &lt;p&gt;Applies a random forest model on an input relation and returns the probabilities of classes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;VARCHAR &lt;code&gt;predicted&lt;/code&gt; column contains the class label with the highest vote (popular vote).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Multiple FLOAT columns, where the first &lt;code&gt;probability&lt;/code&gt; column contains the probability for the class reported in the predicted column. Other columns contain the probability of each class specified in the &lt;code&gt;classes&lt;/code&gt; parameter.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Key columns with the same value and data type as matching input columns specified in parameter &lt;code&gt;key_columns&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

Selection of the predicted class is based on the popular vote of decision trees in the forest. Thus, in special cases the calculated probability of the predicted class might not be the highest.

&lt;/div&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_RF_CLASSIFIER_CLASSES ( &lt;span class=&#34;code-variable&#34;&gt;predictor-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
            [, key_columns = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;key-columns&lt;/span&gt;&amp;#39;]
            [, exclude_columns = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;excluded-columns&lt;/span&gt;&amp;#39;]
            [, classes = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;classes&lt;/span&gt;&amp;#39;]
            [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;] )
OVER( [&lt;span class=&#34;code-variable&#34;&gt;&lt;a href=&#34;../../../../../en/sql-reference/language-elements/window-clauses/window-partition-clause/#&#34;&gt;window-partition-clause&lt;/a&gt;&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;predictor-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;key_columns&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Comma-separated list of predictor column names that identify the output rows. To exclude these and other predictor columns from being used for prediction, include them in the argument list for parameter &lt;code&gt;exclude_columns&lt;/code&gt;.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;exclude_columns&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns from &lt;em&gt;&lt;code&gt;predictor-columns&lt;/code&gt;&lt;/em&gt; to exclude from processing.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;classes&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of class labels in the model. The probability of belonging to this given class is predicted by the classifier. Values are case sensitive.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Boolean value that specifies how predictor columns are matched to model features:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the predictor columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT PREDICT_RF_CLASSIFIER_CLASSES(Sepal_Length, Sepal_Width, Petal_Length, Petal_Width
                               USING PARAMETERS model_name=&amp;#39;myRFModel&amp;#39;) OVER () FROM iris;
predicted  |    probability
-----------+-------------------
setosa     |                 1
setosa     |              0.99
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |              0.97
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |              0.99
...
(150 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This example shows how to use function &lt;code&gt;PREDICT_RF_CLASSIFIER_CLASSES&lt;/code&gt;, using the &lt;code&gt;match_by_pos&lt;/code&gt; parameter:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT PREDICT_RF_CLASSIFIER_CLASSES(Sepal_Length, Sepal_Width, Petal_Length, Petal_Width
                          USING PARAMETERS model_name=&amp;#39;myRFModel&amp;#39;, match_by_pos=&amp;#39;true&amp;#39;) OVER () FROM iris;
predicted  |    probability
-----------+-------------------
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
...
(150 rows)s
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/classification-algorithms/random-forest-classification/classifying-data-using-random-forest/#&#34;&gt;Classifying data using random forest&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/rf-classifier/#&#34;&gt;RF_CLASSIFIER&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/predict-rf-classifier/#&#34;&gt;PREDICT_RF_CLASSIFIER&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-management/get-model-summary/#&#34;&gt;GET_MODEL_SUMMARY&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_RF_REGRESSOR</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-rf-regressor/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-rf-regressor/</guid>
      <description>
        
        
        &lt;p&gt;Applies a random forest model on an input relation, and returns with a FLOAT data type that specifies the predicted value of the random forest model—the average of the prediction of the trees in the forest.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_RF_REGRESSOR ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39; [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT PREDICT_RF_REGRESSOR (mpg,cyl,hp,drat,wt
USING PARAMETERS model_name=&amp;#39;myRFRegressorModel&amp;#39;)FROM mtcars;
PREDICT_RF_REGRESSOR
----------------------
2.94774203574204
2.6954087024087
2.6954087024087
2.89906346431346
2.97688489288489
2.97688489288489
2.7086587024087
2.92078965478965
2.97688489288489
2.7086587024087
2.95621822621823
2.82255155955156
2.7086587024087
2.7086587024087
2.85650394050394
2.85650394050394
2.97688489288489
2.95621822621823
2.6954087024087
2.6954087024087
2.84493251193251
2.97688489288489
2.97688489288489
2.8856467976468
2.6954087024087
2.92078965478965
2.97688489288489
2.97688489288489
2.7934087024087
2.7934087024087
2.7086587024087
2.72469441669442
(32 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/regression-algorithms/random-forest-regression/building-random-forest-regression-model/#&#34;&gt;Building a random forest regression model&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-management/get-model-summary/#&#34;&gt;GET_MODEL_SUMMARY&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/rf-regressor/#&#34;&gt;RF_REGRESSOR&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_SVM_CLASSIFIER</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-svm-classifier/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-svm-classifier/</guid>
      <description>
        
        
        &lt;p&gt;Uses an SVM model to predict class labels for samples in an input relation, and returns the predicted value as a FLOAT data type.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_SVM_CLASSIFIER (&lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
     USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
            [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;]
            [, type = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;return-type&lt;/span&gt;&amp;#39;]
            [, cutoff = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;cutoff-value&lt;/span&gt;&amp;#39;] ] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;type&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;A string that specifies the output to return for each input row, one of the following:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;response&lt;/code&gt;: Outputs the predicted class of 0 or 1.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;probability&lt;/code&gt;: Outputs a value in the range (0,1), the prediction score transformed using the logistic function.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;cutoff&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Valid only if the &lt;code&gt;type&lt;/code&gt; parameter is set to &lt;code&gt;probability&lt;/code&gt;, a FLOAT value that is compared to the transformed prediction score to determine the predicted class.
&lt;p&gt;&lt;strong&gt;Default:&lt;/strong&gt; 0&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; SELECT PREDICT_SVM_CLASSIFIER (mpg,cyl,disp,wt,qsec,vs,gear,carb
USING PARAMETERS model_name=&amp;#39;mySvmClassModel&amp;#39;) FROM mtcars;
PREDICT_SVM_CLASSIFIER
------------------------
0
0
1
0
0
1
1
1
1
0
0
1
0
0
1
0
0
0
0
0
0
1
1
0
0
1
1
1
1
0
0
0
(32 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This example shows how to use &lt;code&gt;PREDICT_SVM_CLASSIFIER&lt;/code&gt; on the &lt;code&gt;mtcars&lt;/code&gt; table, using the &lt;code&gt;match_by_pos&lt;/code&gt; parameter. In this example, column &lt;code&gt;mpg&lt;/code&gt; was replaced with the constant 40:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; SELECT PREDICT_SVM_CLASSIFIER (40,cyl,disp,wt,qsec,vs,gear,carb
USING PARAMETERS model_name=&amp;#39;mySvmClassModel&amp;#39;, match_by_pos =&amp;#39;true&amp;#39;) FROM mtcars;
PREDICT_SVM_CLASSIFIER
------------------------
0
0
0
0
1
0
0
1
1
1
1
1
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
1
1
0
0
1
(32 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/classification-algorithms/svm-support-vector-machine-classification/classifying-data-using-svm-support-vector-machine/#&#34;&gt;Classifying data using SVM (support vector machine)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/classification-algorithms/svm-support-vector-machine-classification/#&#34;&gt;SVM (support vector machine) for classification&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/svm-classifier/#&#34;&gt;SVM_CLASSIFIER&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-management/get-model-summary/#&#34;&gt;GET_MODEL_SUMMARY&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_SVM_REGRESSOR</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-svm-regressor/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-svm-regressor/</guid>
      <description>
        
        
        &lt;p&gt;Uses an SVM model to perform regression on samples in an input relation, and returns the predicted value as a FLOAT data type.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_SVM_REGRESSOR(&lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39; [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; SELECT PREDICT_SVM_REGRESSOR(waiting USING PARAMETERS model_name=&amp;#39;mySvmRegModel&amp;#39;)
           FROM faithful ORDER BY id;
 PREDICT_SVM_REGRESSOR
--------------------
   4.06488248694445
   2.30392277646291
   3.71269054484815
   2.867429883817
   4.48751281746003
   2.37436116488217
   4.69882798271781
   4.48751281746003
   2.09260761120512
...
 (272 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This example shows how you can use the PREDICT_SVM_REGRESSOR function on the faithful table, using the &lt;code&gt;match_by_pos&lt;/code&gt; parameter. In this example, the waiting column was replaced with the constant 40:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; SELECT PREDICT_SVM_REGRESSOR(40 USING PARAMETERS model_name=&amp;#39;mySvmRegModel&amp;#39;, match_by_pos=&amp;#39;true&amp;#39;)
           FROM faithful ORDER BY id;
 PREDICT_SVM_REGRESSOR
--------------------
   1.31778533859324
   1.31778533859324
   1.31778533859324
   1.31778533859324
   1.31778533859324
   1.31778533859324
   1.31778533859324
   1.31778533859324
   1.31778533859324
...
 (272 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/regression-algorithms/svm-support-vector-machine-regression/building-an-svm-regression-model/#&#34;&gt;Building an SVM for regression model&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/regression-algorithms/svm-support-vector-machine-regression/#&#34;&gt;SVM (support vector machine) for regression&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/svm-regressor/#&#34;&gt;SVM_REGRESSOR&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-management/get-model-summary/#&#34;&gt;GET_MODEL_SUMMARY&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_TENSORFLOW</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-tensorflow/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-tensorflow/</guid>
      <description>
        
        
        &lt;p&gt;Applies a TensorFlow model on an input relation, and returns with the result expected for the encoded model type.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_TENSORFLOW ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39; [, num_passthru_cols = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;n-first-columns-to-ignore&lt;/span&gt;&amp;#39;] )
OVER( [&lt;span class=&#34;code-variable&#34;&gt;&lt;a href=&#34;../../../../../en/sql-reference/language-elements/window-clauses/window-partition-clause/#&#34;&gt;window-partition-clause&lt;/a&gt;&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;num_passthru_cols&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Integer that specifies the number of input columns to skip.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;Use PREDICT_TENSORFLOW with the &lt;code&gt;num_passthru_cols&lt;/code&gt; parameter to skip the first two input columns:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; SELECT PREDICT_TENSORFLOW ( pid,label,x1,x2
        USING PARAMETERS model_name=&amp;#39;spiral_demo&amp;#39;, num_passthru_cols=2 )
OVER(PARTITION BEST) as predicted_class FROM points;

--example output, the skipped columns are displayed as the first columns of the output
  pid  | label |         col0         |         col1
-------+-------+----------------------+----------------------
     0 |     0 |    0.990638732910156 |  0.00936129689216614
     1 |     0 |    0.999036073684692 | 0.000963933940511197
     2 |     1 |   0.0103802494704723 | 0.989619791507721
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/using-external-models-with/tensorflow-models/tensorflow-example/#&#34;&gt;TensorFlow example&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/predict-tensorflow-scalar/#&#34;&gt;PREDICT_TENSORFLOW_SCALAR&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/classification-algorithms/naive-bayes/classifying-data-using-naive-bayes/#&#34;&gt;Classifying data using naive bayes&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/naive-bayes/#&#34;&gt;NAIVE_BAYES&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/predict-naive-bayes-classes/#&#34;&gt;PREDICT_NAIVE_BAYES_CLASSES&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_TENSORFLOW_SCALAR</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-tensorflow-scalar/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-tensorflow-scalar/</guid>
      <description>
        
        
        &lt;p&gt;Applies an imported TensorFlow model on an input relation. This function, unlike &lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/predict-tensorflow/#&#34;&gt;PREDICT_TENSORFLOW&lt;/a&gt;, accepts one input column of type &lt;a href=&#34;../../../../../en/sql-reference/data-types/complex-types/row/#&#34;&gt;ROW&lt;/a&gt;, where each field corresponds to an input tensor, and returns one output column of type ROW, where each field corresponds to an output tensor.&lt;/p&gt;
&lt;p&gt;For details about importing TensorFlow models into OpenText™ Analytics Database, see &lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/using-external-models-with/tensorflow-models/tensorflow-integration-and-directory-structure/#&#34;&gt;TensorFlow integration and directory structure&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_TENSORFLOW_SCALAR ( &lt;span class=&#34;code-variable&#34;&gt;inputs&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39; )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;inputs&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Input column of type ROW with fields of 1D &lt;a href=&#34;../../../../../en/sql-reference/data-types/complex-types/array/#&#34;&gt;ARRAY&lt;/a&gt;s that represent input tensors. These tensors can represent outputs for various input operations.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;This function can simplify the process for making predictions on data with many input features. &lt;p&gt;For instance, the &lt;a href=&#34;http://yann.lecun.com/exdb/mnist/&#34;&gt;MNIST handwritten digit classification dataset&lt;/a&gt; contains 784 input features for each input row, one feature for each pixel in the images of handwritten digits. The PREDICT_TENSORFLOW function requires that each of these input features are contained in a separate input column. By encapsulating these features into a single ARRAY, the PREDICT_TENSORFLOW_SCALAR function only needs a single input column of type ROW, where the pixel values are the array elements for an input field:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;--Each array for the &amp;#34;image&amp;#34; field has 784 elements. 
=&amp;gt; SELECT * FROM mnist_train;
id |                   inputs
---+---------------------------------------------
 1 | {&amp;#34;image&amp;#34;:[0, 0, 0,..., 244, 222, 210,...]}
 2 | {&amp;#34;image&amp;#34;:[0, 0, 0,..., 185, 84, 223,...]}
 3 | {&amp;#34;image&amp;#34;:[0, 0, 0,..., 133, 254, 78,...]}
 ...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this case, the function output consists of a single opeartion with one tensor. The value of this field is an array of ten elements, which are all zero except for the element whose index is the predicted digit:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT id, PREDICT_TENSORFLOW_SCALAR(inputs USING PARAMETERS model_name=&amp;#39;tf_mnist_ct&amp;#39;) FROM mnist_test;
 id |                   PREDICT_TENSORFLOW_SCALAR                      
----+-------------------------------------------------------------------
  1 | {&amp;#34;prediction:0&amp;#34;:[&amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;1&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;]} 
  2 | {&amp;#34;prediction:0&amp;#34;:[&amp;#34;0&amp;#34;, &amp;#34;1&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;]} 
  3 | {&amp;#34;prediction:0&amp;#34;:[&amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;1&amp;#34;, &amp;#34;0&amp;#34;, &amp;#34;0&amp;#34;]} 
...
&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;To view the expected input and output tensors for an imported TensorFlow model, call &lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-management/get-model-summary/#&#34;&gt;GET_MODEL_SUMMARY&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT GET_MODEL_SUMMARY(USING PARAMETERS model_name=&amp;#39;tf_mnist_ct&amp;#39;);
                             GET_MODEL_SUMMARY
---------------------------------------------------------------------------

=============
input_tensors
=============
  name |type |dimensions
-------+-----+----------
 image |int32|  [-1,784]  


==============
output_tensors
==============
     name     | type |dimensions
--------------+------+----------
 prediction:0 |int32 | [-1,10]  

(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/using-external-models-with/tensorflow-models/tensorflow-example/#&#34;&gt;TensorFlow example&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/predict-tensorflow/#&#34;&gt;PREDICT_TENSORFLOW&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_XGB_CLASSIFIER</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-xgb-classifier/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-xgb-classifier/</guid>
      <description>
        
        
        &lt;p&gt;Applies an XGBoost classifier model on an input relation. &lt;code&gt;PREDICT_XGB_CLASSIFIER&lt;/code&gt; returns a VARCHAR data type that specifies one of the following, as determined by how the &lt;code&gt;type&lt;/code&gt; parameter is set:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The predicted class (based on probability scores)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Probability of a class for each input instance.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_XGB_CLASSIFIER ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
          USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
              [, type = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;prediction-type&lt;/span&gt;&amp;#39; ]
              [, class = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;user-input-class&lt;/span&gt;&amp;#39; ]
              [, match_by_pos = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;&amp;#39; ]
              [, probability_normalization = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;prob-normalization&lt;/span&gt;&amp;#39; ] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;type&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Type of prediction to return, one of the following:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;response&lt;/code&gt; (default): The class with the highest probability among all possible classes.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;probability&lt;/code&gt;: Valid only if the &lt;code&gt;class&lt;/code&gt; parameter is set, returns for each input instance the probability of the specified class or predicted class.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;class&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Class to use when the &lt;code&gt;type&lt;/code&gt; parameter is set to &lt;code&gt;probability&lt;/code&gt;. If you omit this parameter, the function uses the predicted class—the one with the highest probability score. Thus, the predict function returns the probability that the input instance belongs to the specified or predicted class.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;probability_normalization&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;The classifier&#39;s normalization method, either &lt;code&gt;softmax&lt;/code&gt; (multi-class classifier) or &lt;code&gt;logit&lt;/code&gt; (binary classifier). If unspecified, the default &lt;code&gt;logit&lt;/code&gt; function is used for normalization.&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;Use 
&lt;code&gt;&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/predict-xgb-classifier/#&#34;&gt;PREDICT_XGB_CLASSIFIER&lt;/a&gt;&lt;/code&gt; to apply the classifier to the test data:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT PREDICT_XGB_CLASSIFIER (Sepal_Length, Sepal_Width, Petal_Length, Petal_Width
    USING PARAMETERS model_name=&amp;#39;xgb_iris&amp;#39;, probability_normalization=&amp;#39;logit&amp;#39;) FROM iris1;
PREDICT_XGB_CLASSIFIER
------------------------
setosa
setosa
setosa
.
.
.
versicolor
versicolor
versicolor
.
.
.
virginica
virginica
virginica
.
.
.

(90 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;See &lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/classification-algorithms/xgboost-classification/#&#34;&gt;XGBoost for classification&lt;/a&gt; for more examples.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_XGB_CLASSIFIER_CLASSES</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-xgb-classifier-classes/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-xgb-classifier-classes/</guid>
      <description>
        
        
        &lt;p&gt;Applies an XGBoost classifier model on an input relation and returns the probabilities of classes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;VARCHAR &lt;code&gt;predicted&lt;/code&gt; column contains the class label with the highest probability.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Multiple FLOAT columns, where the first &lt;code&gt;probability&lt;/code&gt; column contains the probability for the class reported in the predicted column. Other columns contain the probability of each class specified in the &lt;code&gt;classes&lt;/code&gt; parameter.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Key columns with the same value and data type as matching input columns specified in parameter &lt;code&gt;key_columns&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All trees contribute to a predicted probability for each response class, and the highest probability class is chosen.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_XGB_CLASSIFIER_CLASSES ( &lt;span class=&#34;code-variable&#34;&gt;predictor-columns&lt;/span&gt;)
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39;
            [, key_columns = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;key-columns&lt;/span&gt;&amp;#39;]
            [, exclude_columns = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;excluded-columns&lt;/span&gt;&amp;#39;]
            [, classes = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;classes&lt;/span&gt;&amp;#39;]
            [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;]
            [, probability_normalization = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;prob-normalization&lt;/span&gt;&amp;#39; ] )
OVER( [&lt;span class=&#34;code-variable&#34;&gt;&lt;span class=&#34;code-variable&#34;&gt;&lt;a href=&#34;../../../../../en/sql-reference/language-elements/window-clauses/window-partition-clause/#&#34;&gt;window-partition-clause&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;key_columns&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Comma-separated list of predictor column names that identify the output rows. To exclude these and other predictor columns from being used for prediction, include them in the argument list for parameter &lt;code&gt;exclude_columns&lt;/code&gt;.&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;exclude_columns&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns from &lt;em&gt;&lt;code&gt;predictor-columns&lt;/code&gt;&lt;/em&gt; to exclude from processing.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;classes&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of class labels in the model. The probability of belonging to each given class is predicted by the classifier. Values are case sensitive.&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Boolean value that specifies how predictor columns are matched to model features:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the predictor columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;probability_normalization&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;The classifier&#39;s normalization method, either &lt;code&gt;softmax&lt;/code&gt; (multi-class classifier) or &lt;code&gt;logit&lt;/code&gt; (binary classifier). If unspecified, the default &lt;code&gt;logit&lt;/code&gt; function is used for normalization.&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;After creating an XGBoost classifier model with 
&lt;code&gt;&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/xgb-classifier/#&#34;&gt;XGB_CLASSIFIER&lt;/a&gt;&lt;/code&gt;, you can use &lt;code&gt;PREDICT_XGB_CLASSIFIER_CLASSES&lt;/code&gt; to view the probability of each classification. In this example, the XGBoost classifier model &amp;quot;xgb_iris&amp;quot; is used to predict the probability that a given flower belongs to a species of iris:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT PREDICT_XGB_CLASSIFIER_CLASSES(Sepal_Length, Sepal_Width, Petal_Length, Petal_Width
    USING PARAMETERS model_name=&amp;#39;xgb_iris&amp;#39;) OVER (PARTITION BEST) FROM iris1;
  predicted  |    probability
------------+-------------------
 setosa     |   0.9999650465368
 setosa     |   0.9999650465368
 setosa     |   0.9999650465368
 setosa     |   0.9999650465368
 setosa     | 0.999911552783011
 setosa     |   0.9999650465368
 setosa     |   0.9999650465368
 setosa     |   0.9999650465368
 setosa     |   0.9999650465368
 setosa     |   0.9999650465368
 setosa     |   0.9999650465368
 setosa     |   0.9999650465368
 versicolor |  0.99991871763563
 .
 .
 .
(90 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can also specify additional classes. In this example, &lt;code&gt;PREDICT_XGB_CLASSIFIER_CLASSES&lt;/code&gt; makes the same prediction as the previous example, but also returns the probability that a flower belongs to the specified &lt;code&gt;classes&lt;/code&gt; &amp;quot;virginica&amp;quot; and &amp;quot;versicolor&amp;quot;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT PREDICT_XGB_CLASSIFIER_CLASSES(Sepal_Length, Sepal_Width, Petal_Length, Petal_Width
    USING PARAMETERS model_name=&amp;#39;xgb_iris&amp;#39;, classes=&amp;#39;virginica,versicolor&amp;#39;, probability_normalization=&amp;#39;logit&amp;#39;) OVER (PARTITION BEST) FROM iris1;
 predicted  |    probability    |      virginica       |      versicolor
------------+-------------------+----------------------+----------------------
 setosa     |   0.9999650465368 | 1.16160301545536e-05 | 2.33374330460065e-05
 setosa     |   0.9999650465368 | 1.16160301545536e-05 | 2.33374330460065e-05
 setosa     |   0.9999650465368 | 1.16160301545536e-05 | 2.33374330460065e-05
 .
 .
 .
 versicolor |  0.99991871763563 | 6.45697562080953e-05 |     0.99991871763563
 versicolor | 0.999967282051702 | 1.60052775404199e-05 |    0.999967282051702
 versicolor | 0.999648819964864 |  0.00028366342010669 |    0.999648819964864
 .
 .
 .
 virginica  | 0.999977039257386 |    0.999977039257386 | 1.13305901169304e-05
 virginica  | 0.999977085131063 |    0.999977085131063 | 1.12847163501674e-05
 virginica  | 0.999977039257386 |    0.999977039257386 | 1.13305901169304e-05
(90 rows)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Sql-Reference: PREDICT_XGB_REGRESSOR</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/predict-xgb-regressor/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/predict-xgb-regressor/</guid>
      <description>
        
        
        &lt;p&gt;Applies an XGBoost regressor model on an input relation. &lt;code&gt;PREDICT_XGB_REGRESSOR&lt;/code&gt; returns a FLOAT data type that specifies the predicted value by the XGBoost model: a weighted sum of contributions by each tree in the model.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;PREDICT_XGB_REGRESSOR ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt;
        USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39; [, match_by_pos = &lt;span class=&#34;code-variable&#34;&gt;match-by-position&lt;/span&gt;] )
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Comma-separated list of columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;match_by_pos&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Boolean value that specifies how input columns are matched to model features:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;true&lt;/code&gt;: Match by the position of columns in the input columns list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;false&lt;/code&gt; (default): Match by name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;See &lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/regression-algorithms/xgboost-regression/#&#34;&gt;XGBoost for regression&lt;/a&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: REVERSE_NORMALIZE</title>
      <link>/en/sql-reference/functions/ml-functions/transformation-functions/reverse-normalize/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/functions/ml-functions/transformation-functions/reverse-normalize/</guid>
      <description>
        
        
        &lt;p&gt;Reverses the normalization transformation on normalized data, thereby de-normalizing the normalized data. If you specify a column that is not in the specified model, &lt;code&gt;REVERSE_NORMALIZE&lt;/code&gt; returns that column unchanged.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;REVERSE_NORMALIZE ( &lt;span class=&#34;code-variable&#34;&gt;input-columns&lt;/span&gt; USING PARAMETERS model_name = &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;model-name&lt;/span&gt;&amp;#39; );
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;arguments&#34;&gt;Arguments&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;input-columns&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;The columns to use from the input relation, or asterisk (*) to select all columns.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;model_name&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Name of the model (case-insensitive).&lt;/p&gt;
&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;Use &lt;code&gt;REVERSE_NORMALIZE&lt;/code&gt; on the &lt;code&gt;hp&lt;/code&gt; and &lt;code&gt;cyl&lt;/code&gt; columns in table &lt;code&gt;mtcars&lt;/code&gt;, where &lt;code&gt;hp&lt;/code&gt; is in normalization model &lt;code&gt;mtcars_normfit&lt;/code&gt;, and &lt;code&gt;cyl&lt;/code&gt; is not in the normalization model.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT REVERSE_NORMALIZE (hp, cyl USING PARAMETERS model_name=&amp;#39;mtcars_normfit&amp;#39;) FROM mtcars;
hp    | cyl
------+-----
42502 |   8
58067 |   8
26371 |   4
42502 |   8
31182 |   6
32031 |   4
26937 |   4
34861 |   6
34861 |   6
50992 |   8
50992 |   8
49577 |   8
25805 |   4
18447 |   4
29767 |   6
65142 |   8
69387 |   8
14768 |   4
49577 |   8
60897 |   8
94857 |   8
31182 |   6
31182 |   6
30899 |   4
69387 |   8
49577 |   6
18730 |   4
18730 |   4
74764 |   8
17598 |   4
50992 |   8
27503 |   4
(32 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/transformation-functions/apply-normalize/#&#34;&gt;APPLY_NORMALIZE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/data-preparation/normalize/#&#34;&gt;NORMALIZE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/data-preparation/normalize-fit/#&#34;&gt;NORMALIZE_FIT&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/data-preparation/normalizing-data/#&#34;&gt;Normalizing data&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
  </channel>
</rss>
