Poornima Mamadapur Assistant professor of CSE(AI&ml) deapartment,Bldeacet,Vijayapur Machine Learning II SUB CODE:Bai702 B.L.D.E.A's V.P. Dr. P.G. Halakatti College of Engineering and Technology
What is Machine Learning? Machine Learning is a subset of Artificial Intelligence that enables systems to learn from data and make predictions or decisions without being explicitly programmed. Example: Online shopping, Predicting house prices, spam detection, self-driving cars.
Types of Machine Learning S upervised Learning (Labeled data) Unsupervised Learning (Unlabeled data) Semi-Supervised Learning (Few labels + many unlabeled) Reinforcement Learning (Agent + Reward )
Supervised vs Unsupervised Supervised Learning: - Uses labeled data - Predict output (Regression / Classification) - Example: Spam detection, house price prediction Unsupervised Learning: - Uses unlabeled data - Finds hidden patterns - Example: Customer segmentation, topic modeling
Reinforcement & Semi-Supervised Reinforcement Learning: - Agent interacts with environment - Learns to maximize rewards - Example: Self-driving car, game playing AI Semi-Supervised Learning: - Few labeled data + many unlabeled data - Example: Medical image classification
Comparison of Types Supervised: Labeled data → Predict output Unsupervised: Unlabeled data → Discover patterns Semi-Supervised: Few labels + Unlabeled → Improve accuracy Reinforcement: Learn by reward feedback → Best actions
Hierarchy Relationship
Well-Posed Learning problem A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P , if its performance at tasks in T , as measured by P , improves with experience E .
Components of a Well-Posed Learning Problem Task (T) What the program is trying to do (the objective). Example: Classifying emails as spam or not spam. Experience (E) Data or interaction through which the program learns. Example: A dataset of labeled emails (spam or not spam). Performance Measure (P) A metric to evaluate how well the program performs the task. Example: Accuracy, Precision, Recall, or F1-score.
Examples 1. Playing Checkers Task (T): Learn to play checkers and win. Experience (E): Playing thousands of checkers games (possibly against itself or other players). Performance (P): Percentage of games won against human opponents or another program. 2. Handwriting Recognition Task (T): Classify handwritten characters (e.g., digits 0–9). Experience (E): Training dataset of labeled handwritten characters (images with correct labels). Performance (P): Accuracy of correctly recognizing characters in a test set.
Cont.. 3. Robot Driving Task (T): Drive a car on a road safely. Experience (E): Recorded sensor data and camera images while driving, including feedback about collisions or lane departures. Performance (P): Average distance driven without human intervention or accidents.
Designing Learning System Choosing the training Experience Choosing the target function Choosing a Representation for the target function Choosing a function approximation algorithm The final design is obtained
1. Choosing the training Experience Three attributes are taken to be consideration while choosing the training experience Type of feedback: Direct & Indirect feedback Degree Distribution of examples: More possible combinations, more situations, more examples, Learning over distribution range of examples.
2. Choosing the target function Determine the type of knowledge to be learned Example: Checkers-playing program – legal moves known, best move unknown Many optimization problems fall in this category (e.g., scheduling, manufacturing control ) Function that selects the best move from legal moves Representation: ChooseMove : B → M Key design choice: Selecting appropriate target function
Alternative Target Function Evaluation function V assigns score to each board state Representation: V : B → ℝ Higher scores → better board states Move selection: Generate successors → choose best via V
Definition of Target Function V V(b) = 100 → if final state won V(b) = -100 → if final state lost V(b) = 0 → if final state drawn Else: V(b) = V(b') → best final state reachable
3. Choosing a Representation for the target function Why Representation Matters? 1. Representation determines how the target function is expressed. 2. More expressive → better approximation to ideal function V. 3. Trade-off : Expressive models need more training data. Goal: Balance between complexity and learnability
Representation Options Large table: Value for every board state. Rule-based system: IF-THEN rules using board features. Polynomial function: Predefined mathematical expression. Artificial Neural Network: Complex, highly expressive model.
Chosen Representation: Linear Function Simpler to learn compared to complex models. Uses weighted sum of board features. Easier to interpret and compute during gameplay.
Board Features (x₁ to x₆) x₁: Number of black pieces. x₂: Number of red pieces. x₃: Number of black kings. x₄: Number of red kings. x₅: Black pieces threatened by red. x₆: Red pieces threatened by black.
Formula for Target Function Learned function V̂(b): V̂(b) = w₀ + w₁x₁ + w₂x₂ + w₃x₃ + w₄x₄ + w₅x₅ + w₆x₆ Weights (w₀ … w₆) are determined by the learning algorithm.
Impact of Weights w₁ … w₆ → importance of each board feature. w₀ → constant offset for board value. Learning adjusts weights to maximize performance (win rate).
Summary of Design Choices Task (T): Playing checkers. Performance (P): Percentage of games won. Experience (E): Self-play games. Target Function: V : Board → ℝ. Representation: Linear combination of board features.
4. Choosing a function approximation algorithm In order to learn the target function f we require a set of training examples, each describing a specific board state b and the training value Vtrain (b) for b . Each training example is an ordered pair of the form (b, V train(b)). For instance, the following training example describes a board state b in which black has won the game and for which the target function value Vtrain (b ) is therefore +100 .
Estimating Training Values Final game outcome doesn’t directly give intermediate values Use bootstrapping : estimate value of b by value of its successor Formula: Intuition: Values closer to game end are more accurate and help estimate earlier states
Adjusting Weights to Fit Training Data Approximate V(b) using weighted features : Objective: minimize squared error over training examples: Need an incremental, robust learning algorithm
Least Mean Squares (LMS) Algorithm For each training example ( b,Vtrain (b )) Predict current value V(b) Update weights : η is the learning rate (e.g., 0.1) -If error=0, No need to change -If error is + ve then each weight is incresed in proportion -If error is – ve then each weight is decresed in proportion
Why LMS Works Performs stochastic gradient descent on squared error Incremental updates allow learning with streaming data Robust to noise in estimated training values Proven to converge to least-squares solution in many cases
Key Components of Learning Systems Performance System Critic Generalizer Experiment Generator (Figure 1.1: Checkers Learning Program)
Performance System Solves given performance task (e.g., playing checkers) Input : New problem (initial game board) Output : Solution trace (game history) Uses learned evaluation function to choose moves Performance improves as evaluation function becomes accurate
Critic Input : Game history (trace) Output : Training examples of target function Example : <board state, estimated value> Implements training rule (Equation 1.1)
Generalizer Input : Training examples Output : Hypothesis (estimated target function) Learns general rules beyond training data Example : LMS algorithm to learn weights (w0, …, w6)
Experiment Generator Input : Current hypothesis Output : New problem for exploration Strategy : Choose initial board positions Goal : Maximize learning rate Simple approach: Same initial board each game
Summary of Design Choices (Figure 1.2)
PERSPECTIVES in machine learning One useful perspective on machine learning is that it involves searching a very large space of possible hypotheses to determine one that best fits the observed data and any prior knowledge held by the learner . . The learner's task is thus to search through this vast space to locate the hypothesis that is most consistent with the available training examples. The LMS algorithm for fitting weights achieves this goal by iteratively tuning the weights, adding a correction to each weight each time
ISSUES IN MACHINE LEARNING What algorithms exist for learning general target functions from specific training examples? How much training data is sufficient ? When and how can prior knowledge held by the learner guide the process of generalizing from examples? What is the best strategy for choosing a useful next training experience, and how does the choice of this strategy alter the complexity of the learning problem? What is the best way to reduce the learning task to one or more function approximation problems ? How can the learner automatically alter its representation to improve its ability to represent and learn the target function?