Tuning Your Model
Optimising a machine learning model consist of five steps.

1. Data Preparation
It is certainly true to say that garbage in equates to garbage out. These models learn from experience so it is essential that the data used is representative of the problem to be solved. In this step it is necessary to:
- Handle missing data.
- Remove duplicate data.
- Correct inconsistencies in the data.
- Normalise the data.
2. Model Selection
The general class of problem to be solved will determine which group of models will be used. However, it is not possible to determine in advance which model will provide the optimum solution. Frequently a number of models will be tested with the leading candidates being selected for further evaluation.
3. Feature Engineering
In many cases the most relevant input parameters are not known. Thus there is a tendency to use all potential inputs. This creates the challenge in that it may be difficult to see the wood from the trees. Feature engineering, consists of a number of techniques such as filter and wrapper methods which provide a means of identifying which of the inputs provide the most information and discarding the remainder. This reduces the likelihood of the final model being over fitted.
4. Model Training/Evaluation
The data for the model is sub-divided into three groups:
- Training
- Cross-validation
- Testing
The model learns from the training data with the cross-validation being used as a mock examine. The cross validation phase is designed to ensure that the model has learnt general principles and not just memorised the result. Finally the model is tested using data that it has never seen before. It is also possible during the training phase to further tune the model by adjusting its hyperparameters using grid and random search techniques.
5. Model Improvement
This refers to techniques to improve the performance of a single model. The idea is that by aggregating the predictions of several models, the ensemble can achieve better performance, increased robustness, and reduced overfitting compared to any individual model.