Skip to main content

MLPRegressor

A dense feed-forward neural network for regression with a linear output layer, trained with mini-batch Adam (or SGD).

Algorithm

Minimises squared error with L2 weight decay. Multi-target regression is available through fit_multi / predict_multi.

Constructor

Skigen::MLPRegressor<Scalar> model(std::vector<int> hidden_layer_sizes = {100}, Activation = ReLU, Solver = Adam, ...);

Parameters

ParameterDefaultDescription
hidden_layer_sizes{100}Units per hidden layer.
activationReLUHidden activation.
solverAdamAdam or SGD.
alpha1e-4L2 regularisation.
learning_rate_init1e-3Initial step size.
max_iter200Maximum epochs.

Methods

MethodDescription
fit(X, y)Train on a single target.
fit_multi(X, Y)Train on multiple targets.
predict(X)Real-valued predictions.
score(X, y)R².

Fitted Attributes

AccessorDescription
coefs()Per-layer weights.
intercepts()Per-layer biases.

Example

Skigen::MLPRegressor<double> mlp({64});
mlp.fit(X, y);
auto preds = mlp.predict(X_test);

Known Gaps

solver = LBFGS is explicitly feature-gated for v1.2.0. Constructing an MLPRegressor with MLPSolver::LBFGS throws a clear std::invalid_argument; Adam and SGD remain supported.

Verified against scikit-learn

This estimator is checked by the parity suite. See the generator tests/parity/generate_neural_network_reference.py and the reference fixtures in tests/parity/data/mlp_regressor/, exercised by tests/parity/parity_neural_network.cpp.

API Reference

For full signatures see the MLPRegressor API Reference.