From 8aebf91680136c929308c96d7438451e94058ed6 Mon Sep 17 00:00:00 2001 From: mhjensen Date: Sat, 10 Nov 2018 22:03:22 +0100 Subject: [PATCH] added new material on trees and more --- .../html/._DecisionTrees-bs000.html | 66 ++-- .../html/._DecisionTrees-bs001.html | 64 ++-- .../html/._DecisionTrees-bs002.html | 64 ++-- .../html/._DecisionTrees-bs003.html | 64 ++-- .../html/._DecisionTrees-bs004.html | 64 ++-- .../html/._DecisionTrees-bs005.html | 64 ++-- .../html/._DecisionTrees-bs006.html | 64 ++-- .../html/._DecisionTrees-bs007.html | 64 ++-- .../html/._DecisionTrees-bs008.html | 64 ++-- .../html/._DecisionTrees-bs009.html | 64 ++-- .../html/._DecisionTrees-bs010.html | 64 ++-- .../html/._DecisionTrees-bs011.html | 64 ++-- .../html/._DecisionTrees-bs012.html | 64 ++-- .../html/._DecisionTrees-bs013.html | 64 ++-- .../html/._DecisionTrees-bs014.html | 135 +++----- .../html/._DecisionTrees-bs015.html | 136 +++++--- .../html/._DecisionTrees-bs016.html | 96 +++--- .../html/._DecisionTrees-bs017.html | 146 +++------ .../html/._DecisionTrees-bs018.html | 154 ++++++--- .../html/._DecisionTrees-bs019.html | 98 +++--- .../html/._DecisionTrees-bs020.html | 82 ++--- .../html/._DecisionTrees-bs021.html | 111 +++---- .../html/._DecisionTrees-bs022.html | 118 ++++--- .../html/._DecisionTrees-bs023.html | 115 +++---- .../html/._DecisionTrees-bs024.html | 115 ++++--- .../html/._DecisionTrees-bs025.html | 125 +++----- .../html/._DecisionTrees-bs026.html | 138 ++++---- .../html/._DecisionTrees-bs027.html | 124 +++++--- .../html/._DecisionTrees-bs028.html | 87 ++++-- .../DecisionTrees/html/DecisionTrees-bs.html | 66 ++-- .../html/DecisionTrees-reveal.html | 39 ++- .../html/DecisionTrees-solarized.html | 70 +++-- doc/pub/DecisionTrees/html/DecisionTrees.html | 70 +++-- .../ipynb/ipynb-DecisionTrees-src.tar.gz | Bin 213 -> 213 bytes .../pdf/DecisionTrees-minted.pdf | Bin 349643 -> 349619 bytes doc/src/Autoencoders/Autoencoders.do.txt | 7 + doc/src/Autoencoders/clean.sh | 3 + doc/src/Autoencoders/make.sh | 95 ++++++ doc/src/DecisionTrees/DecisionTrees.do.txt | 8 + doc/src/Recurrent/Recurrent.do.txt | 7 + doc/src/Recurrent/clean.sh | 3 + doc/src/Recurrent/make.sh | 95 ++++++ doc/src/Reinforcement/Reinforce.do.txt | 7 + doc/src/Reinforcement/clean.sh | 3 + doc/src/Reinforcement/make.sh | 95 ++++++ doc/web/course.do.txt | 9 +- doc/web/course.html | 294 ++++++++++++------ 47 files changed, 2031 insertions(+), 1518 deletions(-) create mode 100644 doc/src/Autoencoders/Autoencoders.do.txt create mode 100755 doc/src/Autoencoders/clean.sh create mode 100755 doc/src/Autoencoders/make.sh create mode 100644 doc/src/Recurrent/Recurrent.do.txt create mode 100755 doc/src/Recurrent/clean.sh create mode 100755 doc/src/Recurrent/make.sh create mode 100644 doc/src/Reinforcement/Reinforce.do.txt create mode 100755 doc/src/Reinforcement/clean.sh create mode 100755 doc/src/Reinforcement/make.sh diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs000.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs000.html index f26bb4feb..1c0439170 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs000.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs000.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -170,7 +172,7 @@ MathJax.Hub.Config({
    [2] Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University

    -

    Nov 9, 2018

    +

    Nov 10, 2018


    @@ -194,7 +196,7 @@ MathJax.Hub.Config({

  • 9
  • 10
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs001.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs001.html index be7039647..d17c12e7f 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs001.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs001.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -187,7 +189,7 @@ continuous but also categorical input and target features.
  • 10
  • 11
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs002.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs002.html index e2786936b..278e3f8a8 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs002.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs002.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -196,7 +198,7 @@ and leaf nodes which are then connected by branches.
  • 11
  • 12
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs003.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs003.html index e9e6d7777..e33a464f5 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs003.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs003.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -185,7 +187,7 @@ Then we are essentially done!
  • 12
  • 13
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs004.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs004.html index 6385dd61c..46c72fff4 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs004.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs004.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -264,7 +266,7 @@ plt.show()
  • 13
  • 14
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs005.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs005.html index 521fd6f28..47d5ba9bb 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs005.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs005.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -270,7 +272,7 @@ plt.show()
  • 14
  • 15
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs006.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs006.html index c993de4ad..341caf2ed 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs006.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs006.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -202,7 +204,7 @@ box.
  • 15
  • 16
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs007.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs007.html index 9e723db9e..be7ed211b 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs007.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs007.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -190,7 +192,7 @@ better tree in some future step.
  • 16
  • 17
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs008.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs008.html index 83adb5cf9..e13ef57fd 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs008.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs008.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -219,7 +221,7 @@ region contains more than five observations.
  • 17
  • 18
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs009.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs009.html index aa826b1de..90ff2ae20 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs009.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs009.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -192,7 +194,7 @@ parameter \( \alpha \).
  • 18
  • 19
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs010.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs010.html index 61998d4ca..5aa35ade8 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs010.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs010.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -205,7 +207,7 @@ subtree corresponding to \( \alpha \).
  • 19
  • 20
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs011.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs011.html index d40176ab2..c570f9855 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs011.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs011.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -201,7 +203,7 @@ MathJax.Hub.Config({
  • 20
  • 21
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs012.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs012.html index 452e9766a..52c84d17f 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs012.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs012.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -193,7 +195,7 @@ fall into that region.
  • 21
  • 22
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs013.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs013.html index e0bcf5461..a0df3b971 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs013.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs013.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -198,7 +200,7 @@ than is the classification error rate.
  • 22
  • 23
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs014.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs014.html index 86b28dffd..7a6aa2fd2 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs014.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs014.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -151,75 +153,10 @@ MathJax.Hub.Config({ -

    Back to moons again

    -

    +

    Classification tree, how to split nodes

    +If our targets are the outcome of a classification process that takes for example +\( k=1,2,\dots,K \) values, the only thing we need to think of is to set up the splitting criteria for each node. - -
    from __future__ import division, print_function, unicode_literals
    -
    -# Common imports
    -import numpy as np
    -import os
    -
    -# to make this notebook's output stable across runs
    -np.random.seed(42)
    -
    -# To plot pretty figures
    -import matplotlib
    -import matplotlib.pyplot as plt
    -from matplotlib.colors import ListedColormap
    -plt.rcParams['axes.labelsize'] = 14
    -plt.rcParams['xtick.labelsize'] = 12
    -plt.rcParams['ytick.labelsize'] = 12
    -
    -
    -from sklearn.svm import SVC
    -from sklearn import datasets
    -from sklearn.tree import DecisionTreeClassifier
    -from sklearn.datasets import make_moons
    -from sklearn.tree import export_graphviz
    -
    -Xm, ym = make_moons(n_samples=100, noise=0.25, random_state=53)
    -
    -deep_tree_clf1 = DecisionTreeClassifier(random_state=42)
    -deep_tree_clf2 = DecisionTreeClassifier(min_samples_leaf=4, random_state=42)
    -deep_tree_clf1.fit(Xm, ym)
    -deep_tree_clf2.fit(Xm, ym)
    -
    -
    -def plot_decision_boundary(clf, X, y, axes=[0, 7.5, 0, 3], iris=True, legend=False, plot_training=True):
    -    x1s = np.linspace(axes[0], axes[1], 100)
    -    x2s = np.linspace(axes[2], axes[3], 100)
    -    x1, x2 = np.meshgrid(x1s, x2s)
    -    X_new = np.c_[x1.ravel(), x2.ravel()]
    -    y_pred = clf.predict(X_new).reshape(x1.shape)
    -    custom_cmap = ListedColormap(['#fafab0','#9898ff','#a0faa0'])
    -    plt.contourf(x1, x2, y_pred, alpha=0.3, cmap=custom_cmap)
    -    if not iris:
    -        custom_cmap2 = ListedColormap(['#7d7d58','#4c4c7f','#507d50'])
    -        plt.contour(x1, x2, y_pred, cmap=custom_cmap2, alpha=0.8)
    -    if plot_training:
    -        plt.plot(X[:, 0][y==0], X[:, 1][y==0], "yo", label="Iris-Setosa")
    -        plt.plot(X[:, 0][y==1], X[:, 1][y==1], "bs", label="Iris-Versicolor")
    -        plt.plot(X[:, 0][y==2], X[:, 1][y==2], "g^", label="Iris-Virginica")
    -        plt.axis(axes)
    -    if iris:
    -        plt.xlabel("Petal length", fontsize=14)
    -        plt.ylabel("Petal width", fontsize=14)
    -    else:
    -        plt.xlabel(r"$x_1$", fontsize=18)
    -        plt.ylabel(r"$x_2$", fontsize=18, rotation=0)
    -    if legend:
    -        plt.legend(loc="lower right", fontsize=14)
    -plt.figure(figsize=(11, 4))
    -plt.subplot(121)
    -plot_decision_boundary(deep_tree_clf1, Xm, ym, axes=[-1.5, 2.5, -1, 1.5], iris=False)
    -plt.title("No restrictions", fontsize=16)
    -plt.subplot(122)
    -plot_decision_boundary(deep_tree_clf2, Xm, ym, axes=[-1.5, 2.5, -1, 1.5], iris=False)
    -plt.title("min_samples_leaf = {}".format(deep_tree_clf2.min_samples_leaf), fontsize=14)
    -plt.show()
    -

    @@ -246,7 +183,7 @@ plt.show()

  • 23
  • 24
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs015.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs015.html index 62530e8d2..ec0cb5c6c 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs015.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs015.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -151,29 +153,73 @@ MathJax.Hub.Config({ -

    Playing around with regions

    +

    Back to moons again

    -

    np.random.seed(6)
    -Xs = np.random.rand(100, 2) - 0.5
    -ys = (Xs[:, 0] > 0).astype(np.float32) * 2
    +
    from __future__ import division, print_function, unicode_literals
     
    -angle = np.pi / 4
    -rotation_matrix = np.array([[np.cos(angle), -np.sin(angle)], [np.sin(angle), np.cos(angle)]])
    -Xsr = Xs.dot(rotation_matrix)
    +# Common imports
    +import numpy as np
    +import os
     
    -tree_clf_s = DecisionTreeClassifier(random_state=42)
    -tree_clf_s.fit(Xs, ys)
    -tree_clf_sr = DecisionTreeClassifier(random_state=42)
    -tree_clf_sr.fit(Xsr, ys)
    +# to make this notebook's output stable across runs
    +np.random.seed(42)
     
    +# To plot pretty figures
    +import matplotlib
    +import matplotlib.pyplot as plt
    +from matplotlib.colors import ListedColormap
    +plt.rcParams['axes.labelsize'] = 14
    +plt.rcParams['xtick.labelsize'] = 12
    +plt.rcParams['ytick.labelsize'] = 12
    +
    +
    +from sklearn.svm import SVC
    +from sklearn import datasets
    +from sklearn.tree import DecisionTreeClassifier
    +from sklearn.datasets import make_moons
    +from sklearn.tree import export_graphviz
    +
    +Xm, ym = make_moons(n_samples=100, noise=0.25, random_state=53)
    +
    +deep_tree_clf1 = DecisionTreeClassifier(random_state=42)
    +deep_tree_clf2 = DecisionTreeClassifier(min_samples_leaf=4, random_state=42)
    +deep_tree_clf1.fit(Xm, ym)
    +deep_tree_clf2.fit(Xm, ym)
    +
    +
    +def plot_decision_boundary(clf, X, y, axes=[0, 7.5, 0, 3], iris=True, legend=False, plot_training=True):
    +    x1s = np.linspace(axes[0], axes[1], 100)
    +    x2s = np.linspace(axes[2], axes[3], 100)
    +    x1, x2 = np.meshgrid(x1s, x2s)
    +    X_new = np.c_[x1.ravel(), x2.ravel()]
    +    y_pred = clf.predict(X_new).reshape(x1.shape)
    +    custom_cmap = ListedColormap(['#fafab0','#9898ff','#a0faa0'])
    +    plt.contourf(x1, x2, y_pred, alpha=0.3, cmap=custom_cmap)
    +    if not iris:
    +        custom_cmap2 = ListedColormap(['#7d7d58','#4c4c7f','#507d50'])
    +        plt.contour(x1, x2, y_pred, cmap=custom_cmap2, alpha=0.8)
    +    if plot_training:
    +        plt.plot(X[:, 0][y==0], X[:, 1][y==0], "yo", label="Iris-Setosa")
    +        plt.plot(X[:, 0][y==1], X[:, 1][y==1], "bs", label="Iris-Versicolor")
    +        plt.plot(X[:, 0][y==2], X[:, 1][y==2], "g^", label="Iris-Virginica")
    +        plt.axis(axes)
    +    if iris:
    +        plt.xlabel("Petal length", fontsize=14)
    +        plt.ylabel("Petal width", fontsize=14)
    +    else:
    +        plt.xlabel(r"$x_1$", fontsize=18)
    +        plt.ylabel(r"$x_2$", fontsize=18, rotation=0)
    +    if legend:
    +        plt.legend(loc="lower right", fontsize=14)
     plt.figure(figsize=(11, 4))
     plt.subplot(121)
    -plot_decision_boundary(tree_clf_s, Xs, ys, axes=[-0.7, 0.7, -0.7, 0.7], iris=False)
    +plot_decision_boundary(deep_tree_clf1, Xm, ym, axes=[-1.5, 2.5, -1, 1.5], iris=False)
    +plt.title("No restrictions", fontsize=16)
     plt.subplot(122)
    -plot_decision_boundary(tree_clf_sr, Xsr, ys, axes=[-0.7, 0.7, -0.7, 0.7], iris=False)
    -
    +plot_decision_boundary(deep_tree_clf2, Xm, ym, axes=[-1.5, 2.5, -1, 1.5], iris=False)
    +plt.title("min_samples_leaf = {}".format(deep_tree_clf2.min_samples_leaf), fontsize=14)
     plt.show()
     

    @@ -202,7 +248,7 @@ plt.show()

  • 24
  • 25
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs016.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs016.html index 77aa5ec87..2392d1749 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs016.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs016.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -151,24 +153,30 @@ MathJax.Hub.Config({ -

    Regression trees

    +

    Playing around with regions

    -

    # Quadratic training set + noise
    -np.random.seed(42)
    -m = 200
    -X = np.random.rand(m, 1)
    -y = 4 * (X - 0.5) ** 2
    -y = y + np.random.randn(m, 1) / 10
    -
    -

    +

    np.random.seed(6)
    +Xs = np.random.rand(100, 2) - 0.5
    +ys = (Xs[:, 0] > 0).astype(np.float32) * 2
     
    -
    -
    from sklearn.tree import DecisionTreeRegressor
    +angle = np.pi / 4
    +rotation_matrix = np.array([[np.cos(angle), -np.sin(angle)], [np.sin(angle), np.cos(angle)]])
    +Xsr = Xs.dot(rotation_matrix)
     
    -tree_reg = DecisionTreeRegressor(max_depth=2, random_state=42)
    -tree_reg.fit(X, y)
    +tree_clf_s = DecisionTreeClassifier(random_state=42)
    +tree_clf_s.fit(Xs, ys)
    +tree_clf_sr = DecisionTreeClassifier(random_state=42)
    +tree_clf_sr.fit(Xsr, ys)
    +
    +plt.figure(figsize=(11, 4))
    +plt.subplot(121)
    +plot_decision_boundary(tree_clf_s, Xs, ys, axes=[-0.7, 0.7, -0.7, 0.7], iris=False)
    +plt.subplot(122)
    +plot_decision_boundary(tree_clf_sr, Xsr, ys, axes=[-0.7, 0.7, -0.7, 0.7], iris=False)
    +
    +plt.show()
     

    @@ -196,7 +204,7 @@ tree_reg.fit(X, y)

  • 25
  • 26
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs017.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs017.html index 8a5f766d2..71cf64714 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs017.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs017.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -151,80 +153,24 @@ MathJax.Hub.Config({ -

    Final regressor code

    +

    Regression trees

    +

    + + +

    # Quadratic training set + noise
    +np.random.seed(42)
    +m = 200
    +X = np.random.rand(m, 1)
    +y = 4 * (X - 0.5) ** 2
    +y = y + np.random.randn(m, 1) / 10
    +

    from sklearn.tree import DecisionTreeRegressor
     
    -tree_reg1 = DecisionTreeRegressor(random_state=42, max_depth=2)
    -tree_reg2 = DecisionTreeRegressor(random_state=42, max_depth=3)
    -tree_reg1.fit(X, y)
    -tree_reg2.fit(X, y)
    -
    -def plot_regression_predictions(tree_reg, X, y, axes=[0, 1, -0.2, 1], ylabel="$y$"):
    -    x1 = np.linspace(axes[0], axes[1], 500).reshape(-1, 1)
    -    y_pred = tree_reg.predict(x1)
    -    plt.axis(axes)
    -    plt.xlabel("$x_1$", fontsize=18)
    -    if ylabel:
    -        plt.ylabel(ylabel, fontsize=18, rotation=0)
    -    plt.plot(X, y, "b.")
    -    plt.plot(x1, y_pred, "r.-", linewidth=2, label=r"$\hat{y}$")
    -
    -plt.figure(figsize=(11, 4))
    -plt.subplot(121)
    -plot_regression_predictions(tree_reg1, X, y)
    -for split, style in ((0.1973, "k-"), (0.0917, "k--"), (0.7718, "k--")):
    -    plt.plot([split, split], [-0.2, 1], style, linewidth=2)
    -plt.text(0.21, 0.65, "Depth=0", fontsize=15)
    -plt.text(0.01, 0.2, "Depth=1", fontsize=13)
    -plt.text(0.65, 0.8, "Depth=1", fontsize=13)
    -plt.legend(loc="upper center", fontsize=18)
    -plt.title("max_depth=2", fontsize=14)
    -
    -plt.subplot(122)
    -plot_regression_predictions(tree_reg2, X, y, ylabel=None)
    -for split, style in ((0.1973, "k-"), (0.0917, "k--"), (0.7718, "k--")):
    -    plt.plot([split, split], [-0.2, 1], style, linewidth=2)
    -for split in (0.0458, 0.1298, 0.2873, 0.9040):
    -    plt.plot([split, split], [-0.2, 1], "k:", linewidth=1)
    -plt.text(0.3, 0.5, "Depth=2", fontsize=13)
    -plt.title("max_depth=3", fontsize=14)
    -
    -plt.show()
    -
    -

    - - -

    tree_reg1 = DecisionTreeRegressor(random_state=42)
    -tree_reg2 = DecisionTreeRegressor(random_state=42, min_samples_leaf=10)
    -tree_reg1.fit(X, y)
    -tree_reg2.fit(X, y)
    -
    -x1 = np.linspace(0, 1, 500).reshape(-1, 1)
    -y_pred1 = tree_reg1.predict(x1)
    -y_pred2 = tree_reg2.predict(x1)
    -
    -plt.figure(figsize=(11, 4))
    -
    -plt.subplot(121)
    -plt.plot(X, y, "b.")
    -plt.plot(x1, y_pred1, "r.-", linewidth=2, label=r"$\hat{y}$")
    -plt.axis([0, 1, -0.2, 1.1])
    -plt.xlabel("$x_1$", fontsize=18)
    -plt.ylabel("$y$", fontsize=18, rotation=0)
    -plt.legend(loc="upper center", fontsize=18)
    -plt.title("No restrictions", fontsize=14)
    -
    -plt.subplot(122)
    -plt.plot(X, y, "b.")
    -plt.plot(x1, y_pred2, "r.-", linewidth=2, label=r"$\hat{y}$")
    -plt.axis([0, 1, -0.2, 1.1])
    -plt.xlabel("$x_1$", fontsize=18)
    -plt.title("min_samples_leaf={}".format(tree_reg2.min_samples_leaf), fontsize=14)
    -
    -plt.show()
    +tree_reg = DecisionTreeRegressor(max_depth=2, random_state=42)
    +tree_reg.fit(X, y)
     

    @@ -252,7 +198,7 @@ plt.show()

  • 26
  • 27
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs018.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs018.html index ce005bb93..ed238f680 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs018.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs018.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -151,30 +153,80 @@ MathJax.Hub.Config({ -

    Classification again: The zoo data

    +

    Final regressor code

    -

    import pandas as pd
    -import numpy as np
    -from pprint import pprint
    -from sklearn.tree import DecisionTreeClassifier
    +
    from sklearn.tree import DecisionTreeRegressor
     
    -#Import the dataset 
    -dataset = pd.read_csv('data/zoo.csv')
    -#We drop the animal names since this is not a good feature to split the data on
    -#dataset=dataset.drop('animal_name',axis=1)
    -#Split the data into a training and a testing set
    -train_features = dataset.iloc[:80,:-1]
    -test_features = dataset.iloc[80:,:-1]
    -train_targets = dataset.iloc[:80,-1]
    -test_targets = dataset.iloc[80:,-1]
    -#Train the model
    -tree = DecisionTreeClassifier(criterion = 'entropy').fit(train_features,train_targets)
    -#Predict the classes of new, unseen data
    -prediction = tree.predict(test_features)
    -#Check the accuracy
    -print("The prediction accuracy is: ",tree.score(test_features,test_targets)*100,"%")
    +tree_reg1 = DecisionTreeRegressor(random_state=42, max_depth=2)
    +tree_reg2 = DecisionTreeRegressor(random_state=42, max_depth=3)
    +tree_reg1.fit(X, y)
    +tree_reg2.fit(X, y)
    +
    +def plot_regression_predictions(tree_reg, X, y, axes=[0, 1, -0.2, 1], ylabel="$y$"):
    +    x1 = np.linspace(axes[0], axes[1], 500).reshape(-1, 1)
    +    y_pred = tree_reg.predict(x1)
    +    plt.axis(axes)
    +    plt.xlabel("$x_1$", fontsize=18)
    +    if ylabel:
    +        plt.ylabel(ylabel, fontsize=18, rotation=0)
    +    plt.plot(X, y, "b.")
    +    plt.plot(x1, y_pred, "r.-", linewidth=2, label=r"$\hat{y}$")
    +
    +plt.figure(figsize=(11, 4))
    +plt.subplot(121)
    +plot_regression_predictions(tree_reg1, X, y)
    +for split, style in ((0.1973, "k-"), (0.0917, "k--"), (0.7718, "k--")):
    +    plt.plot([split, split], [-0.2, 1], style, linewidth=2)
    +plt.text(0.21, 0.65, "Depth=0", fontsize=15)
    +plt.text(0.01, 0.2, "Depth=1", fontsize=13)
    +plt.text(0.65, 0.8, "Depth=1", fontsize=13)
    +plt.legend(loc="upper center", fontsize=18)
    +plt.title("max_depth=2", fontsize=14)
    +
    +plt.subplot(122)
    +plot_regression_predictions(tree_reg2, X, y, ylabel=None)
    +for split, style in ((0.1973, "k-"), (0.0917, "k--"), (0.7718, "k--")):
    +    plt.plot([split, split], [-0.2, 1], style, linewidth=2)
    +for split in (0.0458, 0.1298, 0.2873, 0.9040):
    +    plt.plot([split, split], [-0.2, 1], "k:", linewidth=1)
    +plt.text(0.3, 0.5, "Depth=2", fontsize=13)
    +plt.title("max_depth=3", fontsize=14)
    +
    +plt.show()
    +
    +

    + + +

    tree_reg1 = DecisionTreeRegressor(random_state=42)
    +tree_reg2 = DecisionTreeRegressor(random_state=42, min_samples_leaf=10)
    +tree_reg1.fit(X, y)
    +tree_reg2.fit(X, y)
    +
    +x1 = np.linspace(0, 1, 500).reshape(-1, 1)
    +y_pred1 = tree_reg1.predict(x1)
    +y_pred2 = tree_reg2.predict(x1)
    +
    +plt.figure(figsize=(11, 4))
    +
    +plt.subplot(121)
    +plt.plot(X, y, "b.")
    +plt.plot(x1, y_pred1, "r.-", linewidth=2, label=r"$\hat{y}$")
    +plt.axis([0, 1, -0.2, 1.1])
    +plt.xlabel("$x_1$", fontsize=18)
    +plt.ylabel("$y$", fontsize=18, rotation=0)
    +plt.legend(loc="upper center", fontsize=18)
    +plt.title("No restrictions", fontsize=14)
    +
    +plt.subplot(122)
    +plt.plot(X, y, "b.")
    +plt.plot(x1, y_pred2, "r.-", linewidth=2, label=r"$\hat{y}$")
    +plt.axis([0, 1, -0.2, 1.1])
    +plt.xlabel("$x_1$", fontsize=18)
    +plt.title("min_samples_leaf={}".format(tree_reg2.min_samples_leaf), fontsize=14)
    +
    +plt.show()
     

    @@ -202,7 +254,7 @@ prediction = tree27

  • 28
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs019.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs019.html index 34d93e91f..72ef26466 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs019.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs019.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -151,18 +153,32 @@ MathJax.Hub.Config({ -

    Pros and cons of trees, pros

    +

    Classification again: The zoo data

    +

    -

      -
    • White box, easy to interpret model. Some people believe that decision trees more closely mirror human decision-making than do the regression and classification approaches discussed earlier (think of support vector machines)
    • -
    • Trees are very easy to explain to people. In fact, they are even easier to explain than linear regression!
    • -
    • No feature normalization needed
    • -
    • Tree models can handle both continuous and categorical data (Classification and Regression Trees)
    • -
    • Can model nonlinear relationships
    • -
    • Can model interactions between the different descriptive features
    • -
    • Trees can be displayed graphically, and are easily interpreted even by a non-expert (especially if they are small)
    • -
    + +
    import pandas as pd
    +import numpy as np
    +from pprint import pprint
    +from sklearn.tree import DecisionTreeClassifier
     
    +#Import the dataset 
    +dataset = pd.read_csv('data/zoo.csv')
    +#We drop the animal names since this is not a good feature to split the data on
    +#dataset=dataset.drop('animal_name',axis=1)
    +#Split the data into a training and a testing set
    +train_features = dataset.iloc[:80,:-1]
    +test_features = dataset.iloc[80:,:-1]
    +train_targets = dataset.iloc[:80,-1]
    +test_targets = dataset.iloc[80:,-1]
    +#Train the model
    +tree = DecisionTreeClassifier(criterion = 'entropy').fit(train_features,train_targets)
    +#Predict the classes of new, unseen data
    +prediction = tree.predict(test_features)
    +#Check the accuracy
    +print("The prediction accuracy is: ",tree.score(test_features,test_targets)*100,"%")
    +
    +

      @@ -187,6 +203,8 @@ MathJax.Hub.Config({
    • 27
    • 28
    • 29
    • +
    • ...
    • +
    • 30
    • »
    diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs020.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs020.html index da19fc24a..acb681e9b 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs020.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs020.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -151,21 +153,18 @@ MathJax.Hub.Config({ -

    Disadvantages

    +

    Pros and cons of trees, pros

      -
    • Unfortunately, trees generally do not have the same level of predictive accuracy as some of the other regression and classification approaches
    • -
    • If continuous features are used the tree may become quite large and hence less interpretable
    • -
    • Decision trees are prone to overfit the training data and hence do not well generalize the data if no stopping criteria or improvements like pruning, boosting or bagging are implemented
    • -
    • Small changes in the data may lead to a completely different tree. This issue can be addressed by using ensemble methods like bagging, boosting or random forests
    • -
    • Unbalanced datasets where some target feature values occur much more frequently than others may lead to biased trees since the frequently occurring feature values are preferred over the less frequently occurring ones.
    • -
    • If the number of features is relatively large (high dimensional) and the number of instances is relatively low, the tree might overfit the data
    • -
    • Features with many levels may be preferred over features with less levels since for them it is more easy to split the dataset such that the sub datasets only contain pure target feature values. This issue can be addressed by preferring for instance the information gain ratio as splitting criteria over information gain
    • +
    • White box, easy to interpret model. Some people believe that decision trees more closely mirror human decision-making than do the regression and classification approaches discussed earlier (think of support vector machines)
    • +
    • Trees are very easy to explain to people. In fact, they are even easier to explain than linear regression!
    • +
    • No feature normalization needed
    • +
    • Tree models can handle both continuous and categorical data (Classification and Regression Trees)
    • +
    • Can model nonlinear relationships
    • +
    • Can model interactions between the different descriptive features
    • +
    • Trees can be displayed graphically, and are easily interpreted even by a non-expert (especially if they are small)
    -However, by aggregating many decision trees, using methods like bagging, random forests, and boosting, the predictive performance of trees can be substantially improved. - -

      @@ -189,6 +188,7 @@ However, by aggregating many decision trees, using methods like bagging, random
    • 27
    • 28
    • 29
    • +
    • 30
    • »
    diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs021.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs021.html index e8830c419..7a7da7bfd 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs021.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs021.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -151,45 +153,19 @@ MathJax.Hub.Config({ -

    Bagging

    +

    Disadvantages

    -

    -The plain decision trees suffer from high -variance. This means that if we split the training data into two parts -at random, and fit a decision tree to both halves, the results that we -get could be quite different. In contrast, a procedure with low -variance will yield similar results if applied repeatedly to distinct -data sets; linear regression tends to have low variance, if the ratio -of \( n \) to \( p \) is moderately large. +

      +
    • Unfortunately, trees generally do not have the same level of predictive accuracy as some of the other regression and classification approaches
    • +
    • If continuous features are used the tree may become quite large and hence less interpretable
    • +
    • Decision trees are prone to overfit the training data and hence do not well generalize the data if no stopping criteria or improvements like pruning, boosting or bagging are implemented
    • +
    • Small changes in the data may lead to a completely different tree. This issue can be addressed by using ensemble methods like bagging, boosting or random forests
    • +
    • Unbalanced datasets where some target feature values occur much more frequently than others may lead to biased trees since the frequently occurring feature values are preferred over the less frequently occurring ones.
    • +
    • If the number of features is relatively large (high dimensional) and the number of instances is relatively low, the tree might overfit the data
    • +
    • Features with many levels may be preferred over features with less levels since for them it is more easy to split the dataset such that the sub datasets only contain pure target feature values. This issue can be addressed by preferring for instance the information gain ratio as splitting criteria over information gain
    • +
    -

    -Bootstrap aggregation, or just bagging, is a -general-purpose procedure for reducing the variance of a statistical -learning method. - -

    -Bagging typically results in improved accuracy -over prediction using a single tree. Unfortunately, however, it can be -difficult to interpret the resulting model. Recall that one of the -advantages of decision trees is the attractive and easily interpreted -diagram that results. - -

    -However, when we bag a large number of trees, it is no longer -possible to represent the resulting statistical learning procedure -using a single tree, and it is no longer clear which variables are -most important to the procedure. Thus, bagging improves prediction -accuracy at the expense of interpretability. Although the collection -of bagged trees is much more difficult to interpret than a single -tree, one can obtain an overall summary of the importance of each -predictor using the MSE (for bagging regression trees) or the Gini -index (for bagging classification trees). In the case of bagging -regression trees, we can record the total amount that the MSE is -decreased due to splits over a given predictor, averaged over all \( B \) possible -trees. A large value indicates an important predictor. Similarly, in -the context of bagging classification trees, we can add up the total -amount that the Gini index is decreased by splits over a given -predictor, averaged over all \( B \) trees. +However, by aggregating many decision trees, using methods like bagging, random forests, and boosting, the predictive performance of trees can be substantially improved.

    @@ -214,6 +190,7 @@ predictor, averaged over all \( B \) trees.

  • 27
  • 28
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs022.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs022.html index 6b4671aa8..171c2bc2e 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs022.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs022.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -151,23 +153,46 @@ MathJax.Hub.Config({ -

    Simple example, head or tail

    -

    +

    Bagging

    + +

    +The plain decision trees suffer from high +variance. This means that if we split the training data into two parts +at random, and fit a decision tree to both halves, the results that we +get could be quite different. In contrast, a procedure with low +variance will yield similar results if applied repeatedly to distinct +data sets; linear regression tends to have low variance, if the ratio +of \( n \) to \( p \) is moderately large. + +

    +Bootstrap aggregation, or just bagging, is a +general-purpose procedure for reducing the variance of a statistical +learning method. + +

    +Bagging typically results in improved accuracy +over prediction using a single tree. Unfortunately, however, it can be +difficult to interpret the resulting model. Recall that one of the +advantages of decision trees is the attractive and easily interpreted +diagram that results. + +

    +However, when we bag a large number of trees, it is no longer +possible to represent the resulting statistical learning procedure +using a single tree, and it is no longer clear which variables are +most important to the procedure. Thus, bagging improves prediction +accuracy at the expense of interpretability. Although the collection +of bagged trees is much more difficult to interpret than a single +tree, one can obtain an overall summary of the importance of each +predictor using the MSE (for bagging regression trees) or the Gini +index (for bagging classification trees). In the case of bagging +regression trees, we can record the total amount that the MSE is +decreased due to splits over a given predictor, averaged over all \( B \) possible +trees. A large value indicates an important predictor. Similarly, in +the context of bagging classification trees, we can add up the total +amount that the Gini index is decreased by splits over a given +predictor, averaged over all \( B \) trees. - -

    heads_proba = 0.51
    -coin_tosses = (np.random.rand(10000, 10) < heads_proba).astype(np.int32)
    -cumulative_heads_ratio = np.cumsum(coin_tosses, axis=0) / np.arange(1, 10001).reshape(-1, 1)
    -plt.figure(figsize=(8,3.5))
    -plt.plot(cumulative_heads_ratio)
    -plt.plot([0, 10000], [0.51, 0.51], "k--", linewidth=2, label="51%")
    -plt.plot([0, 10000], [0.5, 0.5], "k-", label="50%")
    -plt.xlabel("Number of coin tosses")
    -plt.ylabel("Heads ratio")
    -plt.legend(loc="lower right")
    -plt.axis([0, 10000, 0.42, 0.58])
    -plt.show()
    -

    @@ -190,6 +215,7 @@ plt.show()

  • 27
  • 28
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs023.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs023.html index 86309fd55..1507561b9 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs023.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs023.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -151,45 +153,23 @@ MathJax.Hub.Config({ -

    Random forests

    - +

    Simple example, head or tail

    -Random forests provide an improvement over bagged trees by way of a -small tweak that decorrelates the trees. - -

    -As in bagging, we build a -number of decision trees on bootstrapped training samples. But when -building these decision trees, each time a split in a tree is -considered, a random sample of \( m \) predictors is chosen as split -candidates from the full set of \( p \) predictors. The split is allowed to -use only one of those \( m \) predictors. - -

    -A fresh sample of \( m \) predictors is -taken at each split, and typically we choose -$$ -m\approx \sqrt{p}. -$$ - -In building a random forest, at -each split in the tree, the algorithm is not even allowed to consider -a majority of the available predictors. - -

    -The reason for this is rather clever. Suppose that there is one very -strong predictor in the data set, along with a number of other -moderately strong predictors. Then in the collection of bagged -variable importance random forest trees, most or all of the trees will -use this strong predictor in the top split. Consequently, all of the -bagged trees will look quite similar to each other. Hence the -predictions from the bagged trees will be highly correlated. -Unfortunately, averaging many highly correlated quantities does not lead -to as large of a reduction in variance as averaging many uncorrelated -quanti- ties. In particular, this means that bagging will not lead to -a substantial reduction in variance over a single tree in this -setting. + +

    heads_proba = 0.51
    +coin_tosses = (np.random.rand(10000, 10) < heads_proba).astype(np.int32)
    +cumulative_heads_ratio = np.cumsum(coin_tosses, axis=0) / np.arange(1, 10001).reshape(-1, 1)
    +plt.figure(figsize=(8,3.5))
    +plt.plot(cumulative_heads_ratio)
    +plt.plot([0, 10000], [0.51, 0.51], "k--", linewidth=2, label="51%")
    +plt.plot([0, 10000], [0.5, 0.5], "k-", label="50%")
    +plt.xlabel("Number of coin tosses")
    +plt.ylabel("Heads ratio")
    +plt.legend(loc="lower right")
    +plt.axis([0, 10000, 0.42, 0.58])
    +plt.show()
    +

    @@ -211,6 +191,7 @@ setting.

  • 27
  • 28
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs024.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs024.html index d942f8c95..1d971fb82 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs024.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs024.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -151,21 +153,45 @@ MathJax.Hub.Config({ -

    A simple scikit-learn example

    -

    +

    Random forests

    + +

    +Random forests provide an improvement over bagged trees by way of a +small tweak that decorrelates the trees. + +

    +As in bagging, we build a +number of decision trees on bootstrapped training samples. But when +building these decision trees, each time a split in a tree is +considered, a random sample of \( m \) predictors is chosen as split +candidates from the full set of \( p \) predictors. The split is allowed to +use only one of those \( m \) predictors. + +

    +A fresh sample of \( m \) predictors is +taken at each split, and typically we choose +$$ +m\approx \sqrt{p}. +$$ + +In building a random forest, at +each split in the tree, the algorithm is not even allowed to consider +a majority of the available predictors. + +

    +The reason for this is rather clever. Suppose that there is one very +strong predictor in the data set, along with a number of other +moderately strong predictors. Then in the collection of bagged +variable importance random forest trees, most or all of the trees will +use this strong predictor in the top split. Consequently, all of the +bagged trees will look quite similar to each other. Hence the +predictions from the bagged trees will be highly correlated. +Unfortunately, averaging many highly correlated quantities does not lead +to as large of a reduction in variance as averaging many uncorrelated +quanti- ties. In particular, this means that bagging will not lead to +a substantial reduction in variance over a single tree in this +setting. - -

    from sklearn.ensemble import RandomForestClassifier
    -from sklearn.preprocessing import LabelEncoder
    -from sklearn.model_selection import cross_validate
    -# Data set not specificied
    -X = dataset.XXX
    -Y = dataset.YYY
    -#Instantiate the model with 100 trees and entropy as splitting criteria
    -Random_Forest_model = RandomForestClassifier(n_estimators=100,criterion="entropy")
    -#Cross validation
    -accuracy = cross_validate(Random_Forest_model,X,Y,cv=10)['test_score']
    -

    @@ -186,6 +212,7 @@ accuracy = cross_validate(Random_Forest_mode

  • 27
  • 28
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs025.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs025.html index 1b082ee4b..8b56b1b06 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs025.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs025.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -151,60 +153,20 @@ MathJax.Hub.Config({ -

    Please, not the moons again!

    +

    A simple scikit-learn example

    -

    from sklearn.model_selection import train_test_split
    -from sklearn.datasets import make_moons
    -
    -X, y = make_moons(n_samples=500, noise=0.30, random_state=42)
    -X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)
    -from sklearn.ensemble import RandomForestClassifier
    -from sklearn.ensemble import VotingClassifier
    -from sklearn.linear_model import LogisticRegression
    -from sklearn.svm import SVC
    -
    -log_clf = LogisticRegression(random_state=42)
    -rnd_clf = RandomForestClassifier(random_state=42)
    -svm_clf = SVC(random_state=42)
    -
    -voting_clf = VotingClassifier(
    -    estimators=[('lr', log_clf), ('rf', rnd_clf), ('svc', svm_clf)],
    -    voting='hard')
    -voting_clf.fit(X_train, y_train)
    -
    -

    - - -

    from sklearn.metrics import accuracy_score
    -
    -for clf in (log_clf, rnd_clf, svm_clf, voting_clf):
    -    clf.fit(X_train, y_train)
    -    y_pred = clf.predict(X_test)
    -    print(clf.__class__.__name__, accuracy_score(y_test, y_pred))
    -
    -

    - - -

    log_clf = LogisticRegression(random_state=42)
    -rnd_clf = RandomForestClassifier(random_state=42)
    -svm_clf = SVC(probability=True, random_state=42)
    -
    -voting_clf = VotingClassifier(
    -    estimators=[('lr', log_clf), ('rf', rnd_clf), ('svc', svm_clf)],
    -    voting='soft')
    -voting_clf.fit(X_train, y_train)
    -
    -

    - - -

    from sklearn.metrics import accuracy_score
    -
    -for clf in (log_clf, rnd_clf, svm_clf, voting_clf):
    -    clf.fit(X_train, y_train)
    -    y_pred = clf.predict(X_test)
    -    print(clf.__class__.__name__, accuracy_score(y_test, y_pred))
    +
    from sklearn.ensemble import RandomForestClassifier
    +from sklearn.preprocessing import LabelEncoder
    +from sklearn.model_selection import cross_validate
    +# Data set not specificied
    +X = dataset.XXX
    +Y = dataset.YYY
    +#Instantiate the model with 100 trees and entropy as splitting criteria
    +Random_Forest_model = RandomForestClassifier(n_estimators=100,criterion="entropy")
    +#Cross validation
    +accuracy = cross_validate(Random_Forest_model,X,Y,cv=10)['test_score']
     

    @@ -225,6 +187,7 @@ voting_clf.fit(X_train, y_train)

  • 27
  • 28
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs026.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs026.html index 7dc66df89..eb655212c 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs026.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs026.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -151,63 +153,60 @@ MathJax.Hub.Config({ -

    Bagging examples

    - +

    Please, not the moons again!

    -

    from sklearn.ensemble import BaggingClassifier
    -from sklearn.tree import DecisionTreeClassifier
    +
    from sklearn.model_selection import train_test_split
    +from sklearn.datasets import make_moons
     
    -bag_clf = BaggingClassifier(
    -    DecisionTreeClassifier(random_state=42), n_estimators=500,
    -    max_samples=100, bootstrap=True, n_jobs=-1, random_state=42)
    -bag_clf.fit(X_train, y_train)
    -y_pred = bag_clf.predict(X_test)
    +X, y = make_moons(n_samples=500, noise=0.30, random_state=42)
    +X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)
    +from sklearn.ensemble import RandomForestClassifier
    +from sklearn.ensemble import VotingClassifier
    +from sklearn.linear_model import LogisticRegression
    +from sklearn.svm import SVC
    +
    +log_clf = LogisticRegression(random_state=42)
    +rnd_clf = RandomForestClassifier(random_state=42)
    +svm_clf = SVC(random_state=42)
    +
    +voting_clf = VotingClassifier(
    +    estimators=[('lr', log_clf), ('rf', rnd_clf), ('svc', svm_clf)],
    +    voting='hard')
    +voting_clf.fit(X_train, y_train)
     

    from sklearn.metrics import accuracy_score
    -print(accuracy_score(y_test, y_pred))
    +
    +for clf in (log_clf, rnd_clf, svm_clf, voting_clf):
    +    clf.fit(X_train, y_train)
    +    y_pred = clf.predict(X_test)
    +    print(clf.__class__.__name__, accuracy_score(y_test, y_pred))
     

    -

    tree_clf = DecisionTreeClassifier(random_state=42)
    -tree_clf.fit(X_train, y_train)
    -y_pred_tree = tree_clf.predict(X_test)
    -print(accuracy_score(y_test, y_pred_tree))
    +
    log_clf = LogisticRegression(random_state=42)
    +rnd_clf = RandomForestClassifier(random_state=42)
    +svm_clf = SVC(probability=True, random_state=42)
    +
    +voting_clf = VotingClassifier(
    +    estimators=[('lr', log_clf), ('rf', rnd_clf), ('svc', svm_clf)],
    +    voting='soft')
    +voting_clf.fit(X_train, y_train)
     

    -

    from matplotlib.colors import ListedColormap
    +
    from sklearn.metrics import accuracy_score
     
    -def plot_decision_boundary(clf, X, y, axes=[-1.5, 2.5, -1, 1.5], alpha=0.5, contour=True):
    -    x1s = np.linspace(axes[0], axes[1], 100)
    -    x2s = np.linspace(axes[2], axes[3], 100)
    -    x1, x2 = np.meshgrid(x1s, x2s)
    -    X_new = np.c_[x1.ravel(), x2.ravel()]
    -    y_pred = clf.predict(X_new).reshape(x1.shape)
    -    custom_cmap = ListedColormap(['#fafab0','#9898ff','#a0faa0'])
    -    plt.contourf(x1, x2, y_pred, alpha=0.3, cmap=custom_cmap)
    -    if contour:
    -        custom_cmap2 = ListedColormap(['#7d7d58','#4c4c7f','#507d50'])
    -        plt.contour(x1, x2, y_pred, cmap=custom_cmap2, alpha=0.8)
    -    plt.plot(X[:, 0][y==0], X[:, 1][y==0], "yo", alpha=alpha)
    -    plt.plot(X[:, 0][y==1], X[:, 1][y==1], "bs", alpha=alpha)
    -    plt.axis(axes)
    -    plt.xlabel(r"$x_1$", fontsize=18)
    -    plt.ylabel(r"$x_2$", fontsize=18, rotation=0)
    -plt.figure(figsize=(11,4))
    -plt.subplot(121)
    -plot_decision_boundary(tree_clf, X, y)
    -plt.title("Decision Tree", fontsize=14)
    -plt.subplot(122)
    -plot_decision_boundary(bag_clf, X, y)
    -plt.title("Decision Trees with Bagging", fontsize=14)
    -plt.show()
    +for clf in (log_clf, rnd_clf, svm_clf, voting_clf):
    +    clf.fit(X_train, y_train)
    +    y_pred = clf.predict(X_test)
    +    print(clf.__class__.__name__, accuracy_score(y_test, y_pred))
     

    @@ -227,6 +226,7 @@ plt.show()

  • 27
  • 28
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs027.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs027.html index 2e4f05ceb..cbc21c2d6 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs027.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs027.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -151,24 +153,63 @@ MathJax.Hub.Config({ -

    Then random forests

    +

    Bagging examples

    +

    -

    bag_clf = BaggingClassifier(
    -    DecisionTreeClassifier(splitter="random", max_leaf_nodes=16, random_state=42),
    -    n_estimators=500, max_samples=1.0, bootstrap=True, n_jobs=-1, random_state=42)
    +
    from sklearn.ensemble import BaggingClassifier
    +from sklearn.tree import DecisionTreeClassifier
    +
    +bag_clf = BaggingClassifier(
    +    DecisionTreeClassifier(random_state=42), n_estimators=500,
    +    max_samples=100, bootstrap=True, n_jobs=-1, random_state=42)
    +bag_clf.fit(X_train, y_train)
    +y_pred = bag_clf.predict(X_test)
     

    -

    bag_clf.fit(X_train, y_train)
    -y_pred = bag_clf.predict(X_test)
    -from sklearn.ensemble import RandomForestClassifier
    -rnd_clf = RandomForestClassifier(n_estimators=500, max_leaf_nodes=16, n_jobs=-1, random_state=42)
    -rnd_clf.fit(X_train, y_train)
    -y_pred_rf = rnd_clf.predict(X_test)
    -np.sum(y_pred == y_pred_rf) / len(y_pred) 
    +
    from sklearn.metrics import accuracy_score
    +print(accuracy_score(y_test, y_pred))
    +
    +

    + + +

    tree_clf = DecisionTreeClassifier(random_state=42)
    +tree_clf.fit(X_train, y_train)
    +y_pred_tree = tree_clf.predict(X_test)
    +print(accuracy_score(y_test, y_pred_tree))
    +
    +

    + + +

    from matplotlib.colors import ListedColormap
    +
    +def plot_decision_boundary(clf, X, y, axes=[-1.5, 2.5, -1, 1.5], alpha=0.5, contour=True):
    +    x1s = np.linspace(axes[0], axes[1], 100)
    +    x2s = np.linspace(axes[2], axes[3], 100)
    +    x1, x2 = np.meshgrid(x1s, x2s)
    +    X_new = np.c_[x1.ravel(), x2.ravel()]
    +    y_pred = clf.predict(X_new).reshape(x1.shape)
    +    custom_cmap = ListedColormap(['#fafab0','#9898ff','#a0faa0'])
    +    plt.contourf(x1, x2, y_pred, alpha=0.3, cmap=custom_cmap)
    +    if contour:
    +        custom_cmap2 = ListedColormap(['#7d7d58','#4c4c7f','#507d50'])
    +        plt.contour(x1, x2, y_pred, cmap=custom_cmap2, alpha=0.8)
    +    plt.plot(X[:, 0][y==0], X[:, 1][y==0], "yo", alpha=alpha)
    +    plt.plot(X[:, 0][y==1], X[:, 1][y==1], "bs", alpha=alpha)
    +    plt.axis(axes)
    +    plt.xlabel(r"$x_1$", fontsize=18)
    +    plt.ylabel(r"$x_2$", fontsize=18, rotation=0)
    +plt.figure(figsize=(11,4))
    +plt.subplot(121)
    +plot_decision_boundary(tree_clf, X, y)
    +plt.title("Decision Tree", fontsize=14)
    +plt.subplot(122)
    +plot_decision_boundary(bag_clf, X, y)
    +plt.title("Decision Trees with Bagging", fontsize=14)
    +plt.show()
     

    @@ -187,6 +228,7 @@ np.sum(y_pred =

  • 27
  • 28
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs028.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs028.html index 1c8ec847d..a1cd7a19d 100644 --- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs028.html +++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs028.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -149,11 +151,28 @@ MathJax.Hub.Config({

     

     

     

    - + -

    Boosting and more

    -More material to come here. +

    Then random forests

    +

    + +

    bag_clf = BaggingClassifier(
    +    DecisionTreeClassifier(splitter="random", max_leaf_nodes=16, random_state=42),
    +    n_estimators=500, max_samples=1.0, bootstrap=True, n_jobs=-1, random_state=42)
    +
    +

    + + +

    bag_clf.fit(X_train, y_train)
    +y_pred = bag_clf.predict(X_test)
    +from sklearn.ensemble import RandomForestClassifier
    +rnd_clf = RandomForestClassifier(n_estimators=500, max_leaf_nodes=16, n_jobs=-1, random_state=42)
    +rnd_clf.fit(X_train, y_train)
    +y_pred_rf = rnd_clf.predict(X_test)
    +np.sum(y_pred == y_pred_rf) / len(y_pred) 
    +
    +

      @@ -169,6 +188,8 @@ More material to come here.
    • 27
    • 28
    • 29
    • +
    • 30
    • +
    • »
    diff --git a/doc/pub/DecisionTrees/html/DecisionTrees-bs.html b/doc/pub/DecisionTrees/html/DecisionTrees-bs.html index f26bb4feb..1c0439170 100644 --- a/doc/pub/DecisionTrees/html/DecisionTrees-bs.html +++ b/doc/pub/DecisionTrees/html/DecisionTrees-bs.html @@ -56,21 +56,22 @@ Automatically generated HTML file from DocOnce source ('A schematic procedure', 2, None, '___sec10'), ('A classification tree', 2, None, '___sec11'), ('Growing a classification tree', 2, None, '___sec12'), - ('Back to moons again', 2, None, '___sec13'), - ('Playing around with regions', 2, None, '___sec14'), - ('Regression trees', 2, None, '___sec15'), - ('Final regressor code', 2, None, '___sec16'), - ('Classification again: The zoo data', 2, None, '___sec17'), - ('Pros and cons of trees, pros', 2, None, '___sec18'), - ('Disadvantages', 2, None, '___sec19'), - ('Bagging', 2, None, '___sec20'), - ('Simple example, head or tail', 2, None, '___sec21'), - ('Random forests', 2, None, '___sec22'), - ('A simple scikit-learn example', 2, None, '___sec23'), - ('Please, not the moons again!', 2, None, '___sec24'), - ('Bagging examples', 2, None, '___sec25'), - ('Then random forests', 2, None, '___sec26'), - ('Boosting and more', 2, None, '___sec27')]} + ('Classification tree, how to split nodes', 2, None, '___sec13'), + ('Back to moons again', 2, None, '___sec14'), + ('Playing around with regions', 2, None, '___sec15'), + ('Regression trees', 2, None, '___sec16'), + ('Final regressor code', 2, None, '___sec17'), + ('Classification again: The zoo data', 2, None, '___sec18'), + ('Pros and cons of trees, pros', 2, None, '___sec19'), + ('Disadvantages', 2, None, '___sec20'), + ('Bagging', 2, None, '___sec21'), + ('Simple example, head or tail', 2, None, '___sec22'), + ('Random forests', 2, None, '___sec23'), + ('A simple scikit-learn example', 2, None, '___sec24'), + ('Please, not the moons again!', 2, None, '___sec25'), + ('Bagging examples', 2, None, '___sec26'), + ('Then random forests', 2, None, '___sec27'), + ('Boosting and more', 2, None, '___sec28')]} end of tocinfo --> @@ -121,21 +122,22 @@ MathJax.Hub.Config({
  • A schematic procedure
  • A classification tree
  • Growing a classification tree
  • -
  • Back to moons again
  • -
  • Playing around with regions
  • -
  • Regression trees
  • -
  • Final regressor code
  • -
  • Classification again: The zoo data
  • -
  • Pros and cons of trees, pros
  • -
  • Disadvantages
  • -
  • Bagging
  • -
  • Simple example, head or tail
  • -
  • Random forests
  • -
  • A simple scikit-learn example
  • -
  • Please, not the moons again!
  • -
  • Bagging examples
  • -
  • Then random forests
  • -
  • Boosting and more
  • +
  • Classification tree, how to split nodes
  • +
  • Back to moons again
  • +
  • Playing around with regions
  • +
  • Regression trees
  • +
  • Final regressor code
  • +
  • Classification again: The zoo data
  • +
  • Pros and cons of trees, pros
  • +
  • Disadvantages
  • +
  • Bagging
  • +
  • Simple example, head or tail
  • +
  • Random forests
  • +
  • A simple scikit-learn example
  • +
  • Please, not the moons again!
  • +
  • Bagging examples
  • +
  • Then random forests
  • +
  • Boosting and more
  • @@ -170,7 +172,7 @@ MathJax.Hub.Config({
    [2] Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University

    -

    Nov 9, 2018

    +

    Nov 10, 2018


    @@ -194,7 +196,7 @@ MathJax.Hub.Config({

  • 9
  • 10
  • ...
  • -
  • 29
  • +
  • 30
  • »
  • diff --git a/doc/pub/DecisionTrees/html/DecisionTrees-reveal.html b/doc/pub/DecisionTrees/html/DecisionTrees-reveal.html index 923147354..6830e82dc 100644 --- a/doc/pub/DecisionTrees/html/DecisionTrees-reveal.html +++ b/doc/pub/DecisionTrees/html/DecisionTrees-reveal.html @@ -148,7 +148,7 @@ MathJax.Hub.Config({
    [2] Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University

     
    -

    Nov 9, 2018

    +

    Nov 10, 2018


    @@ -653,7 +653,14 @@ than is the classification error rate.

    -

    Back to moons again

    +

    Classification tree, how to split nodes

    +If our targets are the outcome of a classification process that takes for example +\( k=1,2,\dots,K \) values, the only thing we need to think of is to set up the splitting criteria for each node. +
    + + +
    +

    Back to moons again

    @@ -726,7 +733,7 @@ plt.show()

    -

    Playing around with regions

    +

    Playing around with regions

    @@ -755,7 +762,7 @@ plt.show()

    -

    Regression trees

    +

    Regression trees

    @@ -778,7 +785,7 @@ tree_reg.fit(X, y)

    -

    Final regressor code

    +

    Final regressor code

    @@ -857,7 +864,7 @@ plt.show()

    -

    Classification again: The zoo data

    +

    Classification again: The zoo data

    @@ -886,7 +893,7 @@ prediction = tree.predict(test_features)

    -

    Pros and cons of trees, pros

    +

    Pros and cons of trees, pros