# SVM classification (/docs/analyses/svm-classification)



## When to use it [#when-to-use-it]

Use SVM classification when the outcome is a category and you want a holdout confusion matrix without trees. Random forest of the same problem is [random forest classification](/docs/analyses/random-forest-classification).

## Assumptions [#assumptions]

The outcome is categorical. Features are numeric. Classes with fewer than two rows are dropped. Kernel, C, and class weights are not exposed. Holdout fraction 0.25; HTTP and chat dispatch both honour `test_fraction`.

## Running it in Tensr [#running-it-in-tensr]

<Steps>
  <Step>
    ML → Classification → Support Vector Machines (Classification). In chat: “SVM of passed on hours and anxiety.”
  </Step>

  <Step>
    Target is the categorical column. Features need at least one numeric column.
  </Step>
</Steps>

## Options [#options]

<TypeTable
  type="{
  dependent: {
    type: 'string',
    description: 'Categorical outcome.',
  },
  independents: {
    type: 'string[]',
    description: 'Numeric features. At least one.',
  },
  test_fraction: {
    type: '0.05–0.5',
    description: 'Holdout fraction, clamped to 0.10–0.50. HTTP and chat dispatch both honour it. A note is added when the value is clamped.',
    default: '0.25',
  },
  decimal_places: {
    type: '0–6',
    description: 'Report output. Decimal places.',
    default: '3',
  },
  apa_format: {
    type: 'boolean',
    description: 'Report output. APA-style p-values.',
    default: 'true',
  },
  include_charts: {
    type: 'boolean',
    description: 'Report output. ROC when the outcome has two classes.',
    default: 'true',
  },
}"
/>

## Reading the output [#reading-the-output]

The same strong pass/fail sample and the same two features. Kernel and C are not user controls.

| Actual \ Predicted |  0 |  1 |
| -----------------: | -: | -: |
|                  0 | 30 |  3 |
|                  1 | 13 | 14 |

Train accuracy = 0.722, test accuracy = 0.733, n = 240. Hours was built to move the pass rate strongly, so holdout accuracy should sit clearly above chance.

## Reporting (APA 7) [#reporting-apa-7]

Holdout classification of `passed` from hours and anxiety, n = 240. Test accuracy = 0.733, train accuracy = 0.722.

## Coming from SPSS [#coming-from-spss]

SPSS has no SVM dialog. Tensr’s item is on the ML menu, Classification → Support Vector Machines (Classification). The path string stored for this item says ML → Classification → SVM.

## Related [#related]

[Random forest classification](/docs/analyses/random-forest-classification) and [gradient boosting](/docs/analyses/gradient-boosting) are the tree ensembles.
