AI and ML
https://drive.google.com/drive/folders/1QHfZt7_M0X4uNHv-
0akJJdct7JABsSgw
What we will cover ?
Part 1 - Search algorithm
Greedy search
A* search
Part 2 - Optimisation algorithms
Hill climb
Simulated annealing
Genetic algorithm
Part 3 - Fuzzy Logic
Part 4 - Machine Learning
Classification
Regression
Clustering
Association
Additional topics
Visualisation
Reinforcement learning
Part 5 - Neural networks and Deep Learning
Artificial neural networks
Convolutional neural networks
Part 6 - Natural language processing
AI and ML 1
Part of speech
Lemmatisation and stemming
Text search
Named entity recognition
Word cloud
Sentiment analysis
Part 7 - Computer Vision
Face detection
Face recognition
Object tracking
Image generation
Additional - Basic Python Programming
AI Terminology
Expert system - To simulate the knowledge of an expert into a system
Search algorithm - For example , if you wanna go to one point to another using
google maps , this algorithm will trace the best route for you
Optimization algorithm - For example , an e commerce company that needs to
load products on a truck so this algorithm can optimize space used in the truck
in order to load only the most profitable products
Case base reasoning - For example , it uses past cases or past situations that
has happened to help make a decision. For example in juridical cases as judge
can consult old cases to make a decision
Fuzzy Logic - For example, it is used mainly to control the operation of
industrial equipment
Machine Learning - To use historic data sets in order to perform predictions
Deep Learning - It deals on how to use artificial neural networks to solve
complex problems. For examples, self driving cars or facial recognition etc
AI and ML 2
Data Science - Uses ML techniques to provide insights to companies
Natural Language Process (NLP) : Deals in communication ( text , voice , video
etc )
Data Mining - Uses ML techniques in order to extract insights of data and find
patterns
Computer Vision - Examples are face detection, face recognition , image
classification. For example , you have picture of a cat or dog and the algorithm
will tell you if its a cat or a dog
Multiagent systems - It deals with the definition of intelligent agents that
communicate with each other so they can try to solve some kind of problems
Affective computing - Deals with emotions. For example on a online course ,
the algorithm can detect if the students are happy or not with the course
mlrose (python package) : Machine Learning,
Randomized Optimization and SEarch
Hill Climbing , Simulated annealing and Genetic algorithm
Hill Climb Algorithm
Starts with random solution and look for best neighbors
Go to the point with the greatest “curvature”
Can be used for both maximum or minimum
Fig - Hill Climb
AI and ML 3
Simulated Annealing
Inspired by Physics
Process of heating a metal and allowing it to cool slowly
Atoms tend to move around a lot at first and gradually enter low energy
states
Starts with a random solution using a variable that represents the
temperature ( starts high and goes down during the algorithm)
It goes to a bad solution and then finds a good solution
Genetic Algorithm
Create initial population ( Individual, Chromosome, Gene )
Evaluate population (evaluates the data)
Stopping criterion ( when should it stop ( one time or thousand times , etc)
and Select parents. Then use Genetic operator. Use cross over between
two parents. Apply mutation and then change a specific gene of the
solution. Then we do final evaluation of population and define surviving
population.
Fig - Genetic Algorithm
AI and ML 4
Fuzzy Logic
Intuition
Implementation using skfuzzy library
Homework
Applications : Washing Machine, Air Conditioner , Vacuum Cleaner, Dish
Washer, Microwave , Home Automation , Industrial Automation [if equipment is
heating up , fuzzy rule is applied to stop or cool down until its usable) (
Basically optimising for best usage )
Rules :
If cost LOW and benefit HIGH then cost-benefit HIGH
If cost HIGH and benefit HIGH then cost-benefit MEDIUM
If cost LOW and benefit LOW then cost-benefit MEDIUM
If cost HIGH and benefit LOW then cost-benefit LOW
If cost HIGH and benefit LOW then cost-benefit LOW
High cost and high benefit can be “half true” or “half false”
If cost-high < 0.2 and benefit-high >0.8 then cost-benefit HIGH
We use SciKit-Fuzzy library
MACHINE LEARNING
Classification (Naive bayes, decision trees, rules, instances, SVM, logistic
regression)
Regression (Linear Regression)
Clustering (k-means)
Association rules (apriori)
AI and ML 5
Pre-processing, feature selection, PCA, outliers and time series
Data exploration
Reinforcement learning
Examples of ML : Face detection ( as well as name recognition ) , movement
detection ( xbox kinetic) , robots , self driving cars, medical diagnosis , netflix,
amazon, spotify as well as other apps (recommendations algorithm), NASA
(sending robots to explore other planets), social media ads (algorithms),
security agencies, VR sets, google (search algorithm) , etc
Classification
Classification is a machine learning technique where an algorithm learns to
categorize input data into predefined classes or categories based on its
features. It is used for tasks like spam detection, sentiment analysis, and image
recognition.
Naive Bayes
AI and ML 6
Naive Bayes is a probabilistic machine learning algorithm used for classification
tasks. It's based on Bayes' theorem and assumes independence between
features, making it "naive" but often effective for text classification and spam
filtering.
Decision Tree
A Decision Tree is a machine learning algorithm used for classification and
regression tasks. It works by creating a tree-like model of decisions based on
features in the data, where each internal node represents a decision rule, each
branch represents an outcome of that rule, and each leaf node represents a
final classification or prediction.
AI and ML 7
Rule Based Learning
Rule Based Learning is a machine learning approach where the system uses
predefined rules to make decisions or classifications. These rules are typically
created by domain experts and are applied to input data to generate outputs or
predictions.
kNN ( Instance Based Learning )
AI and ML 8
kNN (k-Nearest Neighbors) is an instance-based machine learning algorithm
used for classification and regression tasks. It works by finding the k closest
data points to a given input and making predictions based on the majority class
or average value of those neighbors.
Support Vector Machines (SVM)
Support Vector Machines (SVM) are a powerful machine learning algorithm
used for classification and regression tasks. SVMs work by finding the optimal
AI and ML 9
hyperplane that best separates different classes in a high-dimensional space,
making them effective for both linear and non-linear classification problems.
Logistic Regression
Logistic Regression is a statistical method used for binary classification in
machine learning. It models the probability of an input belonging to a particular
category, making it effective for predicting outcomes with two possible classes.
AI and ML 10
Results in Orange using all above algorithms
K-Fold Cross Validation
K-Fold Cross Validation is a statistical technique used in machine learning to
assess a model's performance and generalizability. It involves dividing the
dataset into K equal subsets, training the model on K-1 subsets, and validating
on the remaining subset, repeating this process K times to ensure each subset
is used for validation once.
Regression
Regression is a type of machine learning technique used to predict a
continuous output variable based on input features. It involves identifying the
relationships between dependent and independent variables, often using linear
regression methods.
AI and ML 11
Linear Regression
Linear Regression is a statistical method used in machine learning to model the
relationship between a dependent variable and one or more independent
variables, predicting a continuous outcome by fitting a linear equation to the
observed data.
Clustering
Clustering is a machine learning technique used to group a set of objects in
such a way that objects in the same group, or cluster, are more similar to each
other than to those in other groups. It is often used for exploratory data analysis
and pattern recognition.
AI and ML 12
Clustering with K-MEANS
Clustering with K-MEANS is a machine learning technique used to partition a
dataset into distinct groups, or clusters, where each data point belongs to the
cluster with the nearest mean. It is commonly used for exploratory data
analysis and pattern recognition.
Association Rules
Association Rules is a machine learning technique used to discover interesting
relationships or patterns in large datasets. It identifies frequent itemsets and
generates rules that express the likelihood of items occurring together, often
used in market basket analysis and recommendation systems.
AI and ML 13
Apriori Algorithm
The Apriori Algorithm is a data mining technique used for discovering frequent
itemsets and generating association rules in large datasets. It is commonly
applied in market basket analysis to identify relationships between products
frequently purchased together.
AI and ML 14
REINFORCEMENT LEARNING
Reinforcement Learning is a machine learning technique where an agent learns
to make decisions by interacting with an environment, receiving feedback in the
form of rewards or penalties, and adjusting its behavior to maximize cumulative
rewards over time.
Intuition
Intuition, in the context of machine learning and artificial intelligence, refers to
the innate understanding or quick perception of concepts without conscious
AI and ML 15
reasoning. It's often used to describe the initial grasp of an idea or approach
before formal analysis or implementation.
AI and ML 16
AI and ML 17