Comprehensive Study Notes on Machine Learning and Artificial Intelligence Techniques

Techniques in Artificial Intelligence (AI)

  • Neural Networks:     * Modeled after the structure and function of the biological human brain.     * Consists of interconnected nodes called artificial neurons.     * Information is processed by passing signals through these nodes.     * Basic Layers in a Neural Network:         1. Input Layer: The first layer that receives raw data or features for the system.         2. Hidden Layers: Intermediate layers where actual processing occurs through weights, biases, and thresholds.         3. Output Layer: The final layer that produces the conclusion or result (e.g., a prediction).

  • Machine Learning (ML):     * A method where computers learn from experience rather than through explicit programming.     * The system finds patterns in data and improves performance automatically.     * Improvements are made by comparing predictions with actual results.

  • Deep Learning (DL):     * A specialized subset of Machine Learning using very large neural networks with multiple layers (hence "deep").     * Capable of processing huge amounts of data to find complex patterns.     * How It Works: Uses forward propagation (passing data to the output) and backward propagation (correcting errors by adjusting weights).

  • Natural Language Processing (NLP):     * Enables computers to understand, interpret, and respond to human language.     * Identifies grammar, meaning, and emotion in text or speech.

  • Computer Vision:     * Allows computers to see, analyze, and understand visual data from images or videos.     * Used for facial recognition, autonomous vehicles, and medical diagnosis.

  • Cognitive Computing:     * Attempts to replicate human thought processes in a computerized model.     * A combination of AI, NLP, and machine learning to achieve human-like interactions.

  • Supporting Technologies:     * Graphical Processing Units (GPUs): Specialized hardware for high-speed calculations required to train neural networks.     * Internet of Things (IoT): Connected devices that provide the massive datasets used to train AI models.

The Machine Learning Model (T, E, P)

  • Professor Mitchell's Definition:     * 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. \text{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. }

  • Main Components:     1. Task (T): The real-world problem to solve (e.g., classification, regression, clustering).     2. Experience (E): The data or examples provided for learning.     3. Performance (P): Metrics like accuracy, precision, recall, F1 score, and sensitivity used to measure how well the model is functioning.

Types of Machine Learning

  • 1. Supervised Machine Learning:     * Algorithms apply learning from past data to new data using labeled examples.     * Uses a "teacher" or "supervisor" model where both input and correct output are provided.     * Mathematical Representation: Y=f(X)Y = f(X).     * Subtypes:         * Classification: Predicting a categorical label (e.g., Spam vs. Not Spam).         * Regression: Predicting continuous numerical values (e.g., stock prices).

  • 2. Unsupervised Machine Learning:     * Trains on information that is neither classified nor labeled.     * The goal is to find hidden patterns or groupings in input data.     * Subtypes:         * Clustering: Grouping similar data points together.         * Association Analysis: Identifying relationships between variables (e.g., people who buy coffee also buy milk).         * Dimensionality Reduction: Reducing the number of input variables while keeping important information.         * Anomaly Detection: Finding outliers or unusual patterns.

  • 3. Semi-Supervised Learning:     * A hybrid approach using a small amount of labeled data and a large amount of unlabeled data for training.     * Techniques include Self-Training and Co-Training.

  • 4. Reinforcement Learning (RL):     * A goal-oriented approach using a system of rewards and punishments.     * An agent interacts with an environment and learns through trial and error.     * Positive Reinforcement: Increases behavior frequency via rewards.     * Negative Reinforcement: Strengthens behavior by avoiding negative outcomes.

