Support Vector Machine Action Set

Support Vector Regression

This section contains PROC CAS code.

Note: Input data must be accessible in your CAS session, either as a CAS table or as a transient-scope table. A CAS table has a two-level name: the first level is your CAS engine libref, and the second level is the table name. You refer to this table in the CAS procedure by specifying only the second level. For more information about two-level names, see Chapter 2, Shared Concepts (SAS Visual Data Mining and Machine Learning: Procedures). A transient-scope table is called directly from the action and exists in memory for the duration of the action. For more information about accessing data, see SAS Viya: System Programming Guide. For more information about PROC CAS and programming in CASL, see SAS Cloud Analytic Services: CASL Programmer’s Guide and SAS Cloud Analytic Services: CASL Reference.

This example illustrates support vector regression training and uses the same German Credit Benchmark data that are used in Example 28.1. The following statements indicate that the target is an interval variable and the insensitive loss parameter epsilon is 5.0:

proc cas;
    action svm.svmtrain /
        table="dmagecr"
        epsilon=5.0
        nominals={"checking" "history" "purpose" "savings" "employed"
                   "marital" "coapp" "property" "other" "job" "housing"
                   "telephon" "foreign"}
        inputs={"duration" "installp" "resident" "existcr"
                "depends" "age" "checking" "history" "purpose" "savings"
                "employed" "marital" "coapp" "property" "other" "job"
                "housing" "telephon" "foreign"}
        target="amount";
run;
quit;

The "Model Information" table and the "Training Results" table are shown in Output 28.2.1 and Output 28.2.2.

Output 28.2.1: SVR Model Information

Results from svm.svmTrain

Model Information
Task TypeESP_REG
Optimization TechniqueInterior Point
ScaleNO
Kernel FunctionLinear
Penalty MethodC
Penalty Parameter1
Insensitive Loss Parameter5
Maximum Iterations25
Tolerance1e-06


Output 28.2.2: SVR Training Result

Training Results
Inner Product of Weights128231.898
Bias912.616613
Total Slack (Constraint Violations)1298997.98
Norm of Longest Vector87.2467764
Mean Squared Error4483863.04
Number of Effects19
Columns in Data Matrix60


Support Vector Regression

This section contains Lua code for the analysis in the CASL version of this example, which contains details about the results.

Note: In order to run this code, the data that are described in the CASL version need to be accessible to the CAS server. One way to do this is to convert the dmagecr data to the comma-separated-value (CSV) file dmagecr.csv and then use the following code to load the CSV file into CAS:

s:loadtable{casLib="casuser", path="dmagecr.csv"}

For more information about coding in Lua, see Getting Started with SAS Viya for Lua and SAS Viya: System Programming Guide.

This example illustrates support vector regression training and uses the same German Credit Benchmark data that are used in Example 28.1. The following statements indicate that the target is an interval variable and the insensitive loss parameter epsilon is 5.0:

s:loadactionset{actionset="svm"}
out = s:svmtrain{
    table = "dmagecr",
    epsilon = 5.0,
    nominals = {"checking","history","purpose","savings","employed","marital",
                "coapp","property","other","job","housing","telephon", "foreign"},
    inputs = {"duration","installp","resident","existcr","depends",
               "age","checking","history","purpose","savings","employed",
               "marital","coapp","property","other","job","housing","telephon",
               "foreign"},
    target = "amount"
}

The following commands display the tables that are produced by this action call:

print(out.ModelInfo)
print(out.TrainingResult)

For details about the results of this analysis, see the CASL version of this example.

Support Vector Regression

This section contains Python code for the analysis in the CASL version of this example, which contains details about the results.

Note: In order to run this code, the data that are described in the CASL version need to be accessible to the CAS server. One way to do this is to convert the dmagecr data to the comma-separated-value (CSV) file dmagecr.csv and then use the following code to load the CSV file into CAS:

s.upload_file('dmagecr.csv')

For more information about coding in Python, see Getting Started with SAS Viya for Python and SAS Viya: System Programming Guide.

This example illustrates support vector regression training and uses the same German Credit Benchmark data that are used in Example 28.1. The following statements indicate that the target is an interval variable and the insensitive loss parameter epsilon is 5.0:

s.loadactionset("svm")
out=s.svmTrain(
     table = {"name":"dmagecr"},
     epsilon = 5.0,
     nominals = {"checking","history","purpose","savings","employed",
           "marital","coapp","property","other","job","housing",
                 "telephon","foreign"},
     inputs = {"duration","installp","resident","existcr",
               "depends","age", "checking","history","purpose","savings",
               "employed", "marital","coapp","property","other","job",
               "housing","telephon","foreign"},
     target = "amount"
)

The following commands display the tables that are produced by this action call:

print(out.ModelInfo)
print(out.TrainingResult)

For details about the results of this analysis, see the CASL version of this example.

Support Vector Regression

This section contains R code for the analysis in the CASL version of this example, which contains details about the results.

Note: In order to run this code, the data that are described in the CASL version need to be accessible to the CAS server. One way to do this is to convert the dmagecr data to the comma-separated-value (CSV) file dmagecr.csv and then use the following code to load the CSV file into CAS:

m <- cas.read.csv(s, "dmagecr.csv", casOut=list(name="dmagecr"))

For more information about coding in R, see Getting Started with SAS Viya for R and SAS Viya: System Programming Guide.

This example illustrates support vector regression training and uses the same German Credit Benchmark data that are used in Example 28.1. The following statements indicate that the target is an interval variable and the insensitive loss parameter epsilon is 5.0:

result<-cas.svm.svmTrain(s,
     table    = "dmagecr",
     epsilon  = 5.0,
     nominals = list("checking", "history", "purpose", "savings", "employed",
                     "marital", "coapp", "property", "other", "job", "housing",
                     "telephon", "foreign"),
     inputs   = list("duration", "installp", "resident",
                     "existcr", "depends", "age", "checking",
                     "history", "purpose", "savings", "employed",
                     "marital", "coapp", "property", "other",
                     "job", "housing", "telephon", "foreign"),
     target   = "amount")

The following command displays the tables that are produced by this action call:

print(result)

For details about the results of this analysis, see the CASL version of this example.

Last updated: November 04, 2020