AI Chapter 2 Unit 1 and 2 Summary PDF
Document Details
Tags
Summary
This document summarizes key mathematical concepts relevant to AI and machine learning, including algebra, sequences, functions, and logarithmic functions. It explains how these concepts are used in AI to model data and make predictions.
Full Transcript
Samsung Innovation Campus Summary Chapter 2 Unit 1 and 2 Basic Mathematical Concepts Algebra: Algebra is about working with numbers and unknowns, known as variables. In AI, algebra helps model relationships between inputs (like features in...
Samsung Innovation Campus Summary Chapter 2 Unit 1 and 2 Basic Mathematical Concepts Algebra: Algebra is about working with numbers and unknowns, known as variables. In AI, algebra helps model relationships between inputs (like features in a dataset) and outputs (like predictions). For example, in a simple equation like y=mx+b, x could be an input feature, and y could be the predicted output. Algebra helps to manipulate these relationships to build models. Basic Mathematical Concepts Sequences: A sequence is just a list of numbers that follow a pattern, like 2,4,6,8,…. Sequences are used in AI for various tasks, including calculating sums of patterns (like a series of data points) or predicting future values. Basic Mathematical Concepts Absolute Value: Absolute value is the distance of a number from zero. Euclidean distance is like a ruler measuring the straight-line distance between two points. In machine learning, it’s used to measure how 'close' one data point is to another, such as finding the nearest neighbors in k-NN algorithms. Sets A set is just a collection of items or numbers. For example, the set {1,2,3} contains the numbers 1, 2, and 3. In AI, sets are used to group similar data together. Operations on sets, like union (combining sets) or intersection (finding common elements), help with sorting and organizing data, a key task in machine learning. Concept of Functions A function is like a machine: you put something in (input), and it gives you something out (output). For example, f(x)=x+2 means if you put in 3 for x, you get f(3)=5. In AI, functions map inputs to outputs. Composite Functions: Sometimes, functions are combined to handle complex problems. Inverse Functions: Inverse functions 'reverse' a process. This concept is important in AI for tasks like encryption and decryption. Exponential & Logarithmic Functions Logarithmic Functions: Exponential Functions: Logarithms are the Exponentials describe reverse of exponentials. rapid growth or decay. For They help simplify example, in machine complex calculations, learning, an exponential often used in algorithms function might represent that optimize models by how fast a model learns. reducing complexity. Natural Logarithms & Euler’s Constant (e) The natural logarithm uses Euler’s constant (e ≈ 2.718) and is common in models that deal with continuous growth, like population models. In machine learning, this concept is used in certain loss functions that measure model errors. Sigmoid Functions A sigmoid function takes any number and 'squashes' it into a range between 0 and 1. It’s used in neural networks to help models decide between two possibilities, like yes/no or true/false. It’s particularly useful in binary classification problems. Trigonometric Functions Trigonometric Functions: Trigonometry deals with angles and cycles (like the patterns of a sine wave). In AI, trigonometric functions are used to model cyclic patterns, such as in time- series analysis where the data repeats in a predictable way. Some Math Concepts Sigma Sum (Σ) and Summation Notation The Greek letter Σ (sigma) stands for "sum" and is used to add up a sequence of numbers. Think of Σ like a way to say, "add all the numbers in this group together“. Some Math Concepts Sigma Let’s look at the following: This means "add up all the 𝑥i values from 𝑖 = 1 to 𝑖 = 𝑛.“ 𝑖 is the index, starting at 1 and going up to 𝑛 𝑥i represents the numbers you're adding. 𝑛 is the total number of values. Some Math Concepts Sigma Consider the following code: Some Math Concepts Sigma If we write the code as a summation: X is each day's sales value. 𝑛 would be 7 (since there are 7 days). i The summation symbol "Σ" corresponds to the sum() function in Python. It would give the total sum of sales from day 1 to day 7, i.e. 2150. AI/ML use: You’ll often see this when calculating things like total errors in predictions or when summing the outputs of a neural network’s neurons. Some Math Concepts Linear Regression Formula A common formula in machine learning is for predicting a value based on some input features. The linear regression formula is: 𝑦 = 𝑤1𝑥1 + 𝑤2𝑥2 +... + 𝑤𝑛 𝑥 𝑛 + 𝑏 Where: 𝑦: The value you are trying to predict (output). 𝑥1,𝑥2,...𝑥𝑛 : Input features (the data you feed into the model). 𝑤1,𝑤2,...𝑤𝑛: Weights (the importance given to each input feature). 𝑏: Bias (a constant value that shifts the result up or down). Some Math Concepts Linear Regression Formula Imagine you're predicting house prices. The input features could be the size of the house, the number of bedrooms, etc. Each feature has a weight representing its importance, and the bias helps adjust the result to make it more accurate. AI/ML use: Linear regression is a simple machine learning model used to predict continuous values (like prices). Some Math Concepts Cost Function The cost function helps us measure how "off" our model’s predictions are from the actual values. The formula for Mean Squared Error (MSE) is: Some Math Concepts Cost Function Where: 𝐽(𝑤): The cost (how wrong the model is). 𝑚: The number of training examples. ℎ(𝑥𝑖): The predicted value for example 𝑖 (using 𝑦𝑖: The actual value for example 𝑖. your model). (ℎ(𝑥𝑖)−𝑦𝑖)2: The difference between the predicted and actual value, squared to ensure it's positive. Some Math Concepts Cost Function Think of this like finding the average of how far off your predictions are from the actual values. Squaring makes sure all errors are positive and emphasizes bigger mistakes. AI/ML use: The model adjusts itself to minimize this error during training, improving accuracy. Some Math Concepts Partial Derivatives Partial derivatives are used in optimization, helping us figure out how changing one variable in a function affects the result. For example, in gradient descent (a method used to minimize the cost function): This tells us how much the cost function 𝐽(𝑤) changes when we slightly adjust weight 𝑤𝑖. Imagine trying to find the lowest point in a valley. The gradient tells you which direction to walk to go downhill the fastest. The partial derivative shows how steep the slope is in one direction (e.g., if you take a step in the "weight" direction, how much does the error decrease?). AI/ML use: Gradient descent uses these derivatives to "tweak" the weights and bias, making the model more accurate over time. Some Math Concepts Math in Logistic Function (Sigmoid Function) Used in binary classification problems (e.g., determining if an email is spam or not). The logistic function looks like this: Where: 𝑧: The input (a weighted sum of features, for example). 𝑒: The mathematical constant (Euler’s number). Think of the sigmoid function as a way to "squash" any input to be between 0 and 1. If the result is closer to 1, it means it’s likely in one class (e.g., spam); if closer to 0, it’s in the other class (e.g., not spam). AI/ML use: The sigmoid function is used to make decisions in classification tasks by producing probabilities (between 0 and 1). Some Math Concepts Gradient Descent This is the process of adjusting weights and bias to minimize the error in predictions. The formula for updating weights is: Where: : The weight we are updating. α: The learning rate (how big the steps we take are). : The partial derivative (telling us how much to adjust the weight). Imagine you’re trying to walk downhill (minimize the error). You look at the slope (partial derivative) and take a step in that direction. The learning rate controls how big that step is. AI/ML use: Gradient descent is how models learn, improving their accuracy by adjusting weights to reduce error. Some Math Concepts Linear Function A linear function’s common format looks something like this: f(x) = mx + b changes in 𝑥 lead to proportional changes in 𝑓(𝑥). A linear function is the simplest type of function where Some Math Concepts Linear Function Think of it as walking at a constant speed. then after 𝑥 seconds, you will have walked 𝑓(𝑥)=𝑚𝑥+𝑏 meters. If you take one step every second, and each step is 1 meter, In the equation: 𝑚: The "slope" or rate of change. If you’re walking faster, 𝑚 increases. 𝑥: How far along you’ve gone (e.g., time in seconds). 𝑏: The starting point. If you started 5 meters ahead of the starting line, 𝑏=5 In AI/ML: Linear functions are used to model relationships where a change in one variable leads to a proportional change in another, like predicting house prices based on size. Some Math Concepts Quadratic Function The quadratic function can look something like this: f(x) = ax 2 + bx + c A quadratic function creates a curve (like a parabola) instead of a straight line. Imagine you are throwing a ball into the air. Its height depends on how fast you throw it (the initial speed) and how gravity pulls it down. In this equation: 𝑎: Controls how steep the curve is (how fast the ball goes up and down). 𝑏: Affects the direction of the curve. 𝑐: The starting height of the ball when you throw it. In AI/ML: Quadratic functions are useful when there is curvature in the data. where increases in 𝑥 first lead to larger For example, it can help model problems increases in 𝑓(𝑥) and then decreases (like diminishing returns on investment). Some Math Concepts Softmax Function The softmax function typically looks like this: The softmax function is like a probability calculator. Imagine you're choosing between several options (like picking a team to win a game). The softmax function tells you the likelihood of each team winning based on their strengths. In this equation: 𝑧𝑖: Represents the "score" for option 𝑖. The denominator ∑𝑗𝑒𝑧 ensures that all the probabilities sum up to 1. In AI/ML: Softmax is used in multi-class classification problems. For example, it can predict which category an image belongs to (e.g., a dog, cat, or bird) by assigning a probability to each option. Some Math A logarithmic function looks like this: Concepts f(x) = log(x) and slower as 𝑥 increases. A logarithmic function grows slower Logarithmic Imagine if you’re saving money in a bank that offers decreasing interest Function rates each year. The first year you might get 10%, but over time the interest rate decreases, so your money grows slower. In AI/ML: Logarithmic functions are useful in applications like data scaling (transforming large numbers into a more manageable range) or understanding diminishing returns in models. Some Math Concepts Sum of Geometric Sequence Sum of Geometric Sequence equation: This is the formula for adding up the terms in a geometric sequence. Imagine you’re getting a salary raise every year, where your salary increases by a fixed percentage. The formula helps you calculate how much total money you’ll have earned after a certain number of years. In this equation: 𝑆𝑛 : Total sum after 𝑛 terms (e.g., total salary earned after 𝑛 𝑎: The first term (e.g., starting salary). years). 𝑟: The common ratio (e.g., percentage increase each year). 𝑛: The number of terms (e.g., number of years). In AI/ML: Geometric sequences can model processes that grow by a fixed factor over time, like interest accumulation or population growth. Some Math Concepts Euclidean Distance Euclidean Distance equation: Euclidean distance is like finding the straight- line distance between two points on a map. Imagine you’re trying to figure out how far two cities are from each other by looking at their coordinates on a map. 𝑝 and 𝑞: Represent two points (e.g., In this equation: the coordinates of two cities). The sum measures how far apart the points are in each direction (like east-west and north-south). In AI/ML: This concept is used in algorithms like k-nearest neighbors (KNN), where you want to find how "close" two data points are to each other, such as in recommendation systems. Some Math Concepts Probability (P(A)) Probability tells us how likely something is to happen. For example, if you’re flipping a coin, the probability of getting heads is 1 out of 2 (50%). In this equation: 𝑃(𝐴): Probability of event 𝐴 happening. Number of favorable outcomes: How many times the event you care about can happen. Total number of outcomes: How many total possibilities there are. In AI/ML: Probability is crucial for understanding uncertainty in predictions. For example, it helps algorithms like Naive Bayes classify data by considering the likelihood of each class. Summary of Math in AI/ML Linear Regression: Uses algebra to predict continuous values based on input data. Decision Trees: Use sets to split data into different groups or categories. Neural Networks: Use functions, particularly activation functions like the sigmoid function, to make decisions. Clustering Algorithms: Use Euclidean distance to group similar data points. Optimization Techniques: Use logarithmic and exponential functions to fine-tune models, helping them learn and improve over time.