diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs000.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs000.html
index ab79ad196..04d083734 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs000.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs000.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs001.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs001.html
index 5acb5690b..0817b2bce 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs001.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs001.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs002.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs002.html
index 4f0f56aef..b1e29cb56 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs002.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs002.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs003.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs003.html
index 11615c264..15b696ea9 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs003.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs003.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs004.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs004.html
index 9436cee23..a508831df 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs004.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs004.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs005.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs005.html
index fd649d68c..f37c5bfe5 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs005.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs005.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs006.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs006.html
index 8dbb32a53..3de39230d 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs006.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs006.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs007.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs007.html
index 2dc0ce343..0b5e6e89c 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs007.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs007.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs008.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs008.html
index b474f598a..f94af650e 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs008.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs008.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs009.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs009.html
index 2693c87e2..76b5cf380 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs009.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs009.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs010.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs010.html
index 45d1809cc..7ee3b981d 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs010.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs010.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs011.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs011.html
index 0c22a2e10..cf246be93 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs011.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs011.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs012.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs012.html
index 12d8e3914..430fe05bb 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs012.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs012.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs013.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs013.html
index 9d076f512..8e94771c2 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs013.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs013.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs014.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs014.html
index 7222f2a52..1087f7553 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs014.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs014.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs015.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs015.html
index e0f137c13..e6ffb86b7 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs015.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs015.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs016.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs016.html
index 9bd180251..cb3574a05 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs016.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs016.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs017.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs017.html
index 799a4b092..a59b8b30c 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs017.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs017.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs018.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs018.html
index fd3e369df..c040c67aa 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs018.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs018.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
@@ -177,7 +180,7 @@ MathJax.Hub.Config({
-Simple Python Code to read in Data
+Simple Python Code to read in Data and perform Classification
@@ -186,6 +189,9 @@ MathJax.Hub.Config({
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
+from sklearn.tree import DecisionTreeClassifier
+from sklearn.model_selection import train_test_split
+from sklearn.tree import export_graphviz
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.compose import ColumnTransformer
from IPython.display import Image
@@ -215,26 +221,37 @@ DATA_ID = "
def save_fig(fig_id):
plt.savefig(image_path(fig_id) + ".png", format='png')
-infile = open(data_path("ride.csv"),'r')
+infile = open(data_path("rideclass.csv"),'r')
# Read the experimental data with Pandas
from IPython.display import display
ridedata = pd.read_csv(infile,names = ('Outlook','Temperature','Humidity','Wind','Ride'))
ridedata = pd.DataFrame(ridedata)
-display(ridedata)
+
# Features and targets
X = ridedata.loc[:, ridedata.columns != 'Ride'].values
-display(X)
y = ridedata.loc[:, ridedata.columns == 'Ride'].values
-display(y)
-# Categorical variables to one-hot's
-onehotencoder = OneHotEncoder(categories="auto")
-X = ColumnTransformer([("", onehotencoder)]).fit_transform(X)
-y.shape
-
-display(X)
-display(y)
+# Create the encoder.
+encoder = OneHotEncoder(handle_unknown="ignore")
+# Assume for simplicity all features are categorical.
+encoder.fit(X)
+# Apply the encoder.
+X = encoder.transform(X)
+print(X)
+# Then do a Classification tree
+tree_clf = DecisionTreeClassifier(max_depth=2)
+tree_clf.fit(X, y)
+print("Train set accuracy with Decision Tree: {:.2f}".format(tree_clf.score(X,y)))
+#transfer to a decision tree graph
+export_graphviz(
+ tree_clf,
+ out_file="DataFiles/ride.dot",
+ rounded=True,
+ filled=True
+)
+cmd = 'dot -Tpng DataFiles/cancer.dot -o DataFiles/cancer.png'
+os.system(cmd)
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs019.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs019.html
index 52213c74a..762b618dd 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs019.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs019.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs020.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs020.html
index fc3eaf882..8ecc4b44e 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs020.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs020.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs021.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs021.html
index 8862b0863..8911a2848 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs021.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs021.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs022.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs022.html
index 0530a3bda..d8f20bebc 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs022.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs022.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs023.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs023.html
index e369c4f45..515b4e62d 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs023.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs023.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs024.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs024.html
index b2f7470df..02c32ec42 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs024.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs024.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs025.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs025.html
index 38e372b68..68fe4a2f0 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs025.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs025.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs026.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs026.html
index 1796e10dd..90b999a65 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs026.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs026.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs027.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs027.html
index afeb9be33..a0e34bab1 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs027.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs027.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs028.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs028.html
index 8646025cb..e754e3e50 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs028.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs028.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs029.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs029.html
index 351fcd155..7c6e28014 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs029.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs029.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs030.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs030.html
index 7da1b0026..593692d68 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs030.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs030.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs031.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs031.html
index 3a54259db..a4e1169b8 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs031.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs031.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs032.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs032.html
index 6a2a6ac0f..716eaa920 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs032.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs032.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs033.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs033.html
index 404065ca8..24ca6faad 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs033.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs033.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs034.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs034.html
index 8babd7241..924df127a 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs034.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs034.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs035.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs035.html
index 50cde2289..df2122fd9 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs035.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs035.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs036.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs036.html
index 2393ad333..4fe8b451a 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs036.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs036.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/._DecisionTrees-bs037.html b/doc/pub/DecisionTrees/html/._DecisionTrees-bs037.html
index 397c77e98..bc2bb73ed 100644
--- a/doc/pub/DecisionTrees/html/._DecisionTrees-bs037.html
+++ b/doc/pub/DecisionTrees/html/._DecisionTrees-bs037.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/DecisionTrees-bs.html b/doc/pub/DecisionTrees/html/DecisionTrees-bs.html
index ab79ad196..04d083734 100644
--- a/doc/pub/DecisionTrees/html/DecisionTrees-bs.html
+++ b/doc/pub/DecisionTrees/html/DecisionTrees-bs.html
@@ -65,7 +65,10 @@ Automatically generated HTML file from DocOnce source
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -142,7 +145,7 @@ MathJax.Hub.Config({
Visualizing the Tree, Classification
Visualizing the Tree, The Moons
Computing the Gini index
- Simple Python Code to read in Data
+ Simple Python Code to read in Data and perform Classification
Computing the Gini Factor
Entropy and the ID3 algorithm
Implementing the ID3 Algorithm
diff --git a/doc/pub/DecisionTrees/html/DecisionTrees-reveal.html b/doc/pub/DecisionTrees/html/DecisionTrees-reveal.html
index aef2f82ea..87be866d9 100644
--- a/doc/pub/DecisionTrees/html/DecisionTrees-reveal.html
+++ b/doc/pub/DecisionTrees/html/DecisionTrees-reveal.html
@@ -732,7 +732,7 @@ The table here summarizes the various attributes and
-Simple Python Code to read in Data
+Simple Python Code to read in Data and perform Classification
@@ -741,6 +741,9 @@ The table here summarizes the various attributes and
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
+from sklearn.tree import DecisionTreeClassifier
+from sklearn.model_selection import train_test_split
+from sklearn.tree import export_graphviz
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.compose import ColumnTransformer
from IPython.display import Image
@@ -770,26 +773,37 @@ DATA_ID = "DataFiles/"
def save_fig(fig_id):
plt.savefig(image_path(fig_id) + ".png", format='png')
-infile = open(data_path("ride.csv"),'r')
+infile = open(data_path("rideclass.csv"),'r')
# Read the experimental data with Pandas
from IPython.display import display
ridedata = pd.read_csv(infile,names = ('Outlook','Temperature','Humidity','Wind','Ride'))
ridedata = pd.DataFrame(ridedata)
-display(ridedata)
+
# Features and targets
X = ridedata.loc[:, ridedata.columns != 'Ride'].values
-display(X)
y = ridedata.loc[:, ridedata.columns == 'Ride'].values
-display(y)
-# Categorical variables to one-hot's
-onehotencoder = OneHotEncoder(categories="auto")
-X = ColumnTransformer([("", onehotencoder)]).fit_transform(X)
-y.shape
-
-display(X)
-display(y)
+# Create the encoder.
+encoder = OneHotEncoder(handle_unknown="ignore")
+# Assume for simplicity all features are categorical.
+encoder.fit(X)
+# Apply the encoder.
+X = encoder.transform(X)
+print(X)
+# Then do a Classification tree
+tree_clf = DecisionTreeClassifier(max_depth=2)
+tree_clf.fit(X, y)
+print("Train set accuracy with Decision Tree: {:.2f}".format(tree_clf.score(X,y)))
+#transfer to a decision tree graph
+export_graphviz(
+ tree_clf,
+ out_file="DataFiles/ride.dot",
+ rounded=True,
+ filled=True
+)
+cmd = 'dot -Tpng DataFiles/cancer.dot -o DataFiles/cancer.png'
+os.system(cmd)
diff --git a/doc/pub/DecisionTrees/html/DecisionTrees-solarized.html b/doc/pub/DecisionTrees/html/DecisionTrees-solarized.html
index 94d27f261..320de8458 100644
--- a/doc/pub/DecisionTrees/html/DecisionTrees-solarized.html
+++ b/doc/pub/DecisionTrees/html/DecisionTrees-solarized.html
@@ -85,7 +85,10 @@ div { text-align: justify; text-justify: inter-word; }
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -705,7 +708,7 @@ The table here summarizes the various attributes and
-
Simple Python Code to read in Data
+Simple Python Code to read in Data and perform Classification
@@ -714,6 +717,9 @@ The table here summarizes the various attributes and
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
+from sklearn.tree import DecisionTreeClassifier
+from sklearn.model_selection import train_test_split
+from sklearn.tree import export_graphviz
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.compose import ColumnTransformer
from IPython.display import Image
@@ -743,26 +749,37 @@ DATA_ID = "DataFiles/"
def save_fig(fig_id):
plt.savefig(image_path(fig_id) + ".png", format='png')
-infile = open(data_path("ride.csv"),'r')
+infile = open(data_path("rideclass.csv"),'r')
# Read the experimental data with Pandas
from IPython.display import display
ridedata = pd.read_csv(infile,names = ('Outlook','Temperature','Humidity','Wind','Ride'))
ridedata = pd.DataFrame(ridedata)
-display(ridedata)
+
# Features and targets
X = ridedata.loc[:, ridedata.columns != 'Ride'].values
-display(X)
y = ridedata.loc[:, ridedata.columns == 'Ride'].values
-display(y)
-# Categorical variables to one-hot's
-onehotencoder = OneHotEncoder(categories="auto")
-X = ColumnTransformer([("", onehotencoder)]).fit_transform(X)
-y.shape
-
-display(X)
-display(y)
+# Create the encoder.
+encoder = OneHotEncoder(handle_unknown="ignore")
+# Assume for simplicity all features are categorical.
+encoder.fit(X)
+# Apply the encoder.
+X = encoder.transform(X)
+print(X)
+# Then do a Classification tree
+tree_clf = DecisionTreeClassifier(max_depth=2)
+tree_clf.fit(X, y)
+print("Train set accuracy with Decision Tree: {:.2f}".format(tree_clf.score(X,y)))
+#transfer to a decision tree graph
+export_graphviz(
+ tree_clf,
+ out_file="DataFiles/ride.dot",
+ rounded=True,
+ filled=True
+)
+cmd = 'dot -Tpng DataFiles/cancer.dot -o DataFiles/cancer.png'
+os.system(cmd)
diff --git a/doc/pub/DecisionTrees/html/DecisionTrees.html b/doc/pub/DecisionTrees/html/DecisionTrees.html
index d41c8cb6d..5b6adb746 100644
--- a/doc/pub/DecisionTrees/html/DecisionTrees.html
+++ b/doc/pub/DecisionTrees/html/DecisionTrees.html
@@ -90,7 +90,10 @@ div { text-align: justify; text-justify: inter-word; }
('Visualizing the Tree, Classification', 2, None, '___sec14'),
('Visualizing the Tree, The Moons', 2, None, '___sec15'),
('Computing the Gini index', 2, None, '___sec16'),
- ('Simple Python Code to read in Data', 2, None, '___sec17'),
+ ('Simple Python Code to read in Data and perform Classification',
+ 2,
+ None,
+ '___sec17'),
('Computing the Gini Factor', 2, None, '___sec18'),
('Entropy and the ID3 algorithm', 2, None, '___sec19'),
('Implementing the ID3 Algorithm', 2, None, '___sec20'),
@@ -710,7 +713,7 @@ The table here summarizes the various attributes and
-
Simple Python Code to read in Data
+Simple Python Code to read in Data and perform Classification
@@ -719,6 +722,9 @@ The table here summarizes the various attributes and
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
+from sklearn.tree import DecisionTreeClassifier
+from sklearn.model_selection import train_test_split
+from sklearn.tree import export_graphviz
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.compose import ColumnTransformer
from IPython.display import Image
@@ -748,26 +754,37 @@ DATA_ID = "
def save_fig(fig_id):
plt.savefig(image_path(fig_id) + ".png", format='png')
-infile = open(data_path("ride.csv"),'r')
+infile = open(data_path("rideclass.csv"),'r')
# Read the experimental data with Pandas
from IPython.display import display
ridedata = pd.read_csv(infile,names = ('Outlook','Temperature','Humidity','Wind','Ride'))
ridedata = pd.DataFrame(ridedata)
-display(ridedata)
+
# Features and targets
X = ridedata.loc[:, ridedata.columns != 'Ride'].values
-display(X)
y = ridedata.loc[:, ridedata.columns == 'Ride'].values
-display(y)
-# Categorical variables to one-hot's
-onehotencoder = OneHotEncoder(categories="auto")
-X = ColumnTransformer([("", onehotencoder)]).fit_transform(X)
-y.shape
-
-display(X)
-display(y)
+# Create the encoder.
+encoder = OneHotEncoder(handle_unknown="ignore")
+# Assume for simplicity all features are categorical.
+encoder.fit(X)
+# Apply the encoder.
+X = encoder.transform(X)
+print(X)
+# Then do a Classification tree
+tree_clf = DecisionTreeClassifier(max_depth=2)
+tree_clf.fit(X, y)
+print("Train set accuracy with Decision Tree: {:.2f}".format(tree_clf.score(X,y)))
+#transfer to a decision tree graph
+export_graphviz(
+ tree_clf,
+ out_file="DataFiles/ride.dot",
+ rounded=True,
+ filled=True
+)
+cmd = 'dot -Tpng DataFiles/cancer.dot -o DataFiles/cancer.png'
+os.system(cmd)
diff --git a/doc/pub/DecisionTrees/ipynb/DataFiles/cancer.dot b/doc/pub/DecisionTrees/ipynb/DataFiles/cancer.dot
index 5b4b48a9b..252087b50 100644
--- a/doc/pub/DecisionTrees/ipynb/DataFiles/cancer.dot
+++ b/doc/pub/DecisionTrees/ipynb/DataFiles/cancer.dot
@@ -6,11 +6,11 @@ edge [fontname=helvetica] ;
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
2 [label="worst concave points <= 0.135\ngini = 0.031\nsamples = 253\nvalue = [[249, 4]\n[4, 249]]", fillcolor="#e58139ee"] ;
1 -> 2 ;
-3 [label="radius error <= 0.643\ngini = 0.008\nsamples = 242\nvalue = [[241, 1]\n[1, 241]]", fillcolor="#e58139fb"] ;
+3 [label="area error <= 48.975\ngini = 0.008\nsamples = 242\nvalue = [[241, 1]\n[1, 241]]", fillcolor="#e58139fb"] ;
2 -> 3 ;
4 [label="gini = 0.0\nsamples = 239\nvalue = [[239, 0]\n[0, 239]]", fillcolor="#e58139ff"] ;
3 -> 4 ;
-5 [label="worst symmetry <= 0.208\ngini = 0.444\nsamples = 3\nvalue = [[2, 1]\n[1, 2]]", fillcolor="#e5813913"] ;
+5 [label="mean area <= 469.25\ngini = 0.444\nsamples = 3\nvalue = [[2, 1]\n[1, 2]]", fillcolor="#e5813913"] ;
3 -> 5 ;
6 [label="gini = 0.0\nsamples = 1\nvalue = [[0, 1]\n[1, 0]]", fillcolor="#e58139ff"] ;
5 -> 6 ;
@@ -22,7 +22,7 @@ edge [fontname=helvetica] ;
8 -> 9 ;
10 [label="gini = 0.0\nsamples = 3\nvalue = [[0, 3]\n[3, 0]]", fillcolor="#e58139ff"] ;
8 -> 10 ;
-11 [label="mean texture <= 16.22\ngini = 0.278\nsamples = 6\nvalue = [[1, 5]\n[5, 1]]", fillcolor="#e581396b"] ;
+11 [label="worst texture <= 24.785\ngini = 0.278\nsamples = 6\nvalue = [[1, 5]\n[5, 1]]", fillcolor="#e581396b"] ;
1 -> 11 ;
12 [label="gini = 0.0\nsamples = 1\nvalue = [[1, 0]\n[0, 1]]", fillcolor="#e58139ff"] ;
11 -> 12 ;
@@ -30,11 +30,11 @@ edge [fontname=helvetica] ;
11 -> 13 ;
14 [label="worst texture <= 20.645\ngini = 0.202\nsamples = 167\nvalue = [[19, 148]\n[148, 19]]", fillcolor="#e5813994"] ;
0 -> 14 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
-15 [label="worst radius <= 17.74\ngini = 0.375\nsamples = 16\nvalue = [[12, 4]\n[4, 12]]", fillcolor="#e5813938"] ;
+15 [label="worst perimeter <= 116.8\ngini = 0.375\nsamples = 16\nvalue = [[12, 4]\n[4, 12]]", fillcolor="#e5813938"] ;
14 -> 15 ;
16 [label="gini = 0.0\nsamples = 11\nvalue = [[11, 0]\n[0, 11]]", fillcolor="#e58139ff"] ;
15 -> 16 ;
-17 [label="mean texture <= 13.745\ngini = 0.32\nsamples = 5\nvalue = [[1, 4]\n[4, 1]]", fillcolor="#e5813955"] ;
+17 [label="worst texture <= 18.445\ngini = 0.32\nsamples = 5\nvalue = [[1, 4]\n[4, 1]]", fillcolor="#e5813955"] ;
15 -> 17 ;
18 [label="gini = 0.0\nsamples = 1\nvalue = [[1, 0]\n[0, 1]]", fillcolor="#e58139ff"] ;
17 -> 18 ;
@@ -48,10 +48,10 @@ edge [fontname=helvetica] ;
21 -> 22 ;
23 [label="gini = 0.0\nsamples = 6\nvalue = [[6, 0]\n[0, 6]]", fillcolor="#e58139ff"] ;
21 -> 23 ;
-24 [label="worst smoothness <= 0.096\ngini = 0.015\nsamples = 136\nvalue = [[1, 135]\n[135, 1]]", fillcolor="#e58139f7"] ;
+24 [label="fractal dimension error <= 0.013\ngini = 0.015\nsamples = 136\nvalue = [[1, 135]\n[135, 1]]", fillcolor="#e58139f7"] ;
20 -> 24 ;
-25 [label="gini = 0.0\nsamples = 1\nvalue = [[1, 0]\n[0, 1]]", fillcolor="#e58139ff"] ;
+25 [label="gini = 0.0\nsamples = 135\nvalue = [[0, 135]\n[135, 0]]", fillcolor="#e58139ff"] ;
24 -> 25 ;
-26 [label="gini = 0.0\nsamples = 135\nvalue = [[0, 135]\n[135, 0]]", fillcolor="#e58139ff"] ;
+26 [label="gini = 0.0\nsamples = 1\nvalue = [[1, 0]\n[0, 1]]", fillcolor="#e58139ff"] ;
24 -> 26 ;
}
\ No newline at end of file
diff --git a/doc/pub/DecisionTrees/ipynb/DataFiles/cancer.png b/doc/pub/DecisionTrees/ipynb/DataFiles/cancer.png
index 2ceb5e1f8..045c6e0a3 100644
Binary files a/doc/pub/DecisionTrees/ipynb/DataFiles/cancer.png and b/doc/pub/DecisionTrees/ipynb/DataFiles/cancer.png differ
diff --git a/doc/pub/DecisionTrees/ipynb/DecisionTrees.ipynb b/doc/pub/DecisionTrees/ipynb/DecisionTrees.ipynb
index 41458d8a9..a45625ff9 100644
--- a/doc/pub/DecisionTrees/ipynb/DecisionTrees.ipynb
+++ b/doc/pub/DecisionTrees/ipynb/DecisionTrees.ipynb
@@ -629,7 +629,7 @@
"\n",
"\n",
"\n",
- "## Simple Python Code to read in Data"
+ "## Simple Python Code to read in Data and perform Classification"
]
},
{
@@ -644,6 +644,9 @@
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
+ "from sklearn.tree import DecisionTreeClassifier\n",
+ "from sklearn.model_selection import train_test_split\n",
+ "from sklearn.tree import export_graphviz\n",
"from sklearn.preprocessing import StandardScaler, OneHotEncoder\n",
"from sklearn.compose import ColumnTransformer\n",
"from IPython.display import Image \n",
@@ -673,26 +676,37 @@
"def save_fig(fig_id):\n",
" plt.savefig(image_path(fig_id) + \".png\", format='png')\n",
"\n",
- "infile = open(data_path(\"ride.csv\"),'r')\n",
+ "infile = open(data_path(\"rideclass.csv\"),'r')\n",
"\n",
"# Read the experimental data with Pandas\n",
"from IPython.display import display\n",
"ridedata = pd.read_csv(infile,names = ('Outlook','Temperature','Humidity','Wind','Ride'))\n",
"ridedata = pd.DataFrame(ridedata)\n",
- "display(ridedata)\n",
+ "\n",
"# Features and targets\n",
"X = ridedata.loc[:, ridedata.columns != 'Ride'].values\n",
- "display(X)\n",
"y = ridedata.loc[:, ridedata.columns == 'Ride'].values\n",
- "display(y)\n",
- "# Categorical variables to one-hot's\n",
- "onehotencoder = OneHotEncoder(categories=\"auto\")\n",
"\n",
- "X = ColumnTransformer([(\"\", onehotencoder)]).fit_transform(X)\n",
- "y.shape\n",
- "\n",
- "display(X)\n",
- "display(y)"
+ "# Create the encoder.\n",
+ "encoder = OneHotEncoder(handle_unknown=\"ignore\")\n",
+ "# Assume for simplicity all features are categorical.\n",
+ "encoder.fit(X) \n",
+ "# Apply the encoder.\n",
+ "X = encoder.transform(X)\n",
+ "print(X)\n",
+ "# Then do a Classification tree\n",
+ "tree_clf = DecisionTreeClassifier(max_depth=2)\n",
+ "tree_clf.fit(X, y)\n",
+ "print(\"Train set accuracy with Decision Tree: {:.2f}\".format(tree_clf.score(X,y)))\n",
+ "#transfer to a decision tree graph\n",
+ "export_graphviz(\n",
+ " tree_clf,\n",
+ " out_file=\"DataFiles/ride.dot\",\n",
+ " rounded=True,\n",
+ " filled=True\n",
+ ")\n",
+ "cmd = 'dot -Tpng DataFiles/cancer.dot -o DataFiles/cancer.png'\n",
+ "os.system(cmd)"
]
},
{
diff --git a/doc/pub/DecisionTrees/ipynb/ipynb-DecisionTrees-src.tar.gz b/doc/pub/DecisionTrees/ipynb/ipynb-DecisionTrees-src.tar.gz
index 0cb193e00..52ccca548 100644
Binary files a/doc/pub/DecisionTrees/ipynb/ipynb-DecisionTrees-src.tar.gz and b/doc/pub/DecisionTrees/ipynb/ipynb-DecisionTrees-src.tar.gz differ
diff --git a/doc/pub/DecisionTrees/pdf/DecisionTrees-minted.pdf b/doc/pub/DecisionTrees/pdf/DecisionTrees-minted.pdf
index 8adec554f..a5b0a8c31 100644
Binary files a/doc/pub/DecisionTrees/pdf/DecisionTrees-minted.pdf and b/doc/pub/DecisionTrees/pdf/DecisionTrees-minted.pdf differ
diff --git a/doc/src/DecisionTrees/DataFiles/ride.dot b/doc/src/DecisionTrees/DataFiles/ride.dot
new file mode 100644
index 000000000..50aaa7638
--- /dev/null
+++ b/doc/src/DecisionTrees/DataFiles/ride.dot
@@ -0,0 +1,13 @@
+digraph Tree {
+node [shape=box, style="filled, rounded", color="black", fontname=helvetica] ;
+edge [fontname=helvetica] ;
+0 [label="X[7] <= 0.5\ngini = 0.48\nsamples = 15\nvalue = [4, 10, 1]", fillcolor="#39e5818b"] ;
+1 [label="X[1] <= 0.5\ngini = 0.408\nsamples = 14\nvalue = [4, 10, 0]", fillcolor="#39e58199"] ;
+0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
+2 [label="gini = 0.48\nsamples = 10\nvalue = [4, 6, 0]", fillcolor="#39e58155"] ;
+1 -> 2 ;
+3 [label="gini = 0.0\nsamples = 4\nvalue = [0, 4, 0]", fillcolor="#39e581ff"] ;
+1 -> 3 ;
+4 [label="gini = 0.0\nsamples = 1\nvalue = [0, 0, 1]", fillcolor="#8139e5ff"] ;
+0 -> 4 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
+}
\ No newline at end of file
diff --git a/doc/src/DecisionTrees/DecisionTrees.do.txt b/doc/src/DecisionTrees/DecisionTrees.do.txt
index b1286f7b2..d183fceeb 100644
--- a/doc/src/DecisionTrees/DecisionTrees.do.txt
+++ b/doc/src/DecisionTrees/DecisionTrees.do.txt
@@ -498,13 +498,16 @@ The table here summarizes the various attributes and
!split
-===== Simple Python Code to read in Data =====
+===== Simple Python Code to read in Data and perform Classification =====
!bc pycod
# Common imports
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
+from sklearn.tree import DecisionTreeClassifier
+from sklearn.model_selection import train_test_split
+from sklearn.tree import export_graphviz
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.compose import ColumnTransformer
from IPython.display import Image
@@ -534,26 +537,38 @@ def data_path(dat_id):
def save_fig(fig_id):
plt.savefig(image_path(fig_id) + ".png", format='png')
-infile = open(data_path("ride.csv"),'r')
+infile = open(data_path("rideclass.csv"),'r')
# Read the experimental data with Pandas
from IPython.display import display
ridedata = pd.read_csv(infile,names = ('Outlook','Temperature','Humidity','Wind','Ride'))
ridedata = pd.DataFrame(ridedata)
-display(ridedata)
+
# Features and targets
X = ridedata.loc[:, ridedata.columns != 'Ride'].values
-display(X)
y = ridedata.loc[:, ridedata.columns == 'Ride'].values
-display(y)
-# Categorical variables to one-hot's
-onehotencoder = OneHotEncoder(categories="auto")
-X = ColumnTransformer([("", onehotencoder)]).fit_transform(X)
-y.shape
+# Create the encoder.
+encoder = OneHotEncoder(handle_unknown="ignore")
+# Assume for simplicity all features are categorical.
+encoder.fit(X)
+# Apply the encoder.
+X = encoder.transform(X)
+print(X)
+# Then do a Classification tree
+tree_clf = DecisionTreeClassifier(max_depth=2)
+tree_clf.fit(X, y)
+print("Train set accuracy with Decision Tree: {:.2f}".format(tree_clf.score(X,y)))
+#transfer to a decision tree graph
+export_graphviz(
+ tree_clf,
+ out_file="DataFiles/ride.dot",
+ rounded=True,
+ filled=True
+)
+cmd = 'dot -Tpng DataFiles/cancer.dot -o DataFiles/cancer.png'
+os.system(cmd)
-display(X)
-display(y)
!ec
diff --git a/doc/src/DecisionTrees/read.py b/doc/src/DecisionTrees/ride.py
similarity index 72%
rename from doc/src/DecisionTrees/read.py
rename to doc/src/DecisionTrees/ride.py
index 5d2fc64f5..90567fd10 100644
--- a/doc/src/DecisionTrees/read.py
+++ b/doc/src/DecisionTrees/ride.py
@@ -34,45 +34,35 @@ def data_path(dat_id):
def save_fig(fig_id):
plt.savefig(image_path(fig_id) + ".png", format='png')
-infile = open(data_path("ride.csv"),'r')
+infile = open(data_path("rideclass.csv"),'r')
# Read the experimental data with Pandas
from IPython.display import display
ridedata = pd.read_csv(infile,names = ('Outlook','Temperature','Humidity','Wind','Ride'))
ridedata = pd.DataFrame(ridedata)
-display(ridedata)
+
# Features and targets
X = ridedata.loc[:, ridedata.columns != 'Ride'].values
-display(X)
y = ridedata.loc[:, ridedata.columns == 'Ride'].values
-display(y)
-# Categorical variables to one-hot's
-onehotencoder = OneHotEncoder(categories="auto")
-
-X = ColumnTransformer([("", onehotencoder)]).fit_transform(X)
-y.shape
-
-display(X)
-display(y)
-
-
-"""
-X = pd.DataFrame(ridedata.data, columns=ridedata.feature_names)
-y = pd.Categorical.from_codes(ridedata.target, ridedata.target_names)
-y = pd.get_dummies(y)
-
+# Create the encoder.
+encoder = OneHotEncoder(handle_unknown="ignore")
+# Assume for simplicity all features are categorical.
+encoder.fit(X)
+# Apply the encoder.
+X = encoder.transform(X)
+print(X)
+# Then do a Classification tree
tree_clf = DecisionTreeClassifier(max_depth=2)
tree_clf.fit(X, y)
-
-
+print("Train set accuracy with Decision Tree: {:.2f}".format(tree_clf.score(X,y)))
+#transfer to a decision tree graph
export_graphviz(
tree_clf,
- out_file="ride.dot",
- feature_names=tree_clf.feature_names,
- class_names=tree_clf.target_names,
+ out_file="DataFiles/ride.dot",
rounded=True,
filled=True
)
-"""
+cmd = 'dot -Tpng DataFiles/cancer.dot -o DataFiles/cancer.png'
+os.system(cmd)