# Neural network (MLP) (/docs/analyses/neural-network-mlp)



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

Use the MLP when you want a small neural net on tabular data, as classification or regression. Trees with readable importances are [gradient boosting](/docs/analyses/gradient-boosting) or [random forest](/docs/analyses/random-forest-classification).

## Assumptions [#assumptions]

Hidden-layer size is not a user control. The fit uses two hidden layers of 64 and 32 units. This run also prints permutation importances. Holdout fraction 0.25; HTTP and chat dispatch both honour `test_fraction`.

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

<Steps>
  <Step>
    ML → Classification → Neural Network MLP (Classification), or ML → Regression → Neural Network MLP (Regression). In chat: “MLP of passed on hours and anxiety.”
  </Step>

  <Step>
    Set mode to classification or regression. Target matches that mode. Features need at least one numeric column.
  </Step>
</Steps>

## Options [#options]

<TypeTable
  type="{
  dependent: {
    type: 'string',
    description: 'Outcome. Categorical in classification mode, numeric in regression mode.',
  },
  independents: {
    type: 'string[]',
    description: 'Numeric features. At least one.',
  },
  mode: {
    type: 'classification | regression',
    description: 'Which holdout metrics to compute.',
    default: 'classification',
  },
  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. Loss curve, plus a confusion matrix or predicted-versus-actual plot.',
    default: 'true',
  },
}"
/>

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

The same strong pass/fail sample, classification mode, hidden layers 64 and 32, 25% holdout.

| Actual \ Predicted |  0 |  1 |
| -----------------: | -: | -: |
|                  0 | 25 |  8 |
|                  1 | 11 | 16 |

| Variable | Importance |
| -------- | ---------: |
| hours    |      0.193 |
| anxiety  |     -0.018 |

Train accuracy = 0.856, test accuracy = 0.683, 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.683, train accuracy = 0.856.

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

SPSS Neural Networks is Analyze → Neural Networks. Tensr’s items are on the ML menu. The path string stored for this item says ML → Neural Network. Hidden layers are not a dialog control.

## Related [#related]

[Gradient boosting](/docs/analyses/gradient-boosting) is the tree ensemble with the same mode switch.
