Replaces v1's SANN with L-BFGS-B plus analytic gradients via Deriv::Deriv applied to the eml-expanded master expression. After convergence, snaps each slot to its argmax one-hot vertex and reports the snapped MSE — values at machine epsilon squared indicate exact symbolic recovery.
Usage
eml_fit(
x,
y,
depth = 3L,
parameterization = c("simplex", "direct"),
method = "L-BFGS-B",
maxit = 1000L,
n_restarts = 1L,
seed = 42L
)Arguments
- x
numeric vector of inputs.
- y
numeric vector of targets.
- depth
integer >= 1.
- parameterization
either
"simplex"(logits → per-slot softmax; the paper's choice) or"direct"(raw scaling).- method
optimmethod; defaults to"L-BFGS-B".- maxit
maximum optimiser iterations.
- n_restarts
number of independent random restarts; the best is returned. "Best" is the smallest continuous final loss — for exact symbolic recovery this coincides with the snapping vertex when the global optimum sits at a grammar vertex (as it does for the paper's
exp/logtargets); it is not selected onsnap_mse.- seed
RNG seed for reproducibility (each restart shifts it by 1).
Value
List with par, theta, theta_snap, pred, pred_snap,
final_value, snap_mse, n_restarts_run, best_seed.
See also
Other eml_master:
build_master(),
master_n_params(),
snap_master_params(),
theta_for_exp(),
theta_for_log(),
unpack_master_params()
