MLPHyperparameters
VariantMultilayer perceptron (torch). See `setup_MLP`.
Properties
hidden_unitsinteger[] | object | null≥ 1 itemsUnits in each hidden layer, one value per layer, so the length is the depth. NULL generates the widths from the shape settings.
shapestring | object | nullProfile of the generated hidden layer widths. Ignored when hidden_units is set.
one of
"funnel""constant""triangle""long_funnel""diamond""hexagon""stairs"shape_layersinteger | object | null≥ 1Number of hidden layers to generate. Ignored when hidden_units is set.
shape_max_unitsinteger | object | null≥ 1Widest generated hidden layer. NULL derives it from the encoded input width. Ignored when hidden_units is set.
activationstring | objectActivation applied after every hidden layer.
one of
"relu""gelu""silu""elu""selu""leaky_relu""tanh"normstring | object | nullNormalization applied in every hidden layer. NULL applies none.
one of
"batch_norm""layer_norm"norm_firstbooleanNormalize before the activation rather than after it.
biasbooleanGive every hidden layer and the output layer a bias term.
residualboolean | objectAdd a residual connection around every hidden layer, projected when the layer changes width.
dropoutnumber | object≥ 0< 1Dropout probability applied after every hidden layer.
input_dropoutnumber | object≥ 0< 1Dropout probability applied to the encoded input.
weight_decaynumber | object≥ 0L2 penalty, decoupled from the gradient under the adamw optimizer.
l1_penaltynumber | object≥ 0L1 penalty on the linear weights, added to the loss. Not interchangeable with weight_decay, which is L2.
embeddingsbooleanRepresent each categorical feature by a learned embedding. FALSE one-hot encodes them instead.
embedding_diminteger | object | null≥ 1Width of every embedding. NULL sizes each from its feature's cardinality.
embedding_dropoutnumber | object≥ 0< 1Dropout probability applied to the concatenated embeddings.
optimizerstring | objectOptimization algorithm.
one of
"adamw""adam""sgd""rmsprop"lrnumber | object> 0Learning rate.
beta1number | null≥ 0< 1Exponential decay rate of the first moment estimate. NULL leaves the torch default. Applies only when optimizer is adamw or adam.
beta2number | null≥ 0< 1Exponential decay rate of the second moment estimate. NULL leaves the torch default. Applies only when optimizer is adamw or adam.
epsnumber | null> 0Term added to the denominator for numerical stability. NULL leaves the torch default. Applies only when optimizer is adamw, adam or rmsprop.
momentumnumber | null≥ 0Momentum factor. NULL leaves the torch default. Applies only when optimizer is sgd or rmsprop.
lr_schedulerstring | nullLearning-rate schedule, configured from the epoch budget. NULL holds the learning rate fixed.
one of
"step""cosine_annealing""one_cycle""reduce_on_plateau"nullbatch_sizeinteger | object≥ 1Cases per optimization step.
max_epochsinteger | object≥ 1Largest number of passes over the training set.
patienceinteger≥ 1Epochs without validation improvement before stopping early. Requires validation data; without it the fit runs the full epoch budget.
max_grad_normnumber | object | null> 0Clip the gradient norm to this value before each step. NULL does not clip.
lossstring | nullTraining objective. NULL = set from outcome type.
one of
"mse""l1""smooth_l1""cross_entropy"nulldevicestring | nullCompute device. On mps a seed does not reach dropout, so a fit using it is not reproducible; the run says so.
one of
"cpu""cuda""mps"nullseedinteger | nullRandom seed for weight initialization, dropout and batch shuffling. NULL leaves them drawn from the ambient RNG.
num_workersinteger≥ 0Subprocesses used to load batches. 0 loads them in the main process.
drop_lastbooleanDrop the last incomplete batch of each training epoch.
ifwboolean | objectInverse Frequency Weighting in classification.
Relationships
Used by