Machine Learning with Accord Framework

MACHINE
LEARNING WITH
ACCORD
FRAMEWORK
A N D R I U S D A P Š E V I Č I U S
Machine Learning
MACHINE LEARNING
• Decision tree
• Artificial neural networks
• Clustering
• Association rule discovery
• Genetic algorithms
• etc...
MACHINE LEARNING
• Decision tree
• Artificial neural networks
• Clustering
• Association rule discovery
• Genetic algorithms
• etc...
MACHINE LEARNING
• Decision tree
• Artificial neural networks
• Clustering
ACCORD FRAMEWORK
•Machine learning made in a minute
• GNU LGPL
• Entirely C#
• Runs on ONE machine
DECISION TREE
𝑥 ∙ 𝑦
𝑥 ∙ 𝑦 = 0
𝑥 ∙ 𝑦 = 0
𝑥 ∙ 𝑦 = 1
CAN WE PLAY TENNIS
Outlook Temperature Humidity Wind PlayTennis
Sunny Hot High Weak No
Sunny Hot High Strong No
Overcast Hot High Weak Yes
Rain Mild High Weak Yes
Rain Cool Normal Weak Yes
Rain Cool Normal Strong No
Overcast Cool Normal Strong Yes
Sunny Mild High Weak No
Sunny Cool Normal Weak Yes
Rain Mild Normal Weak Yes
Sunny Mild Normal Strong Yes
Overcast Mild High Strong Yes
Overcast Hot Normal Weak Yes
Rain Mild High Strong No Dataset from Mitchell, T. M. Machine
Learning. McGraw-Hill, 1997. pp. 59-
60.
CAN WE PLAY TENNIS
Outlook Temperature Humidity Wind PlayTennis
Sunny Hot High Weak No
Sunny Hot High Strong No
Overcast Hot High Weak Yes
Rain Mild High Weak Yes
Rain Cool Normal Weak Yes
Rain Cool Normal Strong No
Overcast Cool Normal Strong Yes
Sunny Mild High Weak No
Sunny Cool Normal Weak Yes
Rain Mild Normal Weak Yes
Sunny Mild Normal Strong Yes
Overcast Mild High Strong Yes
Overcast Hot Normal Weak Yes
Rain Mild High Strong No
CAN WE PLAY TENNIS
Outlook PlayTennis
Sunny No
Sunny No
Overcast Yes
Rain Yes
Rain Yes
Rain No
Overcast Yes
Sunny No
Sunny Yes
Rain Yes
Sunny Yes
Overcast Yes
Overcast Yes
Rain No
CAN WE PLAY TENNIS
Outlook PlayTennis
Overcast Yes
Overcast Yes
Overcast Yes
Overcast Yes
Rain Yes
Rain Yes
Rain Yes
Rain No
Rain No
Sunny Yes
Sunny Yes
Sunny No
Sunny No
Sunny No
CAN WE PLAY TENNIS
Outlook PlayTennis
Overcast Yes
Overcast Yes
Overcast Yes
Overcast Yes
Rain Yes
Rain Yes
Rain Yes
Rain No
Rain No
Sunny Yes
Sunny Yes
Sunny No
Sunny No
Sunny No
CAN WE PLAY TENNIS
Outlook PlayTennis
Overcast Yes
Overcast Yes
Overcast Yes
Overcast Yes
Rain Yes
Rain Yes
Rain Yes
Rain No
Rain No
Sunny Yes
Sunny Yes
Sunny No
Sunny No
Sunny No
𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝐻(𝑥) = −𝑝 𝑦𝑒𝑠 log2(𝑝 𝑦𝑒𝑠) −𝑝 𝑛𝑜 log2(𝑝 𝑛𝑜)
CAN WE PLAY TENNIS
Outlook PlayTennis
Overcast Yes
Overcast Yes
Overcast Yes
Overcast Yes
Rain Yes
Rain Yes
Rain Yes
Rain No
Rain No
Sunny Yes
Sunny Yes
Sunny No
Sunny No
Sunny No
𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑂𝑣𝑒𝑟𝑐𝑎𝑠𝑡 = −1 log2 1 − 0 log2 0 = 0
𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑅𝑎𝑖𝑛 = −0.6 log2 0.6 − 0.4 log2 0.4 = 0.97
𝑒𝑛𝑡𝑟𝑜𝑝𝑦𝑆𝑢𝑛𝑛𝑦 = −0.4 log2 0.4 − 0.6 log2 0.6 = 0.97
CAN WE PLAY TENNIS
Outlook PlayTennis
Overcast Yes
Overcast Yes
Overcast Yes
Overcast Yes
Rain Yes
Rain Yes
Rain Yes
Rain No
Rain No
Sunny Yes
Sunny Yes
Sunny No
Sunny No
Sunny No
𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑂𝑣𝑒𝑟𝑐𝑎𝑠𝑡 = −1 log2 1 − 0 log2 0 = 0
𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑅𝑎𝑖𝑛 = −0.6 log2 0.6 − 0.4 log2 0.4 = 0.97
𝑒𝑛𝑡𝑟𝑜𝑝𝑦𝑆𝑢𝑛𝑛𝑦 = −0.4 log2 0.4 − 0.6 log2 0.6 = 0.97
CAN WE PLAY TENNIS
Outlook PlayTennis
Overcast Yes
Overcast Yes
Overcast Yes
Overcast Yes
Rain Yes
Rain Yes
Rain Yes
Rain No
Rain No
Sunny Yes
Sunny Yes
Sunny No
Sunny No
Sunny No
𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝐵𝑒𝑓𝑜𝑟𝑒 = 0.94 𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑎𝑓𝑡𝑒𝑟 = 0.7
𝑖𝑛𝑓𝑜𝑟𝑚𝑎𝑡𝑖𝑜𝑛 𝑔𝑎𝑖𝑛 = 0.94 − 0.7 = 0.24
CAN WE PLAY TENNIS
Outlook Temperature Humidity Wind PlayTennis
Sunny Cool Normal Weak Yes
Sunny Mild Normal Strong Yes
Sunny Hot High Weak No
Sunny Hot High Strong No
𝑂𝑢𝑡𝑙𝑜𝑜𝑘?
𝑅𝑎𝑖𝑛
𝑌𝑒𝑠
Outlook Temperature Humidity Wind PlayTennis
Rain Mild High Weak Yes
Rain Cool Normal Weak Yes
Rain Mild Normal Weak Yes
Rain Cool Normal Strong No
CAN WE PLAY TENNIS
Outlook Temperature Humidity Wind PlayTennis
Sunny Cool Normal Weak Yes
Sunny Mild Normal Strong Yes
Sunny Hot High Weak No
Sunny Hot High Strong No
𝑂𝑢𝑡𝑙𝑜𝑜𝑘?
𝑅𝑎𝑖𝑛
𝑌𝑒𝑠
𝑊𝑖𝑛𝑑?
𝑌𝑒𝑠
𝑁𝑜
CAN WE PLAY TENNIS
𝑂𝑢𝑡𝑙𝑜𝑜𝑘?
𝑅𝑎𝑖𝑛
𝑌𝑒𝑠
𝑊𝑖𝑛𝑑?
𝑌𝑒𝑠
𝑁𝑜
𝑌𝑒𝑠
𝑁𝑜
𝐻𝑢𝑚𝑖𝑑𝑖𝑡𝑦?
CREATING TREE
DecisionVariable[] attributes =
{
new DecisionVariable("Outlook", 3),
new DecisionVariable("Temperature", 3),
new DecisionVariable("Humidity", 2),
new DecisionVariable("Wind", 2)
};
int classCount = 2;
DecisionTree tree = new DecisionTree(attributes, classCount);
CONSTRUCTING TRAINER
ID3Learning id3learning = new ID3Learning(tree);
public class ID3Learning
{
public double Run(int[][] inputs, int[] outputs);
}
NORMALIZING DATA
Codification codebook = ...;
DataTable symbols = codebook.Apply(data);
int[][] inputs =
symbols.ToArray<int>("Outlook","Temperature“, . . .);
int[] outputs = symbols.ToArray<int>("PlayTennis");
NORMALIZING DATA
Outlook Temperature Humidity Wind PlayTennis
Sunny Hot High Weak No
Sunny Hot High Strong No
Overcast Hot High Weak Yes
Rain Mild High Weak Yes
Rain Cool Normal Weak Yes
Rain Cool Normal Strong No
Overcast Cool Normal Strong Yes
Sunny Mild High Weak No
Sunny Cool Normal Weak Yes
Rain Mild Normal Weak Yes
Sunny Mild Normal Strong Yes
Overcast Mild High Strong Yes
Overcast Hot Normal Weak Yes
Rain Mild High Strong No
0, 1, 2, 3
0, 0, 0, 0
0, 0, 0, 1
1, 0, 0, 0
2, 1, 0, 0
2, 2, 1, 0
2, 2, 1, 1
1, 2, 1, 1
0, 1, 0, 0
0, 2, 1, 0
2, 1, 1, 0
0, 1, 1, 1
1, 1, 0, 1
1, 0, 1, 0
2, 1, 0, 1
COMBINING EVERYTHING
id3learning.Run(inputs, outputs);
var question = codebook.Translate("Sunny",
"Hot", "High", "Strong")
int answer = tree.Compute(question);
string willPlayTenis =
codebook.Translate("PlayTennis", answer);
ID3 ALGORITHM WITH ACCORD
tree.ToRules():
0 =: (Outlook == 0) && (Humidity == 0)
0 =: (Outlook == 2) && (Wind == 1)
1 =: (Outlook == 1)
1 =: (Outlook == 0) && (Humidity == 1)
1 =: (Outlook == 2) && (Wind == 0)
tree.Save("./tree");
DecisionTree.Load("./tree");
tree.ToCode("Tree");
USES
𝑂𝑢𝑡𝑙𝑜𝑜𝑘?
𝑅𝑎𝑖𝑛
𝑌𝑒𝑠
𝑊𝑖𝑛𝑑?
𝑌𝑒𝑠
𝑁𝑜
𝑌𝑒𝑠
𝑁𝑜
𝐻𝑢𝑚𝑖𝑑𝑖𝑡𝑦?
• Image
classification
• Face recognition
• Visualisation
• Algorithm
refinement
CLUSTERING
KMEANS
var k = new KMeans(2);
int[] clusters = k.Compute(inputs);
MEANS SHIFT
var k = new MeanShift(2, new UniformKernel(), 0.2);
int[] clusters = k.Compute(inputs);
USE CASES
Market segmentation
Customer analysis
NEURAL NETWORKS
MAGIC
NEURAL NETWORKS
𝑋 ∗ 𝑤1
𝑌 ∗ 𝑤2
NEURAL NETWORKS
𝑌 ∗ 𝑤3
𝑥1 ∗ 𝑤1
𝑥2 ∗ 𝑤2
NEURAL NETWORKS
𝑌1 ∗ 𝑤
𝑥1 ∗ 𝑤1
𝑥2 ∗ 𝑤2
𝑥2 ∗ 𝑤2
𝑌2 ∗ 𝑤
Mixed National Institute of Standards and
Technology database
NEURAL NETWORK
var network = new ActivationNetwork(new SigmoidFunction(), 28 * 28, 10);
NEURAL NETWORK
var network = new ActivationNetwork(new SigmoidFunction(), 28 * 28, 10);
NEURAL NETWORK
var network = new ActivationNetwork(new SigmoidFunction(), 28 * 28, 10);
𝑥
𝑥
𝑦
𝑦
NEURAL NETWORK
var network = new ActivationNetwork(new SigmoidFunction(), 28 * 28, 10);
new NguyenWidrow(network).Randomize();
var teacher = new ResilientBackpropagationLearning(network);
double[] [][] inputs = ...
double[] [][] outputs = ...
for (var i = 0; i < 20; i++)
{
teacher.RunEpoch(inputs[i], outputs[i]);
}
NEURAL NETWORK
+
−
NEURAL NETWORK
public abstract class Network
{
...
double[] Compute(double[] input);
}
NEURAL NETWORKS
𝑌1 ∗ 𝑤
𝑥1 ∗ 𝑤1
𝑥2 ∗ 𝑤2
𝑥2 ∗ 𝑤2
𝑌2 ∗ 𝑤
Self driving cars
Spam filters
OVERFITTING
OVERFITTING
30-
20%
70-80%
DIFFICULTIES
Everything is double[]
Data preparation
WHAT’S NEXT
tensorflow
1 of 46

Recommended

Automating Machine Learning - Is it feasible? by
Automating Machine Learning - Is it feasible?Automating Machine Learning - Is it feasible?
Automating Machine Learning - Is it feasible?Manuel Martín
1.6K views54 slides
Decision Tree by
Decision TreeDecision Tree
Decision TreeLearnbay Datascience
259 views40 slides
"Induction of Decision Trees" @ Papers We Love Bucharest by
"Induction of Decision Trees" @ Papers We Love Bucharest"Induction of Decision Trees" @ Papers We Love Bucharest
"Induction of Decision Trees" @ Papers We Love BucharestStefan Adam
448 views20 slides
Classification intuition by
Classification   intuitionClassification   intuition
Classification intuitionRahul Tiwari
232 views16 slides
Data Science Training in Bangalore | Learnbay.in | Decision Tree | Machine Le... by
Data Science Training in Bangalore | Learnbay.in | Decision Tree | Machine Le...Data Science Training in Bangalore | Learnbay.in | Decision Tree | Machine Le...
Data Science Training in Bangalore | Learnbay.in | Decision Tree | Machine Le...Learnbay Datascience
270 views40 slides
Software-Praktikum SoSe 2005 Lehrstuhl fuer Maschinelles ... by
Software-Praktikum SoSe 2005 Lehrstuhl fuer Maschinelles ...Software-Praktikum SoSe 2005 Lehrstuhl fuer Maschinelles ...
Software-Praktikum SoSe 2005 Lehrstuhl fuer Maschinelles ...butest
360 views44 slides

More Related Content

Similar to Machine Learning with Accord Framework

Machine Learning 2D5362 by
Machine Learning 2D5362Machine Learning 2D5362
Machine Learning 2D5362butest
532 views29 slides
Classification using decision tree in detail by
Classification using decision tree in detailClassification using decision tree in detail
Classification using decision tree in detailRamadan Babers, PhD
104 views47 slides
Ai & Ml presentation purushottam.pptx by
Ai & Ml presentation purushottam.pptxAi & Ml presentation purushottam.pptx
Ai & Ml presentation purushottam.pptxpuruskarDubey
4 views25 slides
Introduction to ML and Decision Tree by
Introduction to ML and Decision TreeIntroduction to ML and Decision Tree
Introduction to ML and Decision TreeSuman Debnath
246 views83 slides
Aula controle discreto by
Aula controle discretoAula controle discreto
Aula controle discretoFladimy Rocha Santo
36 views13 slides
Least Squares Fitting by
Least Squares Fitting Least Squares Fitting
Least Squares Fitting MANREET SOHAL
340 views22 slides

Similar to Machine Learning with Accord Framework(10)

Machine Learning 2D5362 by butest
Machine Learning 2D5362Machine Learning 2D5362
Machine Learning 2D5362
butest532 views
Ai & Ml presentation purushottam.pptx by puruskarDubey
Ai & Ml presentation purushottam.pptxAi & Ml presentation purushottam.pptx
Ai & Ml presentation purushottam.pptx
puruskarDubey4 views
Introduction to ML and Decision Tree by Suman Debnath
Introduction to ML and Decision TreeIntroduction to ML and Decision Tree
Introduction to ML and Decision Tree
Suman Debnath246 views
Least Squares Fitting by MANREET SOHAL
Least Squares Fitting Least Squares Fitting
Least Squares Fitting
MANREET SOHAL340 views
Introduction to Machine Learning with examples in R by Stefano Dalla Palma
Introduction to Machine Learning with examples in RIntroduction to Machine Learning with examples in R
Introduction to Machine Learning with examples in R
Jordan Higher (𝜎, 𝜏)-Centralizer on Prime Ring by IOSR Journals
Jordan Higher (𝜎, 𝜏)-Centralizer on Prime RingJordan Higher (𝜎, 𝜏)-Centralizer on Prime Ring
Jordan Higher (𝜎, 𝜏)-Centralizer on Prime Ring
IOSR Journals378 views
Mpc 006 - 02-02 types of correlation by Vasant Kothari
Mpc 006 - 02-02 types of correlationMpc 006 - 02-02 types of correlation
Mpc 006 - 02-02 types of correlation
Vasant Kothari3.3K views

Recently uploaded

VoxelNet by
VoxelNetVoxelNet
VoxelNettaeseon ryu
13 views21 slides
Organic Shopping in Google Analytics 4.pdf by
Organic Shopping in Google Analytics 4.pdfOrganic Shopping in Google Analytics 4.pdf
Organic Shopping in Google Analytics 4.pdfGA4 Tutorials
16 views13 slides
3196 The Case of The East River by
3196 The Case of The East River3196 The Case of The East River
3196 The Case of The East RiverErickANDRADE90
17 views4 slides
Data Journeys Hard Talk workshop final.pptx by
Data Journeys Hard Talk workshop final.pptxData Journeys Hard Talk workshop final.pptx
Data Journeys Hard Talk workshop final.pptxinfo828217
10 views18 slides
[DSC Europe 23] Ivana Sesic - Use of AI in Public Health.pptx by
[DSC Europe 23] Ivana Sesic - Use of AI in Public Health.pptx[DSC Europe 23] Ivana Sesic - Use of AI in Public Health.pptx
[DSC Europe 23] Ivana Sesic - Use of AI in Public Health.pptxDataScienceConferenc1
5 views15 slides
Infomatica-MDM.pptx by
Infomatica-MDM.pptxInfomatica-MDM.pptx
Infomatica-MDM.pptxKapil Rangwani
11 views16 slides

Recently uploaded(20)

Organic Shopping in Google Analytics 4.pdf by GA4 Tutorials
Organic Shopping in Google Analytics 4.pdfOrganic Shopping in Google Analytics 4.pdf
Organic Shopping in Google Analytics 4.pdf
GA4 Tutorials16 views
3196 The Case of The East River by ErickANDRADE90
3196 The Case of The East River3196 The Case of The East River
3196 The Case of The East River
ErickANDRADE9017 views
Data Journeys Hard Talk workshop final.pptx by info828217
Data Journeys Hard Talk workshop final.pptxData Journeys Hard Talk workshop final.pptx
Data Journeys Hard Talk workshop final.pptx
info82821710 views
[DSC Europe 23][AI:CSI] Aleksa Stojanovic - Applying AI for Threat Detection ... by DataScienceConferenc1
[DSC Europe 23][AI:CSI] Aleksa Stojanovic - Applying AI for Threat Detection ...[DSC Europe 23][AI:CSI] Aleksa Stojanovic - Applying AI for Threat Detection ...
[DSC Europe 23][AI:CSI] Aleksa Stojanovic - Applying AI for Threat Detection ...
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M... by DataScienceConferenc1
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...
[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int... by DataScienceConferenc1
[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int...[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int...
[DSC Europe 23] Rania Wazir - Opening up the box: the complexity of human int...
Product Research sample.pdf by AllenSingson
Product Research sample.pdfProduct Research sample.pdf
Product Research sample.pdf
AllenSingson29 views
Dr. Ousmane Badiane-2023 ReSAKSS Conference by AKADEMIYA2063
Dr. Ousmane Badiane-2023 ReSAKSS ConferenceDr. Ousmane Badiane-2023 ReSAKSS Conference
Dr. Ousmane Badiane-2023 ReSAKSS Conference
AKADEMIYA20635 views
PRIVACY AWRE PERSONAL DATA STORAGE by antony420421
PRIVACY AWRE PERSONAL DATA STORAGEPRIVACY AWRE PERSONAL DATA STORAGE
PRIVACY AWRE PERSONAL DATA STORAGE
antony4204215 views
Cross-network in Google Analytics 4.pdf by GA4 Tutorials
Cross-network in Google Analytics 4.pdfCross-network in Google Analytics 4.pdf
Cross-network in Google Analytics 4.pdf
GA4 Tutorials6 views
4_4_WP_4_06_ND_Model.pptx by d6fmc6kwd4
4_4_WP_4_06_ND_Model.pptx4_4_WP_4_06_ND_Model.pptx
4_4_WP_4_06_ND_Model.pptx
d6fmc6kwd47 views
[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ... by DataScienceConferenc1
[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ...[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ...
[DSC Europe 23] Predrag Ilic & Simeon Rilling - From Data Lakes to Data Mesh ...
OPPOTUS - Malaysians on Malaysia 3Q2023.pdf by Oppotus
OPPOTUS - Malaysians on Malaysia 3Q2023.pdfOPPOTUS - Malaysians on Malaysia 3Q2023.pdf
OPPOTUS - Malaysians on Malaysia 3Q2023.pdf
Oppotus18 views

Machine Learning with Accord Framework

  • 1. MACHINE LEARNING WITH ACCORD FRAMEWORK A N D R I U S D A P Š E V I Č I U S
  • 3. MACHINE LEARNING • Decision tree • Artificial neural networks • Clustering • Association rule discovery • Genetic algorithms • etc...
  • 4. MACHINE LEARNING • Decision tree • Artificial neural networks • Clustering • Association rule discovery • Genetic algorithms • etc...
  • 5. MACHINE LEARNING • Decision tree • Artificial neural networks • Clustering
  • 6. ACCORD FRAMEWORK •Machine learning made in a minute • GNU LGPL • Entirely C# • Runs on ONE machine
  • 7. DECISION TREE 𝑥 ∙ 𝑦 𝑥 ∙ 𝑦 = 0 𝑥 ∙ 𝑦 = 0 𝑥 ∙ 𝑦 = 1
  • 8. CAN WE PLAY TENNIS Outlook Temperature Humidity Wind PlayTennis Sunny Hot High Weak No Sunny Hot High Strong No Overcast Hot High Weak Yes Rain Mild High Weak Yes Rain Cool Normal Weak Yes Rain Cool Normal Strong No Overcast Cool Normal Strong Yes Sunny Mild High Weak No Sunny Cool Normal Weak Yes Rain Mild Normal Weak Yes Sunny Mild Normal Strong Yes Overcast Mild High Strong Yes Overcast Hot Normal Weak Yes Rain Mild High Strong No Dataset from Mitchell, T. M. Machine Learning. McGraw-Hill, 1997. pp. 59- 60.
  • 9. CAN WE PLAY TENNIS Outlook Temperature Humidity Wind PlayTennis Sunny Hot High Weak No Sunny Hot High Strong No Overcast Hot High Weak Yes Rain Mild High Weak Yes Rain Cool Normal Weak Yes Rain Cool Normal Strong No Overcast Cool Normal Strong Yes Sunny Mild High Weak No Sunny Cool Normal Weak Yes Rain Mild Normal Weak Yes Sunny Mild Normal Strong Yes Overcast Mild High Strong Yes Overcast Hot Normal Weak Yes Rain Mild High Strong No
  • 10. CAN WE PLAY TENNIS Outlook PlayTennis Sunny No Sunny No Overcast Yes Rain Yes Rain Yes Rain No Overcast Yes Sunny No Sunny Yes Rain Yes Sunny Yes Overcast Yes Overcast Yes Rain No
  • 11. CAN WE PLAY TENNIS Outlook PlayTennis Overcast Yes Overcast Yes Overcast Yes Overcast Yes Rain Yes Rain Yes Rain Yes Rain No Rain No Sunny Yes Sunny Yes Sunny No Sunny No Sunny No
  • 12. CAN WE PLAY TENNIS Outlook PlayTennis Overcast Yes Overcast Yes Overcast Yes Overcast Yes Rain Yes Rain Yes Rain Yes Rain No Rain No Sunny Yes Sunny Yes Sunny No Sunny No Sunny No
  • 13. CAN WE PLAY TENNIS Outlook PlayTennis Overcast Yes Overcast Yes Overcast Yes Overcast Yes Rain Yes Rain Yes Rain Yes Rain No Rain No Sunny Yes Sunny Yes Sunny No Sunny No Sunny No 𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝐻(𝑥) = −𝑝 𝑦𝑒𝑠 log2(𝑝 𝑦𝑒𝑠) −𝑝 𝑛𝑜 log2(𝑝 𝑛𝑜)
  • 14. CAN WE PLAY TENNIS Outlook PlayTennis Overcast Yes Overcast Yes Overcast Yes Overcast Yes Rain Yes Rain Yes Rain Yes Rain No Rain No Sunny Yes Sunny Yes Sunny No Sunny No Sunny No 𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑂𝑣𝑒𝑟𝑐𝑎𝑠𝑡 = −1 log2 1 − 0 log2 0 = 0 𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑅𝑎𝑖𝑛 = −0.6 log2 0.6 − 0.4 log2 0.4 = 0.97 𝑒𝑛𝑡𝑟𝑜𝑝𝑦𝑆𝑢𝑛𝑛𝑦 = −0.4 log2 0.4 − 0.6 log2 0.6 = 0.97
  • 15. CAN WE PLAY TENNIS Outlook PlayTennis Overcast Yes Overcast Yes Overcast Yes Overcast Yes Rain Yes Rain Yes Rain Yes Rain No Rain No Sunny Yes Sunny Yes Sunny No Sunny No Sunny No 𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑂𝑣𝑒𝑟𝑐𝑎𝑠𝑡 = −1 log2 1 − 0 log2 0 = 0 𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑅𝑎𝑖𝑛 = −0.6 log2 0.6 − 0.4 log2 0.4 = 0.97 𝑒𝑛𝑡𝑟𝑜𝑝𝑦𝑆𝑢𝑛𝑛𝑦 = −0.4 log2 0.4 − 0.6 log2 0.6 = 0.97
  • 16. CAN WE PLAY TENNIS Outlook PlayTennis Overcast Yes Overcast Yes Overcast Yes Overcast Yes Rain Yes Rain Yes Rain Yes Rain No Rain No Sunny Yes Sunny Yes Sunny No Sunny No Sunny No 𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝐵𝑒𝑓𝑜𝑟𝑒 = 0.94 𝑒𝑛𝑡𝑟𝑜𝑝𝑦 𝑎𝑓𝑡𝑒𝑟 = 0.7 𝑖𝑛𝑓𝑜𝑟𝑚𝑎𝑡𝑖𝑜𝑛 𝑔𝑎𝑖𝑛 = 0.94 − 0.7 = 0.24
  • 17. CAN WE PLAY TENNIS Outlook Temperature Humidity Wind PlayTennis Sunny Cool Normal Weak Yes Sunny Mild Normal Strong Yes Sunny Hot High Weak No Sunny Hot High Strong No 𝑂𝑢𝑡𝑙𝑜𝑜𝑘? 𝑅𝑎𝑖𝑛 𝑌𝑒𝑠 Outlook Temperature Humidity Wind PlayTennis Rain Mild High Weak Yes Rain Cool Normal Weak Yes Rain Mild Normal Weak Yes Rain Cool Normal Strong No
  • 18. CAN WE PLAY TENNIS Outlook Temperature Humidity Wind PlayTennis Sunny Cool Normal Weak Yes Sunny Mild Normal Strong Yes Sunny Hot High Weak No Sunny Hot High Strong No 𝑂𝑢𝑡𝑙𝑜𝑜𝑘? 𝑅𝑎𝑖𝑛 𝑌𝑒𝑠 𝑊𝑖𝑛𝑑? 𝑌𝑒𝑠 𝑁𝑜
  • 19. CAN WE PLAY TENNIS 𝑂𝑢𝑡𝑙𝑜𝑜𝑘? 𝑅𝑎𝑖𝑛 𝑌𝑒𝑠 𝑊𝑖𝑛𝑑? 𝑌𝑒𝑠 𝑁𝑜 𝑌𝑒𝑠 𝑁𝑜 𝐻𝑢𝑚𝑖𝑑𝑖𝑡𝑦?
  • 20. CREATING TREE DecisionVariable[] attributes = { new DecisionVariable("Outlook", 3), new DecisionVariable("Temperature", 3), new DecisionVariable("Humidity", 2), new DecisionVariable("Wind", 2) }; int classCount = 2; DecisionTree tree = new DecisionTree(attributes, classCount);
  • 21. CONSTRUCTING TRAINER ID3Learning id3learning = new ID3Learning(tree); public class ID3Learning { public double Run(int[][] inputs, int[] outputs); }
  • 22. NORMALIZING DATA Codification codebook = ...; DataTable symbols = codebook.Apply(data); int[][] inputs = symbols.ToArray<int>("Outlook","Temperature“, . . .); int[] outputs = symbols.ToArray<int>("PlayTennis");
  • 23. NORMALIZING DATA Outlook Temperature Humidity Wind PlayTennis Sunny Hot High Weak No Sunny Hot High Strong No Overcast Hot High Weak Yes Rain Mild High Weak Yes Rain Cool Normal Weak Yes Rain Cool Normal Strong No Overcast Cool Normal Strong Yes Sunny Mild High Weak No Sunny Cool Normal Weak Yes Rain Mild Normal Weak Yes Sunny Mild Normal Strong Yes Overcast Mild High Strong Yes Overcast Hot Normal Weak Yes Rain Mild High Strong No 0, 1, 2, 3 0, 0, 0, 0 0, 0, 0, 1 1, 0, 0, 0 2, 1, 0, 0 2, 2, 1, 0 2, 2, 1, 1 1, 2, 1, 1 0, 1, 0, 0 0, 2, 1, 0 2, 1, 1, 0 0, 1, 1, 1 1, 1, 0, 1 1, 0, 1, 0 2, 1, 0, 1
  • 24. COMBINING EVERYTHING id3learning.Run(inputs, outputs); var question = codebook.Translate("Sunny", "Hot", "High", "Strong") int answer = tree.Compute(question); string willPlayTenis = codebook.Translate("PlayTennis", answer);
  • 25. ID3 ALGORITHM WITH ACCORD tree.ToRules(): 0 =: (Outlook == 0) && (Humidity == 0) 0 =: (Outlook == 2) && (Wind == 1) 1 =: (Outlook == 1) 1 =: (Outlook == 0) && (Humidity == 1) 1 =: (Outlook == 2) && (Wind == 0) tree.Save("./tree"); DecisionTree.Load("./tree"); tree.ToCode("Tree");
  • 28. KMEANS var k = new KMeans(2); int[] clusters = k.Compute(inputs);
  • 29. MEANS SHIFT var k = new MeanShift(2, new UniformKernel(), 0.2); int[] clusters = k.Compute(inputs);
  • 32. NEURAL NETWORKS 𝑋 ∗ 𝑤1 𝑌 ∗ 𝑤2
  • 33. NEURAL NETWORKS 𝑌 ∗ 𝑤3 𝑥1 ∗ 𝑤1 𝑥2 ∗ 𝑤2
  • 34. NEURAL NETWORKS 𝑌1 ∗ 𝑤 𝑥1 ∗ 𝑤1 𝑥2 ∗ 𝑤2 𝑥2 ∗ 𝑤2 𝑌2 ∗ 𝑤
  • 35. Mixed National Institute of Standards and Technology database
  • 36. NEURAL NETWORK var network = new ActivationNetwork(new SigmoidFunction(), 28 * 28, 10);
  • 37. NEURAL NETWORK var network = new ActivationNetwork(new SigmoidFunction(), 28 * 28, 10);
  • 38. NEURAL NETWORK var network = new ActivationNetwork(new SigmoidFunction(), 28 * 28, 10); 𝑥 𝑥 𝑦 𝑦
  • 39. NEURAL NETWORK var network = new ActivationNetwork(new SigmoidFunction(), 28 * 28, 10); new NguyenWidrow(network).Randomize(); var teacher = new ResilientBackpropagationLearning(network); double[] [][] inputs = ... double[] [][] outputs = ... for (var i = 0; i < 20; i++) { teacher.RunEpoch(inputs[i], outputs[i]); }
  • 41. NEURAL NETWORK public abstract class Network { ... double[] Compute(double[] input); }
  • 42. NEURAL NETWORKS 𝑌1 ∗ 𝑤 𝑥1 ∗ 𝑤1 𝑥2 ∗ 𝑤2 𝑥2 ∗ 𝑤2 𝑌2 ∗ 𝑤 Self driving cars Spam filters