Learn AI Engineering Rent GPUs By The Hour Docker VPS Hosting Automate 3000+ Apps No Code AI Agents Proxies For Your Agents
Learn AI Engineering Rent GPUs By The Hour
Websites To LLM Data Proxies For Scraping AI Support Chatbot AI Data Analyst AI Agent Workspace Hire AI Builders

MLP Regressor: How a Neural Network Predicts Numbers and How to Train One

Updated November 2026
An MLP regressor, short for multilayer perceptron, is a neural network that predicts a number by passing the input through layers of small units, each one a weighted sum, and adding up the last layer into a single value. It is the regressor for relationships that bend and combine in ways the others can not follow, and it only pays off with thousands of rows, a scaled label, and some patience with tuning.

How an MLP Regressor Decides

The building block is the same weighted sum that Ridge Regression uses, multiply each input by a weight and add them up. Ridge does that once and calls the total the answer. The network does it 128 times in parallel with 128 different sets of weights, throws away the negative totals, and uses those 128 results as the inputs to a second layer of 64 units that do the same thing again. The final output is one more weighted sum of those 64.

What makes that more than a complicated ridge is the step of throwing away negatives. It lets each unit act like a switch that is only on for part of the input range, so one unit might only contribute when temperature is above 80, another only when it is a weekday with low stock. Add up enough switches and you can build any curve, with bends, plateaus, and effects that only appear in combination. So basically ridge means "1 straight rule for everything" and the network means "hundreds of small rules that each cover a piece, added together".

Nobody sets those rules. The network starts with random weights, predicts badly, measures how far off it was, and nudges every weight slightly toward less wrong, over and over for up to 300 passes through the data. This is the same structure as the Deep Neural Network classifier, the only difference is the last layer, which outputs 1 number instead of a score per label.

What an MLP Regressor Is Best At

  • Relationships with real shape. Energy use against temperature, where both hot and cold raise it, or demand that depends on price, season, and stock all at once.
  • Smooth output. Unlike Gradient Boost, which predicts in steps, the network gives a continuous curve, so a small change in the input gives a small change in the answer.
  • Many inputs that each help a little. Sensor readings and measurements where no single column carries the answer.
  • Large datasets. It keeps finding more as the rows go into the tens of thousands.
  • Some reach past the edges. It continues its last slope outside the training range, which is not reliable, but it is better than the flat line a tree based model gives.

Where It Breaks

  • Small data. Tens of thousands of weights and 300 rows means it memorizes. Under about 1,000 rows, ridge or gradient boosting will almost always do better.
  • Labels on a big scale. The network starts out predicting numbers near 0, so if your labels are around 400,000 it spends most of its training just climbing up to the right neighborhood and may run out of passes before it gets there.
  • Ordinary table data. On typical business columns, gradient boosting is usually more accurate with far less effort.
  • It differs between runs. Random starting weights mean 2 trainings on the same rows give somewhat different models.
  • No explanation, and the slowest training of the regressors.

Parameters

{"layers": [128, 64], "epochs": 300, "learningRate": 0.001, "alpha": 0.0001}
  • layers sets the size of each hidden layer. [128, 64] suits a few thousand rows. For around 1,000 rows use [32] or [64, 32], a smaller network has less room to memorize.
  • epochs is the maximum passes through the data. Training ends early when it stops improving, so this is a ceiling. If results look half finished, predictions all bunched near the average, raise it to 1000.
  • learningRate is the size of each nudge to the weights. Leave it at 0.001 unless training is clearly unstable, then try 0.0005.
  • alpha penalizes large weights and is the brake on memorizing. Raise it to 0.001 or 0.01 when the model does well on training rows and badly on held back ones.

How to Train an MLP Regressor Step by Step

These steps use ML Prediction Engine, the free open source tool this topic uses for its examples, where the class is named mlpRegressor. The machine learning models guide covers installing it.

1. Get a baseline from gradientBoost or ridge

Create the pipeline with a regressor step set to gradientBoost, load the rows, train, and measure the average miss on 50 or more held back rows. A network that can not beat that number is not worth its training time, and you will not know without it.

2. Switch the step to the mlpRegressor class

Change the class on the same step to mlpRegressor and set the parameters:

{"layers": [128, 64], "epochs": 300, "learningRate": 0.001, "alpha": 0.0001}

3. Scale the label and load enough rows

The engine standardizes the input columns for this class, so those go in raw, but the label is used as sent. Divide it by a fixed number so most values land between 0 and 10, a building's daily energy use of 3,400 kWh becomes 3.4 with a divisor of 1,000. If you scaled the label after getting the baseline, reload the dataset with the scaled values and rerun the baseline so both are measured the same way.

curl -X POST http://localhost:8080/api.php/dataset/add \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_KEY" \
  -d '{"pipelineID": 1, "modelIndex": 0, "input": [91, 62, 1, 240], "label": 3.4}'

That row is 91 degrees, 62% humidity, a weekday, and 240 people in the building. Aim for at least 1,000 rows.

4. Train the model

Click Train or call api.php/train with the pipelineID and modelIndex. Expect a few seconds for a thousand rows and longer as the data and the layers grow.

5. Test and size the network

Measure the average miss on the same held back rows as the baseline. If the predictions barely vary and sit near the average label, it stopped too early, raise epochs to 1000. If it does much worse than the baseline, it is memorizing, set "layers": [32] and "alpha": 0.001 and retrain. Train it 2 or 3 times at the same settings before judging, since each run starts from different random weights.

6. Predict and convert back

curl -X POST http://localhost:8080/api.php/predict \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_KEY" \
  -d '{"pipelineID": 1, "input": [38, 45, 0, 20]}'

The answer is {"output": 2.1, ...}, and multiplying by the divisor of 1,000 gives 2,100 kWh.

When the MLP Regressor Is Worth It

Honestly, less often than the other regressors. The usual order is Ridge Regression first for the baseline, Gradient Boost second for accuracy, and the network third, only when you have thousands of rows, the boosted model has levelled off, and you either need a smooth curve or have many inputs that all contribute a little. When those conditions are true it can be the best of the 5, and when they are not it is the most work for the least gain.

Key Takeaway

An MLP regressor adds up hundreds of small switched rules to follow any curve. Use it only with 1,000 rows or more and a baseline to beat, scale the label into a small range, shrink the layers and raise alpha when it memorizes, and raise epochs when predictions stay bunched near the average.