Typical workflow for SVM - 5.2 English - 68552

AOCL API Guide (68552)

Document ID
68552
Release Date
2025-12-29
Version
5.2 English

The standard way of computing SVM using AOCL-DA is as follows.

The following description relates to SVC but analogous steps can be applied to other SVM models.

  1. Initialize a aoclda.svm.SVC() object with options set in the class constructor.

  2. Compute SVM on your data using aoclda.svm.SVC.fit().

  3. Call aoclda.svm.SVC.predict() to evaluate the model on new data.

  4. Extract results from the aoclda.svm.SVC() object via its class attributes.

  1. Initialize a da_handle with da_handle_type da_handle_svm.

  2. Select the SVM model da_svm_model with da_svm_select_model_?.

  3. Pass data to the handle using da_svm_set_data_?.

  4. Customize the model using da_options_set_? (see below for a list of the available options).

  5. Compute the SVM using da_svm_compute_?.

  6. Evaluate the model on new data using da_svm_predict_?.

  7. Extract results using da_handle_get_result_?. The following results are available:

    • Total number of support vectors (da_svm_n_support_vectors), \((n_{\mathrm{support\_vectors}},\,)\). Integer.

    • Number of support vectors per class (da_svm_n_support_vectors_per_class). Vector of size \((n_{\mathrm{class}},\,)\).

    • Support vectors (da_svm_support_vectors): The subset of training samples that lie on or within the margin. Matrix of size \((n_{\mathrm{support\_vectors}},\, n_{\mathrm{features}})\).

    • Bias (intercept) (da_svm_bias): The bias term in the decision function. Vector of size \((n_{\mathrm{class}}-1,\,)\).

    • Dual coefficients (da_svm_dual_coef): \(\alpha\) in the dual problem. Weights assigned to each support vector, reflecting their importance in defining the optimal decision boundary. Matrix of size \((n_{\mathrm{support\_vectors}},\, n_{\mathrm{class}}-1)\).

    • Indexes to support vectors (da_svm_idx_support_vectors). Vector of size \((n_{\mathrm{support\_vectors}},\,)\).

    • Number of iterations (da_svm_n_iterations). In this context it counts the number of SMO subproblems solved, for each classifier. Vector of size \((n_{\mathrm{classifiers}},\,)\).

    • Some solvers provide extra information. da_result_::da_rinfo, when available, contains the info[100] array with the following values:

      • info[0]: number of rows in the input matrix,

      • info[1]: number of columns in the input matrix,

      • info[2]: number of detected classes, for regression returns 2,

      • info[3-99]: reserved for future use.