<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – Random forest for classification</title>
    <link>/en/data-analysis/ml-predictive-analytics/classification-algorithms/random-forest-classification/</link>
    <description>Recent content in Random forest for classification on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/data-analysis/ml-predictive-analytics/classification-algorithms/random-forest-classification/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Data-Analysis: Classifying data using random forest</title>
      <link>/en/data-analysis/ml-predictive-analytics/classification-algorithms/random-forest-classification/classifying-data-using-random-forest/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/data-analysis/ml-predictive-analytics/classification-algorithms/random-forest-classification/classifying-data-using-random-forest/</guid>
      <description>
        
        
        &lt;p&gt;This random forest example uses a data set named iris. The example contains four variables that measure various parts of the iris flower to predict its species.&lt;/p&gt;
&lt;p&gt;Before you begin the example, make sure that you have followed the steps in &lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/download-ml-example-data/#&#34;&gt;Download the machine learning example data&lt;/a&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Use 
&lt;code&gt;&lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/ml-algorithms/rf-classifier/#&#34;&gt;RF_CLASSIFIER&lt;/a&gt;&lt;/code&gt; to create the random forest model, named &lt;code&gt;rf_iris&lt;/code&gt;, using the &lt;code&gt;iris&lt;/code&gt; data. View the summary output of the model with 
&lt;code&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;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT RF_CLASSIFIER (&amp;#39;rf_iris&amp;#39;, &amp;#39;iris&amp;#39;, &amp;#39;Species&amp;#39;, &amp;#39;Sepal_Length, Sepal_Width, Petal_Length, Petal_Width&amp;#39;
USING PARAMETERS ntree=100, sampling_size=0.5);

        RF_CLASSIFIER
----------------------------
Finished training

(1 row)


=&amp;gt; SELECT GET_MODEL_SUMMARY(USING PARAMETERS model_name=&amp;#39;rf_iris&amp;#39;);
------------------------------------------------------------------------
===========
call_string
===========
SELECT rf_classifier(&amp;#39;public.rf_iris&amp;#39;, &amp;#39;iris&amp;#39;, &amp;#39;&amp;#34;species&amp;#34;&amp;#39;, &amp;#39;Sepal_Length, Sepal_Width, Petal_Length,
Petal_Width&amp;#39; USING PARAMETERS exclude_columns=&amp;#39;&amp;#39;, ntree=100, mtry=2, sampling_size=0.5, max_depth=5,
max_breadth=32, min_leaf_size=1, min_info_gain=0, nbins=32);

=======
details
=======
predictor   |type
------------+-----
sepal_length|float
sepal_width |float
petal_length|float
petal_width |float

===============
Additional Info
===============
Name              |Value
------------------+-----
tree_count        | 100
rejected_row_count|  0
accepted_row_count| 150
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Apply the classifier to the test data with 
&lt;code&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;/code&gt;:&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;rf_iris&amp;#39;) FROM iris1;

PREDICT_RF_CLASSIFIER
-----------------------
setosa
setosa
setosa
.
.
.
versicolor
versicolor
versicolor
.
.
.
virginica
virginica
virginica
.
.
.
(90 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Use 
&lt;code&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;/code&gt; to view the probability of each class:&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;rf_iris&amp;#39;) OVER () FROM iris1;
predicted  |    probability
-----------+-------------------
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |                 1
setosa     |              0.99
.
.
.
(90 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;

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