{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "*This notebook contains an excerpt from the book [Machine Learning for OpenCV](https://www.packtpub.com/big-data-and-business-intelligence/machine-learning-opencv) by Michael Beyeler.\n", "The code is released under the [MIT license](https://opensource.org/licenses/MIT),\n", "and is available on [GitHub](https://github.com/mbeyeler/opencv-machine-learning).*\n", "\n", "*Note that this excerpt contains only the raw code - the book is rich with additional explanations and illustrations.\n", "If you find this content useful, please consider supporting the work by\n", "[buying the book](https://www.packtpub.com/big-data-and-business-intelligence/machine-learning-opencv)!*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Combining Different Models Into a Voting Classifier](10.05-Combining-Different-Models-Into-a-Voting-Classifier.ipynb) | [Contents](../README.md) | [Evaluating a Model](11.01-Evaluating-a-Model.ipynb) >" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Selecting the Right Model with Hyper-Parameter Tuning\n", "\n", "In this chapter, we will dive deeper into **model evaluation** and **hyperparameter\n", "tuning**. Assume that we have two different models that might apply to our task. How can\n", "we know which one is better? Answering this question often involves repeatedly fitting\n", "different versions of our model to different subsets of the data, such as in **cross-validation**\n", "and **bootstrapping**. In combination with different scoring functions, we can obtain reliable\n", "estimates of the generalization performance of our models.\n", "\n", "But what if two different models give similar results? Can we be sure that the two models\n", "are equivalent, or is it possible that one of them just got lucky? How can we know whether\n", "one of them is significantly better than the other? Answering these questions will lead us to\n", "discussing some useful statistical tests such as **Students t-test** and **McNemar's test**.\n", "\n", "As we will get familiar with these techniques, we will also want to answer the following\n", "questions:\n", "- What's the best strategy to tweak the hyperparameters of a model?\n", "- How can we compare the performance of different models in a fair way?\n", "- How do we select the right machine learning tool for the task at hand?\n", "\n", "## Outline\n", "\n", "- [Evaluating a Model](11.01-Evaluating-a-Model.ipynb)\n", "- [Understanding Cross-Validation, Bootstrapping, and McNemar's Test](11.02-Understanding-Cross-Validation-Bootstrapping-and-McNemar's-Test.ipynb)\n", "- [Tuning Hyperparameters with Grid Search](11.03-Tuning-Hyperparameters-with-Grid-Search.ipynb)\n", "- [Chaining Algorithms Together to Form a Pipeline](11.04-Chaining-Algorithms-Together-to-Form-a-Pipeline.ipynb)\n", " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Combining Different Models Into a Voting Classifier](10.05-Combining-Different-Models-Into-a-Voting-Classifier.ipynb) | [Contents](../README.md) | [Evaluating a Model](11.01-Evaluating-a-Model.ipynb) >" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.3" } }, "nbformat": 4, "nbformat_minor": 1 }