Topic 3 ML

Introduction to Artificial Intelligence

  • AI (الذكاء الاصطناعي)

  • Major subfield: Machine Learning

Outline of Topics

  • Introduction

  • Supervised Learning

    • Classification Problem

    • Classification by Similarity: Nearest Neighbor Algorithm (k-NN)

    • Classification by Boundary: Decision Boundary (Perceptron Algorithm, SVM)

  • Unsupervised Learning

    • Clustering Problem

    • K-means Algorithm

  • Reinforcement Learning

    • Q-Learning Algorithm

Problem Solving through Learning

  • AI solves problems through:

    • Generate and Test

    • Problem Reduction

  • Machine Learning: letting the computer learn from data or feedback, emulating human learning.

AI and Machine Learning Definitions

  • Artificial Intelligence: programs that can sense, reason, act, and adapt.

  • Machine Learning: algorithms improve performance with more data over time.

  • Deep Learning: subset of ML utilizing multilayered neural networks to learn from large datasets.

Machine Learning Approaches

  1. Supervised Learning: Learning from labeled data (input-output pairs).

  2. Unsupervised Learning: Learning from unlabeled data; finding underlying structures.

  3. Reinforcement Learning: Learning through interaction with an environment with feedback.

Typical Problems for Machine Learning

  • Classification: Predicting class labels from inputs (e.g., spam detection).

  • Clustering: Grouping similar inputs (e.g., market segmentation).

  • Regression: Predicting continuous variables (e.g., housing prices).

  • Association Rules: Finding common patterns in data (e.g., basket analysis).

  • Ranking: Generating optimal orderings for recommendations.

Supervised Learning (SL)

  • Task: Learn from input-output pairs to make predictions.

  • Example: Handwritten number recognition.

SL Classification

  • Classification is learning to assign categories based on examples.

  • The defining task involves mapping inputs to discrete categories (classifiers).

Weather Prediction Example

  • Predict if it will rain based on historical data of temperature and humidity.

  • Designed to classify days into two categories: Rain or No Rain.

Approaches in Classification

  • Classification by Similarity: Nearest Neighbor Algorithm

    • Classifies a new point based on its nearest neighbor.

  • k-Nearest Neighbor Algorithm (k-NN):

    • Classify based on the majority class of the k nearest neighbors.

    • Utilizes Euclidean distance for measuring similarity.

Measuring Similarity

  • Euclidean distance and Manhattan distance are common measures.

  • Important for algorithms like k-NN.

Example of k-NN

  • Classifying a point based on its distance to labeled points in the dataset.

  • Consider multiple coordinates; calculate distances to classify.

Decision Boundaries in Classification

  • Classifying involves creating a decision boundary that separates different classes.

  • Perceptron Algorithm finds the best linear boundary.

Learning Algorithm Steps

  • Adjust weights based on classification errors until convergence.

Support Vector Machines (SVM)

  • SVM aims to maximize the margin between classes using support vectors.

  • The decision boundary is determined based on the closest points (support vectors).

Hard vs. Soft Margin

  • Hard margin: no misclassification allowed.

  • Soft margin: allows some misclassification for better generalization.

Unsupervised Learning

  • Deals with rather unlabeled datasets to find hidden structures.

  • Clustering Applications include market research and social network analysis.

  • K-means Clustering: an important unsupervised learning algorithm that separates data into k clusters.

Reinforcement Learning (RL)

  • Involves learning from the environment through rewards/punishments.

  • Examples include training robots through trial and error.

Q-Learning

  • A method to learn value functions representing action rewards.

  • Update rules incorporate learning rates and discount factors to optimize learning.

Summary of ML Approaches

  • Unsupervised Learning: No labels; clustering.

  • Supervised Learning: Labeled data; classification.

  • Reinforcement Learning: Learning through feedback (rewards/punishments).

Conclusions and References

  • Notebooks on various ML topics are available for further reading.