Docsity

Comprehensive AI Notes – Concise, Well-Structured & Exam-Ready, Tesine universitarie di Tecniche Di Intelligenza Artificiale

Toggle sidebar
bg1
Comprehensive Notes on Artificial
Intelligence (AI)
(Approximate Length: 50-60 Pages Total)
Chapter 1: Foundations, Definitions, and History
(Target: 7-8 Pages)
1.1 What is Artificial Intelligence?
1.1.1 Defining Intelligence (Human vs. Artificial)
1.1.2 The Four Approaches to AI (Acting Humanly, Thinking Humanly, Acting Rationally,
Thinking Rationally)
1.1.3 The Main Goals of AI (Reasoning, Problem-Solving, Learning, Perception, Language)
1.2 The History and Milestones of AI
1.2.1 Philosophical Roots and Early Concepts (Leibniz, Hobbes)
1.2.2 The Dartmouth Workshop (1956) and the Coining of the Term "AI"
1.2.3 Early Breakthroughs (Perceptron, ELIZA, Shakey the Robot)
1.2.4 The First AI Winter (Late 1970s)
1.2.5 The Rise of Expert Systems (1980s)
1.2.6 Key Victories (Deep Blue vs. Kasparov, IBM Watson on Jeopardy!)
1.2.7 The Deep Learning Revolution (2010s to Present)
1.2.8 Generative AI and Large Language Models (LLMs)
1.3 Types of AI
1.3.1 Based on Capability (Narrow/Weak AI, General/Strong AI, Superintelligence/ASI)
1.3.2 Based on Functionality (Reactive, Limited Memory, Theory of Mind, Self-Aware)
Chapter 2: Machine Learning Fundamentals (Target:
10-12 Pages)
2.1 The ML Paradigm
2.1.1 Definition and Core Concepts (Hypothesis, Model, Cost Function)
2.1.2 Data Preprocessing (Cleaning, Normalization, Feature Engineering)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f

Anteprima parziale del testo

Scarica Comprehensive AI Notes – Concise, Well-Structured & Exam-Ready e più Tesine universitarie in PDF di Tecniche Di Intelligenza Artificiale solo su Docsity!

Comprehensive Notes on Artificial

Intelligence (AI)

(Approximate Length: 50-60 Pages Total)

Chapter 1: Foundations, Definitions, and History

(Target: 7-8 Pages)

1.1 What is Artificial Intelligence?

1.1.1 Defining Intelligence (Human vs. Artificial) 1.1.2 The Four Approaches to AI (Acting Humanly, Thinking Humanly, Acting Rationally, Thinking Rationally) 1.1.3 The Main Goals of AI (Reasoning, Problem-Solving, Learning, Perception, Language)

1.2 The History and Milestones of AI

1.2.1 Philosophical Roots and Early Concepts (Leibniz, Hobbes) 1.2.2 The Dartmouth Workshop (1956) and the Coining of the Term "AI" 1.2.3 Early Breakthroughs (Perceptron, ELIZA, Shakey the Robot) 1.2.4 The First AI Winter (Late 1970s) 1.2.5 The Rise of Expert Systems (1980s) 1.2.6 Key Victories (Deep Blue vs. Kasparov, IBM Watson on Jeopardy!) 1.2.7 The Deep Learning Revolution (2010s to Present) 1.2.8 Generative AI and Large Language Models (LLMs)

1.3 Types of AI

1.3.1 Based on Capability (Narrow/Weak AI, General/Strong AI, Superintelligence/ASI) 1.3.2 Based on Functionality (Reactive, Limited Memory, Theory of Mind, Self-Aware)

Chapter 2: Machine Learning Fundamentals (Target:

10-12 Pages)

2.1 The ML Paradigm

2.1.1 Definition and Core Concepts (Hypothesis, Model, Cost Function) 2.1.2 Data Preprocessing (Cleaning, Normalization, Feature Engineering)

2.2 Core ML Approaches

