Configuration keys¶
Every key of the configuration schema, torchsonn.config.SONNConfig,
grouped by what it controls. A configuration is the schema's defaults with
your changes merged in (see Configuration). In
YAML, null stands for no value.
Two tables at the end list what the schema leaves open: the options of a
model.ref_functions entry, and the keys of
train.optimizer.optimizer_params.
Model type and output¶
| Key | Type | Default | Meaning |
|---|---|---|---|
model.type |
str | multi-class |
regressor, binary or multi-class. Sets the training loss, the criterion and what infer returns. |
model.num_classes |
int | 3 | Number of classes. Must be 2 for binary and more than 2 for multi-class. |
model.use_output_projection |
bool | false | Add a linear head over the last layer's survivors; fit it with Trainer.train_out_proj. Regression and multi-class only: a binary model ignores it. See Heads and fine-tuning. |
model.num_out_neurons |
int | null | How many of the last layer's survivors the head reads, best first. Null reads model.nbest_neurons, every survivor. A head that reads more columns than the layer has gets zeros for the rest. |
model.output_clamp_value |
float | 1000.0 | Every layer's outputs are clamped to ±this value before the next layer reads them. |
model.use_layer_norm |
bool | false | Apply a LayerNorm without learned parameters to each layer's input, after the outputs and features are concatenated. Trainer.prune refuses such a model (see Pruning). |
Neuron families and layer inputs¶
| Key | Type | Default | Meaning |
|---|---|---|---|
model.ref_functions |
list | [linear_cov] |
The neuron families. Each entry is a family name or a name with a mapping of options; see Neuron family options and Neuron families. |
model.nbest_neurons |
int | null, required | Survivors per layer. Must be at least 2. See Survivor selection. |
model.max_neuron_models |
int | null | The most candidates a family tries per layer. Above it, a random subset is drawn from the seeded generator. Null tries every pair or tuple. |
model.shortcut |
bool or mapping | {raw_features: true, prev_layers: null} |
What feeds every layer after the first, besides the previous layer. true and false are short for raw_features: true or false with prev_layers: null. |
model.shortcut.raw_features |
bool | true | Feed the model's input features to every layer. |
model.shortcut.prev_layers |
int, all or null |
null | Also feed the outputs of this many layers before the previous one; null feeds none, all every earlier layer. See The algorithm. |
Orthogonal-family squash¶
Defaults for the legendre and chebyshev families, and for the mlp
family when an entry turns its squash on; an entry can override each one. See Orthogonal polynomials.
| Key | Type | Default | Meaning |
|---|---|---|---|
model.squash_method |
str | sigma |
sigma: linear within a band around the input's mean, saturating beyond. tanh: the hyperbolic tangent, no statistics needed. |
model.squash_n_sigma |
float | 2.0 | Half-width of the linear band, in standard deviations. sigma only. |
model.squash_core_range |
float | 0.75 | Squashed value at the edge of the band; between 0 and 1. sigma only. |
Multi-class heads¶
How a multi-class neuron's single output becomes class scores. See Classification.
| Key | Type | Default | Meaning |
|---|---|---|---|
model.soft_binner |
bool | true | Score each class by how close the neuron's output lies to a fixed point for that class, between 0.05 and 0.95 in label order. Cannot be combined with model.use_neuron_proj. |
model.soft_binner_scale |
float | 100.0 | Sharpness of the soft binner: a class's score is minus this value times the squared distance to its point. |
model.use_neuron_proj |
bool | false | Give every candidate its own linear map from its output to the class scores. Needs model.soft_binner: false. With both off, the candidates of a layer share one learned map. |
train.shared_proj_lr_multiplier |
float | 0.1 | Learning-rate factor for that shared map, relative to the candidates' learning rate. |
Criterion¶
See Criteria.
| Key | Type | Default | Meaning |
|---|---|---|---|
train.criterion_type |
str | validate |
validate: regularity error on dev. bias: disagreement between fits on the even and odd training rows; the survivors are fitted on the whole train split, as under the others. validate_bias: a mix of the two. Any other value raises ValueError when the model is built. See Criteria. |
train.error_alpha |
float | 0.5 | Weight of the regularity error in validate_bias; the bias error gets 1 minus this. |
train.bias_ce_type |
str | js |
Multi-class bias error: js (Jensen-Shannon divergence) or l2 (squared difference of the class scores). |
train.error_normalization |
str | variance |
Denominator of the regression criteria and training loss: variance (spread around the mean) or energy (sum of squared targets). |
train.layer_err_criterion |
str | top |
A layer's error: the best survivor's criterion value (top) or the survivors' mean (avg). |
train.layer_err_source |
str | neuron |
neuron: the survivors' own criterion values. readout: the dev loss of a linear head over all survivors; needs model.use_output_projection: true; regression models only. |
Growth rule¶
See Splits and stopping.
| Key | Type | Default | Meaning |
|---|---|---|---|
train.max_layer_count |
int | 999 | The most layers the search builds. |
train.layer_keep |
str | best |
Which layers the model keeps once the search ends: best keeps the layers up to the one with the lowest layer error, all every layer built. With all, set train.max_layer_count to the depth wanted: the search still stops only at that limit or by the growth rule, and every layer it built is kept. |
train.criterion_minimum_width |
int | 5 | Stop after this many layers in a row without an improvement. |
train.stop_train_epsilon_condition |
float | 0.001 | Relative part of the improvement margin: this fraction of the best layer error so far. |
train.stop_train_min_delta |
float | 0.0 | Absolute part of the improvement margin, in units of the layer error. The margin is the larger of the two. Set it near the noise level of the dev error. |
train.stop_source |
str | dev |
The split the growth rule and the end-to-end pass's early stop read: dev, or val for the validation loader passed as val_dl (required then). |
Survivor selection¶
See Survivor selection.
| Key | Type | Default | Meaning |
|---|---|---|---|
train.neuron_selection_method |
str | omp_mixed |
plain: the lowest criterion values. greedy_orth: in order of criterion value, skipping candidates whose dev outputs the survivors already explain. max_volume: greedy maximum volume on the dev outputs, ignoring the criterion. omp: orthogonal matching pursuit of the dev targets by the dev outputs, ignoring the criterion. omp_mixed: omp for all but train.neuron_selection_reserve_frac of the survivors, then max_volume for the rest, ignoring the criterion. |
train.neuron_selection_orth_threshold |
float | 0.05 | greedy_orth and omp_mixed keep a candidate only when at least this fraction of its output's norm remains after removing the survivors' directions. |
train.neuron_selection_min_gain |
float | 0.001 | After the first survivor, omp stops once the best candidate explains less than this fraction of the dev target's centered energy, so a layer can keep fewer than model.nbest_neurons. omp_mixed ends its omp phase by the same rule and fills the remaining slots with max_volume. |
train.neuron_selection_reserve_frac |
float | 0.2 | omp_mixed: the fraction of model.nbest_neurons filled by max_volume after the omp phase. 0.0 is pure omp, 1.0 pure max_volume. |
train.log_layer_diagnostics |
bool | false | Log the survivors' correlations, top singular values and effective rank on dev after each layer; one extra pass over dev. |
Candidate fit¶
How each candidate's coefficients are fitted on the train split. See The algorithm and Optimizers.
| Key | Type | Default | Meaning |
|---|---|---|---|
train.optimizer.name |
str | adam |
The batched optimizer: adam, sgd or lbfgs. Any other name raises ValueError when the Trainer is built. |
train.optimizer.optimizer_params |
mapping | {lr: 1e-4, min_lr: 1e-5, gamma: 0.5, clip_value: 1.0, clip_norm: 5.0} |
Learning-rate schedule of the early stop and the optimizer's own arguments; see Optimizer parameters. |
train.optimizer.verbose |
bool | true | Show a progress bar for each family's fit. |
train.steps |
int | 1000 | The most optimizer steps per family fit; a fit that does not stop early runs exactly this many. |
train.ridge_alpha |
float | 0.0 | L2 penalty on each candidate's neuron coefficients, added to the training loss only. |
train.censor_target_at |
float | null | Regression targets at or above this value count as "at least this much": the training loss clips the prediction to it on those rows. The criteria are unchanged. |
train.divergence_threshold |
float | infinity | A candidate whose evaluated loss exceeds this stops at once. Infinity turns the check off; a NaN loss always stops the candidate. |
Candidate fit: evaluation and early stop¶
See Splits and stopping.
| Key | Type | Default | Meaning |
|---|---|---|---|
train.eval_step_interval |
int | 1000 | Evaluate every candidate every this many steps; -1 evaluates at the end of each pass over the loader. The early stop acts only at evaluations. |
train.eval_smoothing_factor |
float | 0.2 | Weight of the newest evaluation in the exponential moving average of the loss. |
train.early_stop_source |
str | dev |
The loss the early stop reads: the dev split (dev) or the current training batch (train). |
train.early_stop_patience |
float | 1e-4 | The smallest drop in the smoothed loss that counts as an improvement, in absolute units. |
train.early_stop_tolerance_steps |
int | 10 | Evaluations without an improvement before the learning rate drops; once it is at min_lr, before the candidate stops. |
train.early_stop_completion_percentage |
int | 100 | End the family's fit once more than this percentage of its candidates have stopped; at 100, only when all have. |
train.eval_display_interval |
int | 1 | Refresh the progress bar's numbers every this many evaluations. Does not affect training. |
Input pass and RBF placement¶
See Gaussian RBF.
| Key | Type | Default | Meaning |
|---|---|---|---|
train.input_sample_rows |
int | 65536 | The most rows sampled from the train split for RBF placement. |
train.rbf_kmeans_mode |
str | auto |
sample: k-means on the sample. stream: the start on the sample, then mini-batch k-means over the whole split. auto: stream when the split has more rows than the sample holds, else sample. |
train.rbf_kmeans_iters |
int | 20 | Lloyd iterations of k-means on the sample. |
train.rbf_kmeans_passes |
int | 1 | Passes of streaming k-means over the split. |
Head fit and per-layer fine-tune¶
train.out_proj_train configures Trainer.train_out_proj (the head fit)
and the per-layer fine-tune. See
Heads and fine-tuning.
| Key | Type | Default | Meaning |
|---|---|---|---|
train.layer_finetune |
bool | false | After selection, train each layer's survivors jointly through a temporary linear head, on every layer. Under model.selection_mode: joint it runs after the joint cut. Use it with model.use_output_projection: the pass turns the survivors into inputs for a head, and a model without one predicts poorly. Fails on binary models. |
train.layer_finetune_weight_decay |
float or null | null | The weight decay of the per-layer fine-tune alone; every other fine-tune setting comes from train.out_proj_train. null uses train.out_proj_train.weight_decay. Set it to regularize the layers and the final head differently. |
train.out_proj_train.optimizer |
str | adam |
adam, adamw, sgd (momentum 0.9) or lbfgs (full batch, no plateau schedule). |
train.out_proj_train.lr |
float | 0.001 | Learning rate. |
train.out_proj_train.weight_decay |
float | 0.0 | Weight decay. adam and sgd add it to the gradient, adamw applies it to the weights directly, lbfgs adds an L2 penalty to the loss, so a value tuned for one optimizer does not carry over to another. |
train.out_proj_train.max_steps |
int | 5000 | The most steps; for lbfgs, outer steps. |
train.out_proj_train.eval_interval |
int | 100 | Evaluate on the dev split every this many steps. |
train.out_proj_train.early_stop_patience |
int | 10 | Stop after this many evaluations without an improvement. |
train.out_proj_train.early_stop_min_delta |
float | 1e-4 | The smallest drop in dev loss that counts as an improvement. |
train.out_proj_train.keep_best_weights |
bool | false | End the head fit and the per-layer fine-tune on the weights of their lowest dev loss instead of their last step. See Last step or best evaluation. |
train.out_proj_train.best_weights_copy |
str | device |
Where keep_best_weights keeps the copy of the best weights: device (next to the parameters, in GPU memory on CUDA), cpu (host memory) or disk (a file in the run folder, deleted when the pass ends). |
train.out_proj_train.dropout |
float | 0.0 | Dropout on the head's inputs at every training step of the head fit and the per-layer fine-tune; evaluations see the full inputs. Needs a minibatch optimizer, not lbfgs. |
train.out_proj_train.lr_patience |
int | 5 | Evaluations without improvement before the plateau schedule cuts the learning rate. Not used by lbfgs. |
train.out_proj_train.lr_factor |
float | 0.5 | Factor of each cut. Not used by lbfgs. |
train.out_proj_train.lr_min |
float | 1e-5 | Lowest learning rate of the plateau schedule. Not used by lbfgs. |
train.out_proj_train.lbfgs_history_size |
int | 20 | lbfgs only: correction pairs kept. |
train.out_proj_train.lbfgs_max_iter |
int | 20 | lbfgs only: inner iterations per step. |
train.out_proj_train.lbfgs_line_search |
str | strong_wolfe |
lbfgs only: the line search; empty for none. |
train.out_proj_train.lbfgs_chunk_size |
int or null | null | lbfgs only: evaluate the full-batch loss in chunks of this many rows, summing their gradients, to bound the memory of the per-layer fine-tune on a large split. The loss and gradient are the same as in one shot; null evaluates in one shot. Ignored, with a warning, for a regression loss without a fitted target scale. |
train.out_proj_train.cuda_graph |
bool | true | No effect here; used by the end-to-end pass. |
train.out_proj_train.data_on_device |
str | auto |
No effect here; used by the end-to-end pass. |
End-to-end pass¶
train.finetune_train configures Trainer.train_finetune, which trains
every parameter at once. It has the same keys as train.out_proj_train;
the optimizers differ and two keys only matter here.
| Key | Type | Default | Meaning |
|---|---|---|---|
train.finetune_train.optimizer |
str | adam |
adam, adamw or sgd (momentum 0.9). |
train.finetune_train.lr |
float | 0.001 | Learning rate. A whole-network pass usually wants a much smaller one than the head fit. |
train.finetune_train.weight_decay |
float | 0.0 | Weight decay of the optimizer. |
train.finetune_train.max_steps |
int | 5000 | The most steps. |
train.finetune_train.eval_interval |
int | 100 | Evaluate every this many steps, on dev (or the validation split under train.stop_source: val). |
train.finetune_train.early_stop_patience |
int | 10 | Stop after this many evaluations without an improvement. |
train.finetune_train.early_stop_min_delta |
float | 1e-4 | The smallest drop in loss that counts as an improvement. |
train.finetune_train.keep_best_weights |
bool | false | End the pass on the parameters of its lowest evaluated loss instead of its last step. See Last step or best evaluation. |
train.finetune_train.best_weights_copy |
str | device |
Where keep_best_weights keeps the copy of the whole model's parameters: device, cpu or disk, as for the head fit. |
train.finetune_train.dropout |
float | 0.0 | Dropout on the head's inputs at every training step of the end-to-end pass. The pass then runs without the CUDA graph. |
train.finetune_train.lr_patience |
int | 5 | Evaluations without improvement before the plateau schedule cuts the learning rate. |
train.finetune_train.lr_factor |
float | 0.5 | Factor of each cut. |
train.finetune_train.lr_min |
float | 1e-5 | Lowest learning rate of the plateau schedule. |
train.finetune_train.lbfgs_history_size |
int | 20 | No effect: the end-to-end pass does not use LBFGS. |
train.finetune_train.lbfgs_max_iter |
int | 20 | No effect, as above. |
train.finetune_train.lbfgs_line_search |
str | strong_wolfe |
No effect, as above. |
train.finetune_train.lbfgs_chunk_size |
int or null | null | No effect, as above. |
train.finetune_train.cuda_graph |
bool | true | On a CUDA device with adam or adamw, capture the training step once as a CUDA graph and replay it; much faster for these small models. |
train.finetune_train.data_on_device |
str | auto |
With the CUDA graph: keep the training split on the device (true), stream it from the loader (false), or keep it when it fits in a quarter of the free memory (auto). |
Calibration¶
Trainer.train_calibration fits a calibration of a multi-class model's
probabilities on the dev split. See
Calibration.
| Key | Type | Default | Meaning |
|---|---|---|---|
train.calibration |
str or null | null | temperature (one scale of the log-probabilities; the predicted classes do not change), vector (a scale and a shift per class) or null (off). Multi-class only; any other value, or a value on another model type, raises ValueError when the Trainer is built. |
Joint selection¶
With model.selection_mode: joint, Trainer.train grows the network
layer by layer as in greedy mode, but chooses each layer's survivors
differently: it fits the candidates on their own, trains a pool of them
together with a temporary head under a sparsity penalty that removes whole
neurons (the earlier layers stay frozen), and cuts the layer to
model.nbest_neurons of the neurons left. By default the penalty's weight
is steered so that the pass ends with that many neurons active, or a few
more. The growth rule scores each layer by train.layer_err_source: its
survivors' own dev errors after the pass (neuron) or the dev loss of a
head over them (readout). When growth stops, the output head is fitted
over the last layer. train.joint_sparsity configures the penalty and the
pass; train.max_layer_count: 1 builds one layer.
| Key | Type | Default | Meaning |
|---|---|---|---|
model.selection_mode |
str | greedy |
greedy: grow the network layer by layer, keeping the best candidates of each. joint: each layer's survivors selected jointly, as above. joint_last: greedy at every layer; once growth stops, the last kept layer is built again and selected jointly. joint and joint_last need model.use_output_projection, a regressor or multi-class model and no model.use_layer_norm, and does not resume a run. |
train.joint_sparsity.kind |
str | gates |
gates: a hard-concrete gate on each neuron's output, with the expected number of open gates as the penalty (Louizos, Welling and Kingma, 2018). group_lasso: the sum over neurons of the L2 norm of each neuron's coefficients together with its column of the head. |
train.joint_sparsity.beta |
float | 0.66 | gates only: temperature of the gate distribution. Must be positive. |
train.joint_sparsity.gamma |
float | -0.1 | gates only: lower end of the interval the gate's sigmoid is stretched to before it is clamped to [0, 1]. Must be negative. |
train.joint_sparsity.zeta |
float | 1.1 | gates only: upper end of that interval. Must be above 1. |
train.joint_sparsity.init_open |
float | 0.9 | gates only: starting probability of the gate's sigmoid sample, in (0, 1). At 0.9 every gate starts nearly open. |
train.joint_sparsity.lam |
float | 0.001 | Weight of the penalty: the loss is the data loss plus lam times the expected number of open gates (gates) or the sum of the group norms (group_lasso). |
train.joint_sparsity.diversity_lam |
float | 0.0 | Weight of a diversity term added to the loss: the mean squared correlation between the pool's neuron outputs on the batch, each pair weighted by the product of the two neurons' gates (gates) or of the norms of their head columns (group_lasso). It pushes the kept neurons apart. 0 turns it off. At least 0. |
train.joint_sparsity.diversity_tau |
float | 0.0 | Correlations up to this in absolute value add nothing to the diversity term. In [0, 1). |
train.joint_sparsity.lam_warmup_frac |
float | 0.1 | lam rises linearly from 0 over this fraction of max_steps, so the pool fits before the penalty presses on it. |
train.joint_sparsity.lam_control |
str | adaptive |
How lam moves after the warm-up, against the target, the head's width. fixed: it stays at lam and the pass runs max_steps. anneal: at every evaluation where more than target × (1 + count_margin) neurons are active and neither the count nor the penalty (by 1%) has fallen since the previous one, it is multiplied by lam_step. adaptive: as anneal, and divided by lam_step while fewer than the target are active. Under both the pass stops once the count has stayed between the target and target × (1 + count_margin) for count_patience evaluations; if it stays below the target that long, or is below it at max_steps, the pass goes back to the state with the fewest active neurons not below the target. |
train.joint_sparsity.lam_step |
float | 1.2 | Factor by which anneal and adaptive change lam at an evaluation. Above 1. |
train.joint_sparsity.count_margin |
float | 0.1 | How far above the target the active count may end, as a fraction of the target: the pass stops in [target, target × (1 + count_margin)] (rounded down). |
train.joint_sparsity.count_patience |
int | 3 | Evaluations in a row the count must stay in that band, or below the target, before the pass stops or goes back. |
train.joint_sparsity.prune_threshold |
float | 0.05 | A neuron counts as active while its deterministic gate (gates), or the norm of its head column over the norm it started the pass with (group_lasso), is above this. When the pass ends the others are removed. If more remain active than the head reads, the ones kept move the prediction most: the largest norm of their head column times the standard deviation of their output on dev. |
train.joint_sparsity.prefilter |
str | greedy_orth |
Which of a layer's candidates, each first fitted on its own, enter the pool: none every candidate with a finite fit; plain, greedy_orth, max_volume, omp or omp_mixed the prefilter_mult × model.nbest_neurons chosen by that selection method (see train.neuron_selection_method). |
train.joint_sparsity.prefilter_mult |
float | 10.0 | Pool size as a multiple of model.nbest_neurons, for a prefilter other than none. At least 1. |
train.joint_sparsity.lr |
float | 0.001 | AdamW learning rate of the pool's parameters and the head. |
train.joint_sparsity.gate_lr |
float | 0.01 | AdamW learning rate of the gates. It sets how fast a gate can close. |
train.joint_sparsity.weight_decay |
float | 1e-4 | AdamW weight decay of the pool's parameters and the head; the gates have none. |
train.joint_sparsity.max_steps |
int | 2000 | Steps of the pass. |
train.joint_sparsity.eval_interval |
int | 25 | Every this many steps, log lam, the data loss and the penalty, the loss on dev (or the validation split under train.stop_source: val) and the number of active neurons. |
train.joint_sparsity.restore_weights |
bool | false | true: the pass only selects the survivors. After the cut their coefficients go back to their own fits from before the pass, as a greedy layer keeps them. |
Checkpoints¶
| Key | Type | Default | Meaning |
|---|---|---|---|
train.checkpoint_dir |
str | checkpoints |
Parent of the run folders: every Trainer.train run writes its step checkpoints, model_last.ckpt and its log to <checkpoint_dir>/<YYYY-MM-DD-HH-MM-SS>/ (see Training). A relative path, the default included, is taken from the working directory. Empty raises ValueError when the Trainer is built. |
train.save_interval |
int | 1000 | Save a step checkpoint every this many steps of a family fit; -1 turns this off. |
train.skip_saving_at_epoch_end |
bool | true | Do not also save at the end of each pass over the training loader. |
train.save_last_layer |
bool | true | At the end of each family fit, also save a copy marked _last, which the step-checkpoint cleanup keeps. |
train.keep_last_n |
int | 10 | Keep this many of a run folder's most recent step checkpoints; nothing else in the folder is counted or deleted. |
Runtime¶
| Key | Type | Default | Meaning |
|---|---|---|---|
train.device |
str | cpu |
Where neurons are created and computed: cpu, cuda, cuda:1 and so on. |
train.seed |
int | 10 | Seed of the input pass's sampling and k-means, and of the output head's starting weights. Pass it to Trainer.set_seed, before building the model, to seed the rest. |
train.use_deterministic_algorithms |
bool | false | When the Trainer is built, switch PyTorch to deterministic kernels for the whole process (and set CUBLAS_WORKSPACE_CONFIG if it is unset), so runs on a GPU repeat; slower, and an operation without a deterministic kernel raises. False leaves PyTorch's setting alone. See Training. |
train.precompute_features |
bool | false | Run the frozen layers over each split once per layer and cache the result, instead of on every step. Faster; costs memory for the cached features. |
train.verbose |
bool | true | Show progress bars for the head fit, the per-layer fine-tune and the end-to-end pass. |
Read by the tutorial scripts¶
The library does not read these keys; the tutorial scripts do. They are in the schema so that tutorial YAML files can set them.
| Key | Type | Default | Meaning in the tutorials |
|---|---|---|---|
train.batch_size |
int | 1 | Batch size of the data loaders the scripts build. |
train.shuffle |
bool | false | Whether the scripts shuffle the training loader. |
resume |
bool | false | Passed to Trainer.train(resume=...): continue the newest run folder that holds a step checkpoint. |
finetune_end_to_end |
bool | false | After the search and the head fit, run Trainer.train_finetune. |
finetune_drop_head |
bool | false | With finetune_end_to_end, remove the head first. |
finetune_prune_first |
bool | false | With finetune_end_to_end, prune the network first. |
tutorial |
mapping | empty | Free-form settings of one tutorial script, such as its data split and feature engineering; each tutorial page lists its own. |
Neuron family options¶
The options of a model.ref_functions entry, as in
- legendre: {degree: 3, dim: 4}.
Every family
| Option | Default | Meaning |
|---|---|---|
activation |
identity | Output activation: identity, relu, leaky_relu, elu, selu, celu, gelu, silu, mish, tanh, tanhshrink, softplus, softsign, sigmoid, log_sigmoid, hardtanh, hardswish or hardsigmoid. An empty string means the identity. |
init_method |
xavier |
Initial coefficients: xavier (Xavier uniform) or uniform (uniform in ±0.1). |
max_neuron_models |
model.max_neuron_models |
This family's own candidate cap. |
polyquad
| Option | Default | Meaning |
|---|---|---|
dim |
2 | Inputs per neuron. Above 2, model.max_neuron_models must be set. |
squares |
true | Include the squared terms. |
legendre and chebyshev
| Option | Default | Meaning |
|---|---|---|
degree |
3 | Highest polynomial degree per input. |
dim |
2 | Inputs per neuron. |
cross |
true | Include the pairwise products of the squashed inputs. |
squash |
true | Squash the inputs into \((-1, 1)\). |
squash_method |
model.squash_method |
sigma or tanh. |
squash_n_sigma |
model.squash_n_sigma |
Half-width of the linear band, in standard deviations. |
squash_core_range |
model.squash_core_range |
Squashed value at the band's edge. |
rbf
| Option | Default | Meaning |
|---|---|---|
centers |
16 | Gaussian bumps per neuron; at least 2. |
dim |
2 | Inputs per neuron. |
placement |
kmeans |
kmeans or grid (then centers must be a whole power of dim). |
seeding |
pca_quantiles |
Start of k-means: pca_quantiles or kmeans++. |
width |
1.0 | Starting width, times the bump's local spacing. |
learn_centers |
true | Learn the centres. |
learn_widths |
true | Learn the widths. |
center_radius |
2.0 | How far a centre may move, times its local spacing; null for no bound. |
width_band |
4.0 | Widths stay within this factor of their start; above 1. |
normalize |
true | Normalize the bumps to sum to 1. |
linear |
true | Add the standardized inputs to the design row. |
standardize |
true | Standardize the inputs first. |
mlp
| Option | Default | Meaning |
|---|---|---|
dim |
2 | Inputs per neuron. |
hidden |
null | Hidden units; null means 2 * dim + 1. |
cov |
false | Feed the pairwise products of the inputs to the hidden layer too. |
squares |
false | Feed the squared inputs to the hidden layer too. |
skip |
true | Also read the hidden layer's inputs directly in the output sum. |
hidden_activation |
silu |
Activation of the hidden units; any name activation accepts. |
standardize |
false | Standardize the inputs first. |
squash |
false | Squash the inputs as the legendre and chebyshev families do. |
squash_method |
model.squash_method |
sigma or tanh. |
squash_n_sigma |
model.squash_n_sigma |
Half-width of the linear band, in standard deviations. |
squash_core_range |
model.squash_core_range |
Squashed value at the band's edge. |
The pair families linear, linear_cov, quadratic and cubic take only
the options of every family.
Optimizer parameters¶
The keys of train.optimizer.optimizer_params.
Read by the trainer
| Key | Default | Meaning |
|---|---|---|
lr |
1e-4 | Every candidate's starting learning rate. |
min_lr |
1e-5 | The early stop lowers a candidate's learning rate to this before stopping it. |
gamma |
0.5 | Factor of each learning-rate drop. |
Passed to the optimizer
| Key | Optimizers | Default | Meaning |
|---|---|---|---|
clip_value |
adam, sgd, lbfgs |
1.0 | Clamp every gradient entry to ±this value. |
clip_norm |
adam, sgd, lbfgs |
5.0 | Then scale each candidate's gradient down to at most this norm. |
betas |
adam |
(0.9, 0.999) | Adam's moment decay rates. |
eps |
adam |
1e-8 | Adam's denominator term. |
momentum |
sgd |
0.9 | Momentum. |
nesterov |
sgd |
true | Nesterov momentum. |
weight_decay |
adam, sgd |
0.0 | Weight decay. adam decouples it from the gradient, as AdamW does; sgd adds it to the gradient. |
history_size |
lbfgs |
10 | Correction pairs kept per candidate. |
max_step |
lbfgs |
1.0 | The largest update norm per candidate and parameter; null for no cap. |
curvature_eps |
lbfgs |
1e-8 | Keep a correction pair only when its curvature passes this test; null keeps every pair. |
The trainer sets two more arguments itself: lr, from the key above, and
shared_param_lr_multiplier, from train.shared_proj_lr_multiplier. Do not
put shared_param_lr_multiplier in optimizer_params.
Checked against TorchSONN 0.1.5.