SlideShare a Scribd company logo
1 of 45
Download to read offline
Agile Arti
fi
cial Intelligence
Alexandre Bergel
RelationalAI, Switzerland
https://bergel.eu
🧬
🧠
Part 1: Neural network Part 2: Genetic algorithm
Part 3: Neuroevolution
+
🤖
=
🧬
🧠
Part 1: Neural network
Part 3: Neuroevolution
+
🤖
=
Part 2: Genetic algorithm
Perceptron
X1
X2
X3
Output
Perceptron
X1
X2
X3
Output
W1
W2
W3
T
Perceptron
X1
X2
X3
Output
W1
W2
W3
Output := (X1*W1) + (X2*W2) + (X3*W3) > T ifTrue: [ 1 ] ifFalse: [ 0 ]
Perceptron🤘
Great heavy metalconcert this week end
As a metal-lover, you would like to go
Three factors:
X1: Is the weather good?
X2: Does someone accompany me?
X3: Can I go without a car?
Perceptron🤘
Great heavy metalconcert this week end
As a metal-lover, you would like to go
Three factors:
X1: Is the weather good?
X2: Does someone accompany me?
X3: Can I go without a car?
W1 = 2
W2 = 6
W3 = 2
W1 = 1
W2 = 1
W3 = 8
👬 ❤🚶
AND Logical gate
X1
X2
Output
1
1 1.5
X1 X2 Output
0 0 0
0 1 0
1 0 0
1 1 1
Output := (X1*W1) + (X2*W2) > T ifTrue: [ 1 ] ifFalse: [ 0 ]
OR Logical gate
X1
X2
Output
??
?? ??
X1 X2 Output
0 0 0
0 1 1
1 0 1
1 1 1
Output := (X1*W1) + (X2*W2) > T ifTrue: [ 1 ] ifFalse: [ 0 ]
OR Logical gate
X1
X2
Output
1
1 0.5
X1 X2 Output
0 0 0
0 1 1
1 0 1
1 1 1
Output := (X1*W1) + (X2*W2) > T ifTrue: [ 1 ] ifFalse: [ 0 ]
Perceptron learning algorithm
diff = desiredOutput - realOutput
lr = 0.1
For all N:
weightN = weightN + (lr * inputN * diff)
bias = bias + (lr * diff)
lr is called the learning rate
learningCurveNeuron := OrderedCollection new.
0 to: 1000 do: [ :nbOfTrained |
p := Neuron new.
p weights: #(-1 -1).
p bias: 2.
nbOfTrained timesRepeat: [
p train: #(0 0) desiredOutput: 0.
p train: #(0 1) desiredOutput: 0.
p train: #(1 0) desiredOutput: 0.
p train: #(1 1) desiredOutput: 1 ].
res := ((p feed: #(0 0)) - 0) abs +
((p feed: #(0 1)) - 0) abs +
((p feed: #(1 0)) - 0) abs +
((p feed: #(1 1)) - 1) abs.
learningCurveNeuron add: res / 4.
].
learningCurvePerceptron := OrderedCollection new.
0 to: 1000 do: [ :nbOfTrained |
p := Neuron new.
p step.
p weights: #(-1 -1).
p bias: 2.
nbOfTrained timesRepeat: [
p train: #(0 0) desiredOutput: 0.
p train: #(0 1) desiredOutput: 0.
p train: #(1 0) desiredOutput: 0.
p train: #(1 1) desiredOutput: 1 ].
res := ((p feed: #(0 0)) - 0) abs +
((p feed: #(0 1)) - 0) abs +
((p feed: #(1 0)) - 0) abs +
((p feed: #(1 1)) - 1) abs.
learningCurvePerceptron add: res / 4.
].
g := RTGrapher new.
d := RTData new.
d label: 'Sigmoid neuron'.
d noDot.
🧬
🧠
Part 1: Neural network
Part 3: Neuroevolution
+
🤖
=
Part 2: Genetic algorithm
🧬
🧠
Part 1: Neural network
Part 3: Neuroevolution
+
🤖
=
Part 2: Genetic algorithm
“One general law, leading to the advancement of all organic beings,
namely, vary, let the strongest live and the weakest die”
— Charles Darwin
🦸 🦹
“Guess the 3-letter
word I have in mind”
Secret word: cat
🦸 🦹
“Guess the 3-letter
word I have in mind”
Secret word: cat
“cow”
“poz”
“gaz”
1
0
1
gaz
cow
poz
Best score = 1
Secret word: cat
gaz
cow
poz
gow
caz
pow
Applying
genetic
operators
Best score = 1 Best score = 2
Secret word: cat
gaz
cow
poz
gow
caz
pow
Applying
genetic
operators
goz
cat
poz
Applying
genetic
operators
Best score = 1 Best score = 2 Best score = 3
Secret word: cat
stringToFind := 'cat'.
g := GAEngine new.
g populationSize: 1000.
g numberOfGenes: stringToFind size.
g createGeneBlock: [ :rand :index :ind | ($a to: $z)
atRandom: rand ].
g fitnessBlock: [ :genes |
(stringToFind asArray with: genes collect: [ :a :b |
a = b ifTrue: [ 1 ] ifFalse: [ 0 ] ]) sum ].
g run.
g visualize open
C A T
Muscle length Muscle force
Muscle
tension
…
🧬
🧠
Part 1: Neural network
Part 3: Neuroevolution
+
🤖
=
Part 2: Genetic algorithm
🧬
🧠
Part 1: Neural network
Part 3: Neuroevolution
+
🤖
=
Part 2: Genetic algorithm
Deep learning
Greedy in properly formed training data
E.g., distinguishing a 🐱 from a 🐶 requires 2000 pictures
Not really the way humans learn
Neuroevolution
Evolution of neural network is called neuroevolution
In practice: an AI algorithm evolves another AI algorithm
MNWorld new seed: 7; open
MNWorld new showCompleteMap
neat := NEAT new.
neat numberOfInputs: 121.
neat numberOfOutputs: 3.
neat populationSize: 200.
neat fitness: [ :ind |
w := MNWorld new.
w mario: (MNAIMario new network: ind).
450 timesRepeat: [ w beat ].
w mario position x ].
neat numberOfGenerations: 160.
neat run.
w := MNWorld new.
w mario: (MNAIMario new network: neat result).
w open
All the code is available for free
Metacello new
baseline: 'AgileArtificialIntelligence';
repository: 'github://Apress/agile-ai-in-pharo/src';
load.
What the book is not about
Complex deep learning models
Transformers
Language models
Image recognition
What the book is about
Make you an expert in Genetic Algorithms
Introduce you to the fascinating world of Neuroevolution
Give non-trivial and appealing examples
Does not require a strong mathematical background
Future plan
Update book with Roassal3
Extract the Neural Network chapters into a separate book (maybe)
More examples about zoomorphic creatures
Go deeper into Neuroevolution
🤗👋

More Related Content

Similar to Agile Artificial Intelligence

In three of the exercises below there is given a code of a method na.pdf
In three of the exercises below there is given a code of a method na.pdfIn three of the exercises below there is given a code of a method na.pdf
In three of the exercises below there is given a code of a method na.pdffeelinggift
 
Effective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPyEffective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPyKimikazu Kato
 
PyCon2009_AI_Alt
PyCon2009_AI_AltPyCon2009_AI_Alt
PyCon2009_AI_AltHiroshi Ono
 
Design and Analysis of Algorithm Brute Force 1.ppt
Design and Analysis of Algorithm Brute Force 1.pptDesign and Analysis of Algorithm Brute Force 1.ppt
Design and Analysis of Algorithm Brute Force 1.pptmoiza354
 
DeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep LearningDeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep LearningMasahiro Sakai
 
Introduction to Recursion (Python)
Introduction to Recursion (Python)Introduction to Recursion (Python)
Introduction to Recursion (Python)Thai Pangsakulyanont
 
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014PyData
 
Python lab manual all the experiments are available
Python lab manual all the experiments are availablePython lab manual all the experiments are available
Python lab manual all the experiments are availableNitesh Dubey
 
Class 28: Entropy
Class 28: EntropyClass 28: Entropy
Class 28: EntropyDavid Evans
 
Searching techniques with progrms
Searching techniques with progrmsSearching techniques with progrms
Searching techniques with progrmsMisssaxena
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programmingPrudhviVuda
 
High-Performance Haskell
High-Performance HaskellHigh-Performance Haskell
High-Performance HaskellJohan Tibell
 
Unit 5 Streams2.pptx
Unit 5 Streams2.pptxUnit 5 Streams2.pptx
Unit 5 Streams2.pptxSonaliAjankar
 
Algorithms presentation on Path Matrix, Bell Number and Sorting
Algorithms presentation on Path Matrix, Bell Number and SortingAlgorithms presentation on Path Matrix, Bell Number and Sorting
Algorithms presentation on Path Matrix, Bell Number and SortingRishabh Mehan
 
An overview of Python 2.7
An overview of Python 2.7An overview of Python 2.7
An overview of Python 2.7decoupled
 

Similar to Agile Artificial Intelligence (20)

In three of the exercises below there is given a code of a method na.pdf
In three of the exercises below there is given a code of a method na.pdfIn three of the exercises below there is given a code of a method na.pdf
In three of the exercises below there is given a code of a method na.pdf
 
Arrays
ArraysArrays
Arrays
 
Effective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPyEffective Numerical Computation in NumPy and SciPy
Effective Numerical Computation in NumPy and SciPy
 
Array
ArrayArray
Array
 
PyCon2009_AI_Alt
PyCon2009_AI_AltPyCon2009_AI_Alt
PyCon2009_AI_Alt
 
Design and Analysis of Algorithm Brute Force 1.ppt
Design and Analysis of Algorithm Brute Force 1.pptDesign and Analysis of Algorithm Brute Force 1.ppt
Design and Analysis of Algorithm Brute Force 1.ppt
 
DeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep LearningDeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep Learning
 
Introduction to Recursion (Python)
Introduction to Recursion (Python)Introduction to Recursion (Python)
Introduction to Recursion (Python)
 
Python faster for loop
Python faster for loopPython faster for loop
Python faster for loop
 
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
Pythran: Static compiler for high performance by Mehdi Amini PyData SV 2014
 
Python lab manual all the experiments are available
Python lab manual all the experiments are availablePython lab manual all the experiments are available
Python lab manual all the experiments are available
 
Writing Faster Python 3
Writing Faster Python 3Writing Faster Python 3
Writing Faster Python 3
 
Class 28: Entropy
Class 28: EntropyClass 28: Entropy
Class 28: Entropy
 
Searching techniques with progrms
Searching techniques with progrmsSearching techniques with progrms
Searching techniques with progrms
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
DNN.pptx
DNN.pptxDNN.pptx
DNN.pptx
 
High-Performance Haskell
High-Performance HaskellHigh-Performance Haskell
High-Performance Haskell
 
Unit 5 Streams2.pptx
Unit 5 Streams2.pptxUnit 5 Streams2.pptx
Unit 5 Streams2.pptx
 
Algorithms presentation on Path Matrix, Bell Number and Sorting
Algorithms presentation on Path Matrix, Bell Number and SortingAlgorithms presentation on Path Matrix, Bell Number and Sorting
Algorithms presentation on Path Matrix, Bell Number and Sorting
 
An overview of Python 2.7
An overview of Python 2.7An overview of Python 2.7
An overview of Python 2.7
 

More from ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector TuningESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FutureESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing ScoreESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsESUG
 

More from ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Recently uploaded

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 

Recently uploaded (20)

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 

Agile Artificial Intelligence

  • 1. Agile Arti fi cial Intelligence Alexandre Bergel RelationalAI, Switzerland https://bergel.eu
  • 2.
  • 3. 🧬 🧠 Part 1: Neural network Part 2: Genetic algorithm Part 3: Neuroevolution + 🤖 =
  • 4. 🧬 🧠 Part 1: Neural network Part 3: Neuroevolution + 🤖 = Part 2: Genetic algorithm
  • 7. T Perceptron X1 X2 X3 Output W1 W2 W3 Output := (X1*W1) + (X2*W2) + (X3*W3) > T ifTrue: [ 1 ] ifFalse: [ 0 ]
  • 8. Perceptron🤘 Great heavy metalconcert this week end As a metal-lover, you would like to go Three factors: X1: Is the weather good? X2: Does someone accompany me? X3: Can I go without a car?
  • 9. Perceptron🤘 Great heavy metalconcert this week end As a metal-lover, you would like to go Three factors: X1: Is the weather good? X2: Does someone accompany me? X3: Can I go without a car? W1 = 2 W2 = 6 W3 = 2 W1 = 1 W2 = 1 W3 = 8 👬 ❤🚶
  • 10. AND Logical gate X1 X2 Output 1 1 1.5 X1 X2 Output 0 0 0 0 1 0 1 0 0 1 1 1 Output := (X1*W1) + (X2*W2) > T ifTrue: [ 1 ] ifFalse: [ 0 ]
  • 11. OR Logical gate X1 X2 Output ?? ?? ?? X1 X2 Output 0 0 0 0 1 1 1 0 1 1 1 1 Output := (X1*W1) + (X2*W2) > T ifTrue: [ 1 ] ifFalse: [ 0 ]
  • 12. OR Logical gate X1 X2 Output 1 1 0.5 X1 X2 Output 0 0 0 0 1 1 1 0 1 1 1 1 Output := (X1*W1) + (X2*W2) > T ifTrue: [ 1 ] ifFalse: [ 0 ]
  • 13. Perceptron learning algorithm diff = desiredOutput - realOutput lr = 0.1 For all N: weightN = weightN + (lr * inputN * diff) bias = bias + (lr * diff) lr is called the learning rate
  • 14. learningCurveNeuron := OrderedCollection new. 0 to: 1000 do: [ :nbOfTrained | p := Neuron new. p weights: #(-1 -1). p bias: 2. nbOfTrained timesRepeat: [ p train: #(0 0) desiredOutput: 0. p train: #(0 1) desiredOutput: 0. p train: #(1 0) desiredOutput: 0. p train: #(1 1) desiredOutput: 1 ]. res := ((p feed: #(0 0)) - 0) abs + ((p feed: #(0 1)) - 0) abs + ((p feed: #(1 0)) - 0) abs + ((p feed: #(1 1)) - 1) abs. learningCurveNeuron add: res / 4. ]. learningCurvePerceptron := OrderedCollection new. 0 to: 1000 do: [ :nbOfTrained | p := Neuron new. p step. p weights: #(-1 -1). p bias: 2. nbOfTrained timesRepeat: [ p train: #(0 0) desiredOutput: 0. p train: #(0 1) desiredOutput: 0. p train: #(1 0) desiredOutput: 0. p train: #(1 1) desiredOutput: 1 ]. res := ((p feed: #(0 0)) - 0) abs + ((p feed: #(0 1)) - 0) abs + ((p feed: #(1 0)) - 0) abs + ((p feed: #(1 1)) - 1) abs. learningCurvePerceptron add: res / 4. ]. g := RTGrapher new. d := RTData new. d label: 'Sigmoid neuron'. d noDot.
  • 15.
  • 16.
  • 17. 🧬 🧠 Part 1: Neural network Part 3: Neuroevolution + 🤖 = Part 2: Genetic algorithm
  • 18. 🧬 🧠 Part 1: Neural network Part 3: Neuroevolution + 🤖 = Part 2: Genetic algorithm
  • 19. “One general law, leading to the advancement of all organic beings, namely, vary, let the strongest live and the weakest die” — Charles Darwin
  • 20. 🦸 🦹 “Guess the 3-letter word I have in mind” Secret word: cat
  • 21. 🦸 🦹 “Guess the 3-letter word I have in mind” Secret word: cat “cow” “poz” “gaz” 1 0 1
  • 22. gaz cow poz Best score = 1 Secret word: cat
  • 25. stringToFind := 'cat'. g := GAEngine new. g populationSize: 1000. g numberOfGenes: stringToFind size. g createGeneBlock: [ :rand :index :ind | ($a to: $z) atRandom: rand ]. g fitnessBlock: [ :genes | (stringToFind asArray with: genes collect: [ :a :b | a = b ifTrue: [ 1 ] ifFalse: [ 0 ] ]) sum ]. g run. g visualize open
  • 26. C A T
  • 27. Muscle length Muscle force Muscle tension …
  • 28.
  • 29.
  • 30.
  • 31.
  • 32. 🧬 🧠 Part 1: Neural network Part 3: Neuroevolution + 🤖 = Part 2: Genetic algorithm
  • 33. 🧬 🧠 Part 1: Neural network Part 3: Neuroevolution + 🤖 = Part 2: Genetic algorithm
  • 34. Deep learning Greedy in properly formed training data E.g., distinguishing a 🐱 from a 🐶 requires 2000 pictures Not really the way humans learn
  • 35. Neuroevolution Evolution of neural network is called neuroevolution In practice: an AI algorithm evolves another AI algorithm
  • 36.
  • 37. MNWorld new seed: 7; open MNWorld new showCompleteMap
  • 38.
  • 39. neat := NEAT new. neat numberOfInputs: 121. neat numberOfOutputs: 3. neat populationSize: 200. neat fitness: [ :ind | w := MNWorld new. w mario: (MNAIMario new network: ind). 450 timesRepeat: [ w beat ]. w mario position x ]. neat numberOfGenerations: 160. neat run. w := MNWorld new. w mario: (MNAIMario new network: neat result). w open
  • 40. All the code is available for free Metacello new baseline: 'AgileArtificialIntelligence'; repository: 'github://Apress/agile-ai-in-pharo/src'; load.
  • 41. What the book is not about Complex deep learning models Transformers Language models Image recognition
  • 42. What the book is about Make you an expert in Genetic Algorithms Introduce you to the fascinating world of Neuroevolution Give non-trivial and appealing examples Does not require a strong mathematical background
  • 43. Future plan Update book with Roassal3 Extract the Neural Network chapters into a separate book (maybe) More examples about zoomorphic creatures Go deeper into Neuroevolution
  • 44.