<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – SVM (support vector machine) for classification</title>
    <link>/en/data-analysis/ml-predictive-analytics/classification-algorithms/svm-support-vector-machine-classification/</link>
    <description>Recent content in SVM (support vector machine) 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/svm-support-vector-machine-classification/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Data-Analysis: Classifying data using SVM (support vector machine)</title>
      <link>/en/data-analysis/ml-predictive-analytics/classification-algorithms/svm-support-vector-machine-classification/classifying-data-using-svm-support-vector-machine/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/data-analysis/ml-predictive-analytics/classification-algorithms/svm-support-vector-machine-classification/classifying-data-using-svm-support-vector-machine/</guid>
      <description>
        
        
        &lt;p&gt;This SVM example uses a small data set named mtcars. The example shows how you can use the SVM_CLASSIFIER function to train the model to predict the value of &lt;code&gt;am&lt;/code&gt; (the transmission type, where 0 = automatic and 1 = manual) using the PREDICT_SVM_CLASSIFIER function.&lt;/p&gt;
Before you begin the example, &lt;a href=&#34;../../../../../en/data-analysis/ml-predictive-analytics/download-ml-example-data/&#34;&gt;load the Machine Learning sample data&lt;/a&gt;.
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create the SVM model, named &lt;code&gt;svm_class&lt;/code&gt;, using the &lt;code&gt;mtcars_train&lt;/code&gt; training data.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; SELECT SVM_CLASSIFIER(&amp;#39;svm_class&amp;#39;, &amp;#39;mtcars_train&amp;#39;, &amp;#39;am&amp;#39;, &amp;#39;cyl, mpg, wt, hp, gear&amp;#39;
                          USING PARAMETERS exclude_columns=&amp;#39;gear&amp;#39;);
SVM_CLASSIFIER
----------------------------------------------------------------
Finished in 12 iterations.
Accepted Rows: 20  Rejected Rows: 0
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;View the summary output of 
&lt;code&gt;`svm_class`&lt;/code&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;svm_class&amp;#39;);
------------------------------------------------------------------------

=======
details
=======
predictor|coefficient
---------+-----------
Intercept| -0.02006
cyl      |  0.15367
mpg      |  0.15698
wt       | -1.78157
hp       |  0.00957

===========
call_string
===========
SELECT svm_classifier(&amp;#39;public.svm_class&amp;#39;, &amp;#39;mtcars_train&amp;#39;, &amp;#39;&amp;#34;am&amp;#34;&amp;#39;, &amp;#39;cyl, mpg, wt, hp, gear&amp;#39;
USING PARAMETERS exclude_columns=&amp;#39;gear&amp;#39;, C=1, max_iterations=100, epsilon=0.001);

===============
Additional Info
===============
Name              |Value
------------------+-----
accepted_row_count| 20
rejected_row_count|  0
iteration_count   | 12
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a new table, named &lt;code&gt;svm_mtcars_predict&lt;/code&gt;. Populate this table with the prediction outputs you obtain from running the &lt;code&gt;PREDICT_SVM_CLASSIFIER&lt;/code&gt; function on your test data.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE TABLE svm_mtcars_predict AS
   (SELECT car_model, am, PREDICT_SVM_CLASSIFIER(cyl, mpg, wt, hp
                                            USING PARAMETERS model_name=&amp;#39;svm_class&amp;#39;)
                                            AS Prediction FROM mtcars_test);
CREATE TABLE
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;View the results in the &lt;code&gt;svm_mtcars_predict&lt;/code&gt; table.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT * FROM svm_mtcars_predict;
car_model     | am | Prediction
------------- +----+------------
Toyota Corona |  0 |          1
Camaro Z28    |  0 |          0
Datsun 710    |  1 |          1
Valiant       |  0 |          0
Volvo 142E    |  1 |          1
AMC Javelin   |  0 |          0
Honda Civic   |  1 |          1
Hornet 4 Drive|  0 |          0
Maserati Bora |  1 |          1
Merc 280      |  0 |          0
Merc 450SL    |  0 |          0
Porsche 914-2 |  1 |          1
(12 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Evaluate the accuracy of the &lt;code&gt;PREDICT_SVM_CLASSIFIER&lt;/code&gt; function, using the &lt;a href=&#34;../../../../../en/sql-reference/functions/ml-functions/model-evaluation/confusion-matrix/#&#34;&gt;CONFUSION_MATRIX&lt;/a&gt; evaluation function.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT CONFUSION_MATRIX(obs::int, pred::int USING PARAMETERS num_classes=2) OVER()
        FROM (SELECT am AS obs, Prediction AS pred FROM svm_mtcars_predict) AS prediction_output;
 class | 0 | 1 |                   comment
-------+---+---+---------------------------------------------
     0 | 6 | 1 |
     1 | 0 | 5 | Of 12 rows, 12 were used and 0 were ignored
(2 rows)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In this case, &lt;code&gt;PREDICT_SVM_CLASSIFIER&lt;/code&gt; correctly predicted that the cars with a value of &lt;code&gt;1&lt;/code&gt; in the &lt;code&gt;am&lt;/code&gt; column have a value of &lt;code&gt;1&lt;/code&gt;. No cars were incorrectly classified. Out of the seven cars which had a value of &lt;code&gt;0&lt;/code&gt; in the &lt;code&gt;am&lt;/code&gt; column, six were correctly predicted to have the value &lt;code&gt;0&lt;/code&gt;. One car was incorrectly classified as having the value &lt;code&gt;1&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&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/#&#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/transformation-functions/predict-svm-classifier/#&#34;&gt;PREDICT_SVM_CLASSIFIER&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

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