SlideShare ist ein Scribd-Unternehmen logo
1 von 46
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

Weitere ähnliche Inhalte

Ähnlich wie Machine Learning with Accord Framework

Machine Learning 2D5362
Machine Learning 2D5362Machine Learning 2D5362
Machine Learning 2D5362butest
 
Classification using decision tree in detail
Classification using decision tree in detailClassification using decision tree in detail
Classification using decision tree in detailRamadan Babers, PhD
 
Ai & Ml presentation purushottam.pptx
Ai & Ml presentation purushottam.pptxAi & Ml presentation purushottam.pptx
Ai & Ml presentation purushottam.pptxpuruskarDubey
 
Introduction to ML and Decision Tree
Introduction to ML and Decision TreeIntroduction to ML and Decision Tree
Introduction to ML and Decision TreeSuman Debnath
 
Least Squares Fitting
Least Squares Fitting Least Squares Fitting
Least Squares Fitting MANREET SOHAL
 
Introduction to Machine Learning with examples in R
Introduction to Machine Learning with examples in RIntroduction to Machine Learning with examples in R
Introduction to Machine Learning with examples in RStefano Dalla Palma
 
Jordan Higher (𝜎, 𝜏)-Centralizer on Prime Ring
Jordan Higher (𝜎, 𝜏)-Centralizer on Prime RingJordan Higher (𝜎, 𝜏)-Centralizer on Prime Ring
Jordan Higher (𝜎, 𝜏)-Centralizer on Prime RingIOSR Journals
 
Mpc 006 - 02-02 types of correlation
Mpc 006 - 02-02 types of correlationMpc 006 - 02-02 types of correlation
Mpc 006 - 02-02 types of correlationVasant Kothari
 
ID3_Explanation.pptx
ID3_Explanation.pptxID3_Explanation.pptx
ID3_Explanation.pptxSanketMani1
 

Ähnlich wie Machine Learning with Accord Framework (11)

Machine Learning 2D5362
Machine Learning 2D5362Machine Learning 2D5362
Machine Learning 2D5362
 
Classification using decision tree in detail
Classification using decision tree in detailClassification using decision tree in detail
Classification using decision tree in detail
 
Ai & Ml presentation purushottam.pptx
Ai & Ml presentation purushottam.pptxAi & Ml presentation purushottam.pptx
Ai & Ml presentation purushottam.pptx
 
Introduction to ML and Decision Tree
Introduction to ML and Decision TreeIntroduction to ML and Decision Tree
Introduction to ML and Decision Tree
 
Aula controle discreto
Aula controle discretoAula controle discreto
Aula controle discreto
 
Least Squares Fitting
Least Squares Fitting Least Squares Fitting
Least Squares Fitting
 
Id3,c4.5 algorithim
Id3,c4.5 algorithimId3,c4.5 algorithim
Id3,c4.5 algorithim
 
Introduction to Machine Learning with examples in R
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
Jordan Higher (𝜎, 𝜏)-Centralizer on Prime RingJordan Higher (𝜎, 𝜏)-Centralizer on Prime Ring
Jordan Higher (𝜎, 𝜏)-Centralizer on Prime Ring
 
Mpc 006 - 02-02 types of correlation
Mpc 006 - 02-02 types of correlationMpc 006 - 02-02 types of correlation
Mpc 006 - 02-02 types of correlation
 
ID3_Explanation.pptx
ID3_Explanation.pptxID3_Explanation.pptx
ID3_Explanation.pptx
 

Kürzlich hochgeladen

Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Delhi Call girls
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxolyaivanovalion
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...SUHANI PANDEY
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 

Kürzlich hochgeladen (20)

Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 

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