2.2.1 Supervised Learning (Classification, Regression) 2.2.2 Unsupervised Learning (Clustering, Dimensionality Reduction) 2.2.3 Reinforcement Learning (Agent, Environment, Reward, Policy)

2.3 Key Algorithms (Traditional)

2.3.1 Linear Regression and Logistic Regression 2.3.2 Decision Trees and Random Forests 2.3.3 Support Vector Machines (SVM) 2.3.4 K-Nearest Neighbors (KNN)

2.4 Model Evaluation and Optimization

2.4.1 Bias-Variance Tradeoff 2.4.2 Cross-Validation Techniques 2.4.3 Performance Metrics (Accuracy, Precision, Recall, F1 Score, ROC/AUC)

Chapter 3: Deep Learning and Neural Networks

(Target: 10-12 Pages)

3.1 Neural Network Architecture

3.1.1 Biological Inspiration and Artificial Neurons 3.1.2 Feedforward Networks (Input, Hidden, Output Layers) 3.1.3 Activation Functions (Sigmoid, ReLU, Tanh)

3.2 Training the Network

3.2.1 Gradient Descent and Loss Functions 3.2.2 Backpropagation Algorithm 3.2.3 Optimizers (Adam, RMSProp)

3.3 Specialized Network Architectures

3.3.1 Convolutional Neural Networks (CNN) for Computer Vision 3.3.2 Recurrent Neural Networks (RNN) and LSTMs for Sequential Data

Chapter 6: Ethical, Societal, and Future Challenges

(Target: 7-8 Pages)

6.1 AI Ethics and Governance

6.1.1 Bias and Fairness (Data Bias, Algorithmic Bias) 6.1.2 Transparency and Explainability (XAI) 6.1.3 Accountability and Legal Frameworks 6.1.4 Data Privacy and Security

6.2 Economic and Social Impact

6.2.1 Automation and the Future of Work 6.2.2 AI in Healthcare, Finance, and Education

6.3 The Future of AI Research

6.3.1 Achieving Artificial General Intelligence (AGI) 6.3.2 Neuro-Symbolic AI 6.3.3 The Role of Quantum Computing in AI

Chapter 1: Foundations, Definitions, and

History

1.1 What is Artificial Intelligence?

Artificial Intelligence (AI) is a branch of computer science that deals with the theory and development of computer systems capable of performing tasks that typically require human intelligence, such as visual perception, speech recognition, decision-making, and translation between languages. It is a field driven by the ambition to replicate, and ultimately exceed, human cognitive abilities within machines.

1.1.1 Defining Intelligence (Human vs. Artificial)

The concept of intelligence itself is multifaceted, and defining artificial intelligence often requires contrasting it with its biological counterpart.

Human Intelligence (HI)

Human intelligence is characterized by several complex attributes:

● Generalization and Transfer Learning: Humans can learn a new skill in one context (e.g., driving a car) and easily transfer that knowledge to a related but different context (e.g., driving a truck). ● Common Sense Reasoning: Humans possess an enormous body of intuitive knowledge about the world, which allows them to make quick, often probabilistic, judgments about typical situations. This is known as the "commonsense knowledge problem" in AI. ● Creativity and Intuition: Human intelligence involves generating novel ideas, art, and solutions that go beyond the learned patterns. Much of human decision-making is guided by intuition rather than explicit, step-by-step logic. ● Emotional and Social Intelligence: The ability to understand, manage, and use emotions to guide thought and behavior, and to navigate complex social interactions.

Artificial Intelligence (AI)

Current AI, or Narrow AI, primarily excels in:

● Speed and Scale: AI systems can process, analyze, and find patterns in massive datasets (Big Data) far beyond human capacity. ● Precision and Consistency: Once trained, AI executes tasks with extreme precision and perfect consistency, eliminating human error (e.g., in quality control or repetitive data entry). ● Specialization: Modern AI is a set of highly specialized tools. An image classification model is typically useless for language translation, demonstrating a profound lack of generalization.

