Model Tuning

An Optimization Problem

Model tuning is the systematic modification of model parameters to identify the most performant model. Model tuning presents itself as an optimization problem. Depending on the model and target variable, various performance indicators can be selected as optimization targets, such as:

  • Continuous target variable
    • Root Mean Squared Error (RMSE)
    • R-Squared
    • Loss function
    • Mean Absolute Percentage Error (MAPE)
  • Discrete target variable
    • Accuracy
    • Sensitivity
    • Specificity
    • Precision
    • F1-Score
    • Kappa
    • Area under Curve (AUC)


To counteract the trade-off between model performance and overfitting, cross-validation is recommended when tuning models. The aim is to fine-tune the model parameters in order to optimize the selected performance metric. The hyperparameters differ from method to method. Some are listed below as examples (not exhaustive), depending on the method:

  • Regression
    • Included variables
    • Interaction effects
    • Transformed variables
    • L1-Regularization
    • L2-Regularization
  • Decision tree
    • Depth of tree
    • Split criteria
    • Minimal number of observations in end nodes
  • Random Forest
    • Number of trees
    • Number of features considered per split
    • Depth of tree
    • Split criteria
    • Sample size of bootstrapping
  • Gradient Boosting
    • Number of trees
    • Learning rate
    • Sample size of bootstrapping
    • Number of end nodes
  • Neural Nets
    • Learning rate
    • Number of hidden layers
    • Activitation function
    • Batch size

Tuning of Hyperparameters via Grid Search

Often a so-called grid search is used for hyperparameter tuning. The hyperparameter values are selected by ratio, empirical evidence or by trial and error. If different values are taken for the different hyperparameters, this results in a large number of different model specifications in combination. This matrix of combinatorial specifications of hyperparameters is called Grid or Hypergrid. The goal is to find out from these many specifications which one performs best according to a performance metric. An exemplary grid can be found below for a random forest.

Exemplary Grid
  • Number of trees: 500, 1000
  • Features considered per split: Square-root from features, +1, -1
  • Depth of tree: 4,5
  • Split criteria: Gini, Information Gain

This results in 2x3x2x2 = 24 model specifications to be tested. It becomes obvious that by multiplying the specifications very large grids can be created quickly. Since each row of a grid represents a model estimation, long and intensive computations can occur depending on the complexity of the model, the number of features and the number of observations. Therefore there is a obvious trade-off between the size of the grid and the computational costs. Our above fictitious grid would now be applied with cross-validation. The model performance is measured and then the average performance is compared. The specification with the best model performance determines the parameters in the final model. This could exemplary look like the following:

  • Number of trees: 1000
  • Features considered per split: Square-root from features +1
  • Depth of tree: 4
  • Split criteria: Information Gain

Looking for a hands-on tutorial in Python? Then check out TowardsDataScience.

More resources about machine learning

Data integration

How machine learning benefits from data integration
The causal chain “data integration-data quality-model performance” describes the necessity of effective data integration for easier and faster implementable and more successful machine learning. In short, good data integration results in better predictive power of machine learning models due to higher data quality.

From a business perspective, there are both cost-reducing and revenue-increasing effects. The development of the models is cost-reducing (less custom code, thus less maintenance, etc.). Revenue increasing is caused by the better predictive power of the models leading to more precise targeting, cross- and upselling, and more accurate evaluation of leads and opportunities – both B2B and B2C. You can find a detailed article on the topic here:


How to use machine learning with the Integration Platform
You can make the data from your centralized Marini Integration Platform available to external machine learning services and applications. The integration works seamlessly via the HubEngine or direct access to the platform, depending on the requirements of the third-party provider. For example, one vendor for standard machine learning applications in sales is Omikron. But you can also use standard applications on AWS or in the Google Cloud. Connecting to your own servers is just as easy if you want to program your own models there.

If you need support on how to integrate machine learning models into your platform, please contact our sales team. We will be happy to help you!


Frequent applications of machine learning in sales
Machine learning can support sales in a variety of ways. For example, it can calculate closing probabilities, estimate cross-selling and up-selling potential, or predict recommendations. The essential point here is that the salesperson is supported and receives further decision-making assistance, which he can use to better concentrate on his actual activity, i.e., selling. For example, the salesperson can more quickly identify which leads, opportunities or customers are most promising at the moment and contact them. However, it remains clear that the salesperson makes the final decision and is ultimately only facilitated by machine learning. In the end, no model sells, but still the human being.

Here you will find a short introduction to machine learning and the most common applications in sales.

Further articles

Global Search

There are FAQ sections and documentation for our products. If you cannot find what you are looking for in the glossary, we recommend that you search there as well. The global search considers all contents.

Questions and Participation

If you have any questions, if you are missing an entry or if you want to make changes, you are invited to participate. Just send us a support ticket.