I want to build a multivariable and multivariate regression model in Keras (with TensorFlow as backend), that is, a regression model with multiple values as input (multivariable) and output (multivariate).

The independent variables are, for example, the length, weight, force, etc., and the dependent variables are the torque, friction, heat, temperature, etc.

What is the best approach to achieve that? Any guidance before I start? (If anyone can share any example code/notebook/code would be great as well).


You create a model like this very easily with keras. Follow these steps.

Data Exploring

Before building a machine learning model, you must explore your data first. An approach is to use libraries to visualize the data as graphs. You can use the tool pandas-profiling


Points to look for when exploring the data

You should look for the following:

  • Distribution of labels and input features
  • Range of input features and labels
  • Missing label or input feature
  • Nan on value
  • Outliers

You should look out for them and use appropriate data cleaning or filtering method to clean them. For example, Nan or missing value may be substituted with 0 and outliers will be removed. Input features may also be normalized.

Building the model

Keras is a easy tool for building machinea learning model. For how to build a basic MLP ( Multi-Layer Perceptron), you can refer to the example code and the resource.



After creating the basic model, you can start experimenting with stuff like:

  • Different model structure like adding layers and changing hidden layer size
  • Different Optimizer
  • Different hyperparameters like learning rate and batch size
  • Different input features

You will gain more experience as you go. There is a lot of ways to improve the performance of the model.


Here are things to beware:

  • If your model doesn't work out, don't worry. Try another method or tune parameters until it work.
  • If the testing loss become very high while training loss is low, you can add dropout to prevent this from happening. This is called overfitting.

Hope I can help you and have fun!


Your Answer