Regression Analysis Techniques

  • Linear Regression:     * Finds a straight-line relationship between a dependent and independent variable.     * Equation: Y=b0+b1X+eY = b_0 + b_1X + e     * YY is the dependent variable; XX is the independent variable; b0b_0 is the intercept; b1b_1 is the slope; ee is the error term.

  • Logistic Regression:     * Used when the dependent variable is categorical (e.g., binary 0/1).     * Predicts probability using a logit (sigmoid) function.

  • Ridge Regression:     * Used to handle multicollinearity.     * Adds an L2 regularization (penalty term) to prevent overfitting.     * Equation: Minimize ∑(y−y^)2+λ∑β2\text{Minimize } \sum (y - \hat{y})^2 + \lambda \sum \beta^2

  • Lasso Regression (Least Absolute Shrinkage and Selection Operator):     * Performs variable selection by shrinking some coefficients to zero.     * Adds an L1 regularization penalty.     * Equation: Minimize ∑(y−y^)2+λ∑∣β∣\text{Minimize } \sum (y - \hat{y})^2 + \lambda \sum |\beta|

  • Polynomial Regression:     * Used for non-linear relationships by creating a curved line.     * Equation: y=b0+b1x+b2x2+⋯+bnxny = b_0 + b_1x + b_2x^2 + \dots + b_nx^n

  • Stepwise Regression:     * Automatically selects variables to add or remove based on statistical significance.     * Methods include Forward Selection, Backward Elimination, and Bidirectional Elimination.

  • ElasticNet Regression:     * A hybrid technique combining both L1 (Lasso) and L2 (Ridge) penalties.

Classification: K-Nearest Neighbor (K-NN)

  • Definition: A simple, non-parametric algorithm that classifies a data point based on how its neighbors are classified.

  • Working Principle: It calculates the distance between a new point and all points in the dataset, selecting the "K" closest points to vote on the class.

  • Distance Formula (Euclidean):     * d(p,q)=(x1−x2)2+(y1−y2)2+(z1−z2)2d(p, q) = \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2 + (z_1 - z_2)^2}

  • K-NN Numerical Problem 1: Predict Fruit Type     * Query Point: Sweetness = 8, Size = 9, Weight = 170. (K=3)     * Calculation Steps (Distances to query):         1. D1=(5−8)2+(6−9)2+(200−170)2=30.033D_1 = \sqrt{(5-8)^2 + (6-9)^2 + (200-170)^2} = 30.033         2. D2=(4−8)2+(5−9)2+(210−170)2=40.099D_2 = \sqrt{(4-8)^2 + (5-9)^2 + (210-170)^2} = 40.099         3. D3=(8−8)2+(9−9)2+(160−170)2=10.000D_3 = \sqrt{(8-8)^2 + (9-9)^2 + (160-170)^2} = 10.000         4. D4=(11−8)2+(12−9)2+(140−170)2=30.033D_4 = \sqrt{(11-8)^2 + (12-9)^2 + (140-170)^2} = 30.033         5. D5=(7−8)2+(6−9)2+(250−170)2=80.111D_5 = \sqrt{(7-8)^2 + (6-9)^2 + (250-170)^2} = 80.111         6. D6=(10−8)2+(11−9)2+(220−170)2=50.080D_6 = \sqrt{(10-8)^2 + (11-9)^2 + (220-170)^2} = 50.080     * Top 3 Neighbors: Mango (10.000), Apple (30.033), Mango (30.033).     * Result: Mango wins the vote.

Classification: Decision Trees

  • Structure:     * Root Node: The top-most decision point representing the entire dataset.     * Splitting: Dividing a node into sub-nodes.     * Decision Node: A node that splits into further branches.     * Terminal/Leaf Node: A final node that provides the classification and does not split further.     * Branches: Connecting lines between nodes.     * Parent/Child Node: The node that is divided is the parent; resulting nodes are children.

  • Pruning:     * The process of removing parts of the tree that provide little power to classify instances, reducing complexity and preventing overfitting.     * Example: Replacing a complex rule like "Attendance between 72-73 and Marks 48-49 means Fail" with a simpler rule "Marks \geq 50 means Pass, else Fail."

  • Outliers: Data points that differ significantly from other observations, which may be caused by measurement errors or extreme variability.