another human. ● Required Capabilities for a Passing Agent: ○ Natural Language Processing (NLP): To communicate successfully. ○ Knowledge Representation (KR): To store and retrieve information. ○ Automated Reasoning (AR): To use stored information to answer questions and draw new conclusions. ○ Machine Learning (ML): To adapt to new circumstances and detect patterns.

3. Thinking Rationally (The Laws of Thought Approach)

This approach, rooted in the philosophy of Aristotle and formal logic, attempts to codify "right thinking." The system's decisions must be provably correct using formal logical deduction.

● Example: Logic programming languages like Prolog. ● Challenge: Translating complex, real-world, and often uncertain knowledge into formal logical statements (A⟹B is difficult when A is "it might rain"). This led to the rise of probabilistic methods.

4. Acting Rationally (The Rational Agent Approach)

The most widely accepted paradigm in modern AI. A rational agent is one that acts so as to achieve the best outcome, or when uncertainty exists, the best expected outcome.

● Focus: Rationality is concerned only with the actions taken, not the thought process that leads to them. ● Example: An autonomous vacuum cleaner (agent) acts rationally by always moving to a state where the floor (environment) is cleaner, maximizing its utility (cleanliness). ● Dominance: This approach is dominant because it is more amenable to scientific development and evaluation. The metric of success is measurable and objective (e.g., percentage of correct classifications, speed of movement, revenue generated).

1.1.3 The Main Goals of AI

AI research is broadly categorized by the cognitive functions it attempts to replicate or exceed:

Goal Area Description AI Subfields/Techniques

Reasoning The ability to draw conclusions, make inferences, and deduce logical consequences from given facts.

Knowledge Representation, Automated Planning, Expert Systems.

Problem-Solving Finding sequences of actions that achieve a

Search Algorithms (A∗, Depth-First Search),

specific goal, often through search algorithms and heuristics.

Constraint Satisfaction Problems (CSPs).

Learning Acquiring knowledge, recognizing patterns, and improving performance from data or experience.

Machine Learning, Deep Learning, Reinforcement Learning.

Perception Using sensory input (visual, auditory) to understand and interpret the environment.

Computer Vision, Speech Recognition, Sensor Fusion.

Language The ability to understand, interpret, and generate human language, both spoken and written.

Natural Language Processing (NLP), Machine Translation, Generative Models (LLMs).

1.2 The History and Milestones of AI

The quest to create thinking machines is centuries old, but the formal field of AI began in the mid-20th century.

1.2.1 Philosophical Roots and Early Concepts

● 17th Century: Gottfried Wilhelm Leibniz developed a system of symbolic logic, the calculus ratiocinator , envisioning a mechanism that could resolve all disputes through calculation. ● 19th Century: Charles Babbage and Ada Lovelace conceptualized the Analytical Engine. Lovelace is often credited with recognizing that machines could process symbols beyond numbers, suggesting the idea of a universal computer, but also notably argued that the engine could only do what it was commanded (the "no originality" argument, a precursor to modern debates on AI creativity). ● 1943: Warren McCulloch and Walter Pitts published A Logical Calculus of the Ideas Immanent in Nervous Activity , proposing a mathematical model of neurons and neural networks, establishing the link between neuroscience and computation.

1.2.2 The Dartmouth Workshop (1956)

This two-month summer workshop at Dartmouth College is universally recognized as the event that launched the field.

● Organizers: John McCarthy, Marvin Minsky, Nathaniel Rochester, and Claude Shannon.

● Scalability Issue: Early programs, despite their ingenuity (like logic provers), were brittle. They worked well on small, controlled "toy problems" but failed completely when scaled up to real-world complexity (e.g., millions of facts, uncertain data). ● Lack of Processing Power: The computational resources of the time (mid-1970s) were simply insufficient to handle the data required for sophisticated AI models.

1.2.5 The Rise and Fall of Expert Systems (1980s)

A brief commercial resurgence, known as the second AI Summer, was driven by Expert Systems.

