ActivationKind (atanTanh default, atanRelu, atanStep) on ElmConfig, plus applyActivation, activationName and parseActivation. The hidden units stay pure additive nodes: every activation sees the same pre-activation s = a.x + b and differs only in the scalar nonlinearity g. tanh is unchanged and bit-identical to the previous version, so existing callers cannot regress. Two init details are activation-aware, because relu and step are dead for s <= 0: they get bias U[0,1] instead of U[-1,1], and hidden weight scale 8/sqrt(inputDim) instead of 1/sqrt(inputDim) (at the tanh scale the pre-activations barely straddle 0, the Gram matrix loses rank and Thm 2.2 interpolation fails outright). No RBF option: g(b*||x - a||) reads the distance to a centre in input space, which is a different node architecture (extra centre + width parameters, its own init and its own Thm 2.2 validation), not a different g. Adds tests/test_elm.nim (9 suites) and a `nimble test` task. All pass.
2 lines
26 B
Nim
2 lines
26 B
Nim
--path:"../DevControlBot"
|