Clustering Techniques: K-Means

  • Definition: A partitioning-based clustering algorithm that groups data points into K disjoint clusters based on distance to a centroid.

  • Objective Function (WCSS):     * WCSS=∑i=1K∑x∈Ci∥x−μi∥2WCSS = \sum_{i=1}^K \sum_{x \in C_i} \lVert x - \mu_i \rVert^2

  • Steps of K-Means:     1. Choose the number of clusters (K).     2. Initialize K centroids randomly.     3. Assign each data point to the nearest centroid.     4. Recalculate centroids as the average of points in each cluster.     5. Repeat until convergence (centroids no longer change).

Clustering Techniques: DBSCAN

  • Full Name: Density-Based Spatial Clustering of Applications with Noise.

  • Parameters:     * Epsilon (\epsilon): The maximum distance between two points to be considered neighbors.     * MinPts: The minimum number of points required within Epsilon to form a dense region.

  • Types of Points:     * Core Point: Has at least MinPts in its neighborhood.     * Border Point: Has fewer than MinPts in its neighborhood but is within Epsilon of a Core point.     * Noise (Outlier): Neither a Core nor a Border point.

Naive Bayes Classification

  • Definition: A supervised learning technique based on Bayes' Theorem, assuming that features are independent of each other (the "naive" assumption).

  • Bayes' Theorem Formula:     * P(Y∣X)=P(X∣Y)⋅P(Y)P(X)P(Y|X) = \frac{P(X|Y) \cdot P(Y)}{P(X)}

  • Laplace Correction: Added when a probability for a specific feature is zero to avoid the entire product becoming zero.

  • Naive Bayes Numerical Example: Classify Student (Math Marks)     * Dataset counts: Pass = 5, Fail = 3. Total = 8.     * Prior Probabilities: P(Pass)=5/8=0.625P(\text{Pass}) = 5/8 = 0.625; P(Fail)=3/8=0.375P(\text{Fail}) = 3/8 = 0.375.     * Conditional Probabilities for query "Math > 40":         * P(Math>40∣Pass)=4/5=0.8P(\text{Math}>40 | \text{Pass}) = 4/5 = 0.8         * P(Math>40∣Fail)=1/3=0.33P(\text{Math}>40 | \text{Fail}) = 1/3 = 0.33     * Posterior (Numerator only):         * P(Pass∣Math>40)∝0.8×0.625=0.5P(\text{Pass} | \text{Math}>40) \propto 0.8 \times 0.625 = 0.5         * P(Fail∣Math>40)∝0.33×0.375=0.125P(\text{Fail} | \text{Math}>40) \propto 0.33 \times 0.375 = 0.125     * Result: Pass has higher probability.

Neural Networks: Mechanisms

  • Forward Propagation: Calculation and storage of intermediate variables for a neural network, from input to output.
  • Weights: Determine the significance or strength of a signal between neurons. Output calculation: ∑(wixi)\sum (w_i x_i).
  • Bias: An additional constant added to the sum of products to shift the activation function. Formula: Sum=∑(wixi)+b\text{Sum} = \sum (w_i x_i) + b.
  • Activation Function: Decides whether a neuron should be activated (thresholding). Examples include Sigmoid, Tanh, and ReLU.
  • Backward Propagation: Calculates the gradient of a loss function with respect to the weights by moving backward through the network from output to input.
  • Gradient Descent: An optimization algorithm used to minimize the loss function by iteratively moving in the direction of steepest descent.
  • Epoch: One complete pass through the entire training dataset.

Support Vector Machine (SVM)

  • Core Concepts:     1. Hyperplane: A decision boundary that separates different classes in a multi-dimensional space.     2. Support Vectors: The data points closest to the hyperplane that influence its position.     3. Margin: The distance between the hyperplane and the nearest support vectors. SVM aims to maximize this margin.

  • Kernel Trick: A method to transform non-linear data into a higher-dimensional space where a linear hyperplane can separate the classes (e.g., using Polynomial or Radial Basis Function kernels).