● Architecture: An Expert System consisted of two main components: ○ Knowledge Base: A repository of human expert knowledge, typically stored as IF-THEN rules (e.g., IF the patient has fever AND cough THEN the diagnosis is flu). ○ Inference Engine: The software that applies the rules to the known facts (data) to deduce new facts or a solution, using either forward-chaining (data-driven) or backward-chaining (goal-driven) logic. ● Success Story: XCON (eXpert CONfigurer) at Digital Equipment Corporation saved the company millions by automatically configuring complex computer systems. ● Limitations: Expert systems were extremely expensive and time-consuming to build (the "knowledge acquisition bottleneck"), hard to maintain, and lacked the ability to learn or adapt outside of their specific domain. This led to another downturn in the late 1980s.

1.2.6 Key Victories and Statistical AI (1990s - 2000s)

The focus shifted from rule-based, symbolic AI to statistical AI and Machine Learning , where systems learned probabilistic patterns from data.

● 1997: Deep Blue vs. Kasparov: IBM's Deep Blue defeated World Chess Champion Garry Kasparov. The system relied on a highly parallel processing architecture and a sophisticated search algorithm (alpha-beta pruning) to evaluate 200 million positions per second, demonstrating the superiority of brute force computation over human-level tactical planning in a limited domain. ● 2011: IBM Watson on Jeopardy!: Watson demonstrated advanced capabilities in NLP, knowledge retrieval, and probabilistic reasoning by successfully competing against human champions on the complex, language-based quiz show Jeopardy!.

1.2.7 The Deep Learning Revolution (2010s to Present)

Deep Learning (DL), a subset of Machine Learning that uses deep neural networks (networks with many hidden layers), became the dominant force in AI, driven by three key factors:

  1. Big Data: The growth of the internet provided massive, cheap datasets (like ImageNet) needed to train millions of neural network parameters without overfitting.
  2. GPUs (Graphics Processing Units): The parallel architecture of GPUs, originally designed for rendering graphics, proved highly efficient for the matrix multiplications required by neural networks, accelerating training times drastically.
  1. Algorithmic Breakthroughs: Innovations like the ReLU (Rectified Linear Unit) activation function and techniques like Dropout solved the "vanishing gradient problem," enabling the successful training of deep, multi-layered networks. ● 2012: Alex Krizhevsky's AlexNet used a deep Convolutional Neural Network (CNN) to drastically reduce the error rate in the ImageNet challenge, marking the start of the deep learning era in computer vision. ● 2016: AlphaGo: Google DeepMind’s AlphaGo used a combination of deep neural networks (policy and value networks) and Monte Carlo Tree Search (MCTS) to defeat the world champion of Go, Lee Sedol. This victory was monumental as Go has exponentially more possible moves than chess, requiring intuition and evaluation that Deep Blue lacked.

1.2.8 Generative AI and Large Language Models (LLMs)

The next major leap was the creation of systems capable of generating novel, coherent content.

● 2017: The Transformer Architecture: Introduced by Google in the paper Attention Is All You Need. This architecture, relying entirely on the Attention Mechanism , allowed parallel processing of sequential data, dramatically improving training speed and scale for NLP tasks. ● 2018 onwards: BERT and GPT: ○ BERT (Bidirectional Encoder Representations from Transformers): Demonstrated contextual word understanding by analyzing text bidirectionally. ○ GPT (Generative Pre-trained Transformer): Developed by OpenAI, these models scale the Transformer's decoder stack to unprecedented sizes, enabling them to generate highly coherent and contextually relevant text, driving the recent public explosion of Generative AI.

1.3 Types of AI

AI is typically categorized along two main dimensions: the level of intelligence/capability it possesses, and the specific functions it can perform.

1.3.1 Classification Based on Capability

This classification, based on the potential scope of the AI's power, helps define the research goals of the field.

1. Narrow AI (Weak AI)

● Definition: An AI system designed and trained to perform a single, specific task or a narrow range of tasks. It operates within a pre-defined range and cannot perform outside its programmed constraints. ● Current Status: This is the only type of AI that currently exists. ● Examples: Image recognition software, Google Search algorithm, Siri/Alexa, factory

and recent environmental observations (current data). ● Example: Self-Driving Cars. They monitor the speed, direction, and distance of other vehicles on the road for a short duration (e.g., the last few seconds) to make driving decisions (like changing lanes or braking).

3. Theory of Mind AI

● Function: This advanced, theoretical level of AI would be able to represent the mental states of others, including their intentions, beliefs, knowledge, and desires, and adjust its own behavior accordingly. ● Significance: To achieve this, AI would need to understand human emotion and common social cues, making human-AI interaction far more seamless and empathetic. ● Status: Not yet achieved, but research into human-robot interaction (HRI) and social robotics is exploring this stage.

4. Self-Aware AI

● Function: The ultimate and purely hypothetical stage, where the AI develops self-consciousness, understands its own internal state, and is aware of its existence. ● Characteristics: Such an AI would not only understand others' consciousness (Theory of Mind) but possess its own. This would involve sentience, desires, and subjective experiences. ● Status: A distant, purely speculative future goal. Research into this area falls under philosophy and advanced neuroscience/computation.

Summary of Chapter 1

This chapter established the fundamental definitions and historical context of Artificial Intelligence. We covered the philosophical underpinnings of AI, categorized the field based on four major approaches (human-centric vs. rational, thought vs. action), and outlined the major goals (learning, reasoning, perception, language). We then traced the history from its symbolic logic roots to the current era of Deep Learning and Generative AI, noting the critical role of data, hardware, and key algorithmic breakthroughs like the Transformer. Finally, we introduced the capability spectrum of AI (Narrow, General, Superintelligence) and the functional taxonomy (Reactive, Limited Memory, Theory of Mind, Self-Aware), setting the stage for a detailed dive into the technical core of modern AI: Machine Learning.

Chapter 2: Machine Learning

Fundamentals

Machine Learning (ML) is the subfield of Artificial Intelligence that gives computers the ability to learn without being explicitly programmed. It is the engine that drives modern AI, allowing systems to autonomously discover patterns, make predictions, and improve their performance over time through exposure to data.

2.1 The Machine Learning Paradigm

2.1.1 Formal Definition and Core Concepts

The most widely accepted formal definition of machine learning was provided by Tom Mitchell in 1997:

"A computer program is said to learn from Experience ( E ) with respect to some Task ( T ) and some Performance measure ( P ) , if its performance on T, as measured by P, improves with experience E."

Understanding the relationship between these three components is fundamental to all ML systems:

  1. Task ( T ): The goal the model is attempting to achieve (e.g., classifying an email as spam, predicting a house price, generating a caption for an image).
  2. Experience ( E ): The data provided to the program for learning (e.g., a dataset of historical spam and non-spam emails, a set of images with captions).
  3. Performance ( P ): A metric used to quantify how well the program is performing the task (e.g., accuracy, mean squared error, F1 score).

The Model, Hypothesis, and Cost Function

At the core of ML is the mathematical model, which represents the function the machine learns:

● Hypothesis Function ( h ): A candidate function that maps input features (X) to an output prediction (y^). For example, in linear regression, the hypothesis function is a straight line: hθ(x)=θ0+θ1x. The model's goal is to find the best parameters (θ) for this function. ● Cost Function ( J(θ) ) or Loss Function: A function that quantifies the "cost" or "error" of the model's predictions compared to the actual target values (y). A higher value of the cost function indicates poorer model performance. The goal of training is to minimize this cost. ○ Example (Regression): Mean Squared Error (MSE) is a common cost function: J(θ)=2m1i=1∑m(hθ(x(i))−y(i))

● Outlier Detection and Treatment: Outliers are data points significantly distant from other observations. They can be detected using statistical methods (e.g., Z-score or Interquartile Range - IQR ) and are typically removed or capped (winsorized).

2. Feature Scaling

Scaling ensures that all input features contribute equally to the distance calculations and gradient updates. This is critical for distance-based algorithms (like K-NN, SVM) and gradient-based algorithms (like Linear/Logistic Regression, Neural Networks).

● Normalization (Min-Max Scaling): Scales features to a fixed range, usually [0,1]. xnew=xmax−xminx−xmin ● Standardization (Z-Score Normalization): Rescales data to have a mean (μ) of 0 and a standard deviation (σ) of 1. This is less susceptible to outliers. xnew=σx−μ

3. Encoding Categorical Data

ML algorithms primarily work with numbers. Categorical features (e.g., 'Color': Red, Green, Blue) must be converted into numerical representations.

● Ordinal Encoding: Used for categorical features with a natural order (e.g., 'Size': Small, Medium, Large → 1, 2, 3). ● One-Hot Encoding: Used for nominal categorical features (no inherent order). It creates a new binary feature (0 or 1) for each unique category. ○ Example: 'Color' → 'Is_Red', 'Is_Green', 'Is_Blue'. This avoids implying an arbitrary ordering among categories.

4. Feature Engineering

This is the process of creating new features or transforming existing ones to make the model perform better. It often requires significant domain expertise.

● Example 1 (Time): Extracting 'Hour of Day', 'Day of Week', or 'Is Holiday' from a raw timestamp feature. ● Example 2 (Polynomial Features): If data shows a non-linear relationship, a new feature x2 or log(x) might be added to a linear model to capture complexity.

2.2 Core Machine Learning Approaches

Machine learning is typically categorized into three main types based on the nature of the training signal (the feedback received by the model).

2.2.1 Supervised Learning

● Definition: The model learns from labeled data , where each input (x) is paired with the correct output or "supervision" (y). The model's goal is to learn a mapping function from input to output. ● Training Signal: The difference between the model's prediction and the correct label (y).

● Key Tasks:

  1. Classification ( T ): The output variable is a category or a discrete class label. ■ Examples: Spam/Not Spam, classifying images (Cat/Dog/Bird), loan risk (High/Medium/Low). ■ Algorithms: Logistic Regression, Support Vector Machines, Decision Trees, K-Nearest Neighbors.
  2. Regression ( T ): The output variable is a real value or a continuous quantity. ■ Examples: Predicting house price, stock market prediction, estimating temperature. ■ Algorithms: Linear Regression, Polynomial Regression.

2.2.2 Unsupervised Learning

● Definition: The model learns from unlabeled data with no guidance or supervision. The goal is to discover hidden structure, patterns, or relationships within the data itself. ● Training Signal: There is no "correct" answer (y). The model relies on internal metrics like distance or variance. ● Key Tasks:

  1. Clustering: Grouping data points such that points in the same group (cluster) are more similar to each other than to those in other groups. ■ Examples: Market segmentation (grouping customers by purchasing behavior), image compression. ■ Algorithms: K-Means, Hierarchical Clustering.
  2. Dimensionality Reduction: Reducing the number of input features while retaining most of the important information. Useful for data visualization and speeding up training. ■ Examples: Compressing a dataset with 100 features down to 5 features. ■ Algorithms: Principal Component Analysis (PCA), t-distributed Stochastic Neighbor Embedding (t-SNE).
  3. Association Rule Mining: Discovering rules that describe large segments of the data, often in the form of "If A and B, then C." ■ Example: Market basket analysis (discovering that customers who buy milk and bread also tend to buy eggs). ■ Algorithm: Apriori algorithm.

2.2.3 Reinforcement Learning (RL)

● Definition: The model (called the Agent ) learns to make a sequence of decisions in an Environment to maximize a cumulative Reward signal. It learns through trial and error, like training a dog. ● Key Components:

  1. Agent: The learner or decision-maker (the ML model).
  2. Environment: The external world with which the agent interacts.
  3. State ( s ): The current situation in the environment (e.g., the position of a robot).
  4. Action ( a ): A move the agent can make to change the state.

● Mechanism: A non-parametric supervised learning method that creates a tree-like model of decisions and their possible consequences. ● Training: The tree is built via a recursive process called Recursive Binary Splitting. At each step, the algorithm chooses the feature and split point that best separates the data. ● Splitting Criteria (Impurity Measures): The "best" split is determined by minimizing impurity in the resulting child nodes. ○ Classification: Gini Impurity or Entropy (Information Gain). ○ Regression: Mean Squared Error (MSE) or variance reduction. ● Problem: Decision trees are prone to overfitting , meaning they become too complex and memorize the training data, leading to poor generalization.

Random Forests (Ensemble Learning)

● Concept: An ensemble method that corrects the decision tree's habit of overfitting by training a large number of individual decision trees and having them vote on the final prediction. This technique is called Bagging (Bootstrap Aggregating). ● How it Works:

  1. Bootstrap: Each tree is trained on a different random subset of the training data (sampling with replacement).
  2. Feature Randomness: During the split-finding process, only a random subset of features is considered at each node. ● Benefit: The combination of many slightly different, low-bias, high-variance trees results in a model that is significantly more accurate and stable (low bias, low variance).

2.3.3 Support Vector Machines (SVM)

● Goal (Classification): To find the optimal hyperplane that maximally separates the data points of different classes in a high-dimensional space. ● Maximum Margin: The "optimal" hyperplane is the one that has the largest minimum distance to the nearest training data point of any class. These closest points are called the Support Vectors. Maximizing this margin improves generalization. ● The Kernel Trick: SVM's true power lies in its ability to handle non-linearly separable data by using Kernels (e.g., Polynomial, Radial Basis Function - RBF). The Kernel Trick allows the algorithm to implicitly map the input features into a much higher-dimensional space where the data is linearly separable, without ever explicitly computing the coordinates in that high-dimensional space. ○ This is a computationally efficient way to model highly complex, non-linear relationships.

2.3.4 K-Nearest Neighbors (KNN)

● Mechanism: A simple, non-parametric, lazy learning classification and regression algorithm. It makes no explicit generalization or training phase. All work is deferred until a prediction is requested. ● Classification: To classify a new data point, the algorithm finds the K closest points in the training set (using a distance metric like Euclidean distance). The new point is then

assigned the class most common among its K neighbors (a majority vote). ● Regression: The predicted value is the average of the target values of the K neighbors. ● Challenges: ○ Computational Cost: Since it stores the entire training dataset, prediction time is high for large datasets. ○ Curse of Dimensionality: In high-dimensional feature spaces, distance metrics become less meaningful, degrading performance.

2.4 Model Evaluation and Optimization

A model is useless if its performance cannot be reliably measured. Evaluation involves testing the model's ability to generalize to unseen data.

2.4.1 The Bias-Variance Tradeoff

This is the central dilemma in supervised learning: the goal is to find a model complexity that minimizes both bias and variance.

● Bias: The error introduced by approximating a real-world problem (which may be complicated) with a simplified model (e.g., approximating a curve with a straight line). ○ High Bias → Underfitting: The model is too simple; it fails to capture the relationships in both the training and test data. ● Variance: The amount that the model's performance changes when trained on different subsets of the training data. High variance indicates the model is too sensitive to the training set. ○ High Variance → Overfitting: The model is too complex; it has memorized the noise and details of the training data and performs poorly on unseen test data.

The ideal model minimizes Total Error, which is a combination of irreducible error (noise), bias, and variance:

Total Error=Irreducible Error+Bias2+Variance

2.4.2 Data Splitting and Cross-Validation Techniques

Standard Data Split

Before training begins, the dataset is typically split into three non-overlapping sets:

  1. Training Set (e.g., 60-80%): Used to train the model (adjust the parameters θ).
  2. Validation Set (e.g., 10-20%): Used for hyperparameter tuning and model selection (e.g., choosing the best K for K-NN or the maximum depth for a Decision Tree).
  3. Test Set (e.g., 10-20%): Used once at the very end to provide an unbiased estimate of the model's final performance on unseen data.

K-Fold Cross-Validation

A robust technique used when data is limited, ensuring all data is used for both training and