Concept: Algorithms and Hyperparameters¶
The Modeling section of the Design tab lets us choose between the different machine learning algorithms available in DSS, optimize hyperparameters using a grid search, and leverage the different machine learning engines that are available.
DSS natively supports several algorithms that can be used to train predictive models depending on the machine learning task: Clustering or Prediction (Classification or Regression). We can also choose to use our own machine learning algorithm, by adding a custom Python model.
Let’s take a look at the Modeling section of a classification model we trained to predict whether a patient will be readmitted to the hospital.
For each of the algorithms that we selected, there is a set of hyperparameters that we can optimize to improve the model. For example, in the Random Forest algorithm, we can change the number of trees, the feature sampling strategy, or the maximum depth of the tree, to cite a few. For instance, we can try three different values for the number of trees: 100, 50 and 200.
The hyperparameters available to optimize depend on the algorithm and the engine selected to train the model. Every time we create a new machine learning model in DSS, we can select the engine to use for training the model. Most algorithms are based on the Scikit Learn or XGBoost machine learning library, and use in-memory processing.
We could also leverage our Spark clusters to train models on large datasets that don’t fit into memory, by using one of the following:
Spark’s machine learning library, MLLIB, or
Sparkling Water, H2O’s support for machine learning with Spark.
Each of these engines will lead to slightly different hyperparameters to optimize.
DSS allows us to define the settings for our hyperparameter search These search parameters control the optimization process and are available from the Hyperparameters tab.
For example, we can set the maximum search time to 2 minutes. When the time limit is reached, the grid search stops, and returns the best set of parameters for the model.
We can also select our preferred validation strategy for the grid search:
A simple train/test split,
A K-fold cross validation method, or
Our own custom cross-validation code.
View the Tuning Results
Once we are satisfied with our settings, we can train another iteration of our model, and visualize the evolution of our grid search in the Result tab.
We can choose to interrupt the optimization while DSS is implementing the grid-search. DSS will then finish the current grid point that it is evaluating, and will train and evaluate the model on the “best hyperparameters found so far”. Later on, we can resume the interrupted grid search, and DSS will continue the optimization using only the hyperparameter values that have not been tried.
Here, DSS displays a graph of the evolution of the best cross-validation scores found so far. Hovering over one of the points, we can see the evolution of the hyperparameter values that yielded an improvement. In the right part of the charts, we can see final test scores.