Sets and Functions

Sets and Functions

Machine Learning Foundations: Week 2 Overview

Introduction to Basic Math Tools

  • The second week of the Machine Learning Foundations course focuses on essential mathematical tools, primarily calculus, which will be crucial for understanding later topics.
  • This week's content includes basic sets and functions, notations, logic statements, and methods for visualizing functions.

Key Sets in Mathematics

  • The primary sets introduced are:
  • R: Set of real numbers.
  • R+: Set of non-negative real numbers (including zero).
  • Z: Set of integers.
  • Z+: Set of positive integers (including zero).
  • Additional important sets include:
  • Closed Interval [a, b]: Real numbers between a and b, inclusive.
  • Open Interval (a, b): Real numbers between a and b, exclusive.

Cartesian Products and Dimensional Vectors

  • Cartesian products can be applied to these sets; for example:
  • Rd represents d-dimensional vectors formed by R cross itself d times.
  • An example element in R³ is represented as (1, 2, 3), indicating three-dimensional space.

Understanding Metric Spaces

  • A metric space consists of a set with an associated distance function.
  • The default metric space used is Rd with the Euclidean distance defined as:

[

d(x,y) = sqrt(x_1-y_1)^2 + ... + (x_d-y_d)^2

]

Open and Closed Balls in Metric Spaces

  • An open ball B(x, ε) is defined as the set of points y in Rd such that the distance from x is less than ε.
  • A closed ball B̅(x, ε) includes points where the distance from x is less than or equal to ε. The distinction lies in whether boundary points are included.

Recap on Sets and Logic

Understanding Set Operations and Logic

Set Differences and Complements

  • The concept of set difference is introduced, denoted by the backslash symbol. It represents elements in the universe that are not part of a specific set.
  • De Morgan's Laws are explained as two fundamental equations in logic:
  • The complement of the union of two sets equals the intersection of their complements.
  • The complement of the intersection equals the union of their complements.

Visualizing Set Operations with Venn Diagrams

  • A graphical representation helps illustrate that the complement of a union includes all elements outside both sets, represented as an unshaded region in a Venn diagram.
  • The second law states that the complement of an intersection excludes only those elements common to both sets.

Practical Example Using Intervals

  • An example uses closed intervals to define two sets, A (2, 5) and B (4, 7), within a universe defined as [0, 10].
  • Calculating A ∪ B results in [2, 7], while A ∩ B yields [4, 5]. This demonstrates how to apply De Morgan's laws practically.

Verification Through Complementation

  • The complement of A ∪ B is calculated as [0, 2] ∪ (7, 10), confirming it matches A' ∩ B'.
  • Similarly verifies that A' ∩ B' corresponds with the complement of A ∩ B through practical examples.

Introduction to Logic Modifiers

  • Four main types of logic modifiers are introduced:
  • Inverted 'A' for "for all"
  • Inverted 'E' for "there exists"
  • Arrow symbols indicating implication and equivalence between statements.

Exploring Sequences in Analysis

Definition and Examples

  • Sequences are defined as ordered collections where each element lies within R². An example sequence is given with specific formulas for its elements.

Behavior and Convergence

  • As n increases in one sequence example (1 + (4/2^n), 3 - (4/2^n)), it approaches a limit point at (1,3).

Periodicity in Sequences

  • Another sequence involving cosine and sine functions illustrates periodic behavior without convergence towards any single point.

Understanding Convergence and Vector Spaces

Definition of Convergence

  • The concept of convergence is introduced, defining a sequence where as n increases, the values do not remain constant but approach a limit.
  • A sequence x_i in d -dimensional vectors converges to x^* if for every epsilon > 0 , there exists an integer N such that all terms after this point are within an epsilon-ball centered at x^* .
  • This definition implies that no matter how small the radius (epsilon), there exists a point beyond which the sequence remains inside this ball around the limit.

Examples of Convergent and Non-Convergent Sequences

  • An example illustrates that for any chosen epsilon, eventually all terms of a converging sequence will stay within the defined radius around its limit.
  • The first sequence converges to the point (1, 3), while another example shows a non-convergent sequence that fails to remain within any epsilon-ball after some point.
  • Different notations for limits are discussed: "limit as i to infty x_i = x^* " and "as x_i to x^* ", emphasizing their equivalence.

Exercises on Sequence Convergence

  • Three exercises are proposed regarding sequences:
  • The first is simply defined as x_n = 1 + n; questioning its convergence.
  • The second involves two-dimensional vectors with components involving cosine and sine functions scaled by decreasing factors; assessing its convergence behavior.
  • The third presents another variation with different sine components, prompting analysis on whether these sequences converge or not.

Introduction to Vector Spaces

  • Transitioning from sequences, vector spaces are introduced as collections of vectors satisfying specific properties.
  • A crucial property of vector spaces is highlighted: any linear combination of elements must also belong to the space. For instance, if elements u, vin V, then combinations like alpha u + beta vin V.

Properties of Vector Spaces

  • While other properties exist for vector spaces, maintaining closure under linear combinations is emphasized as fundamental.

Understanding Vector Spaces and Functions

Dot Product and Norm in Vector Spaces

  • A vector space can be associated with a dot product or inner product, defined for vectors x and y as x cdot y = x^T y = sum_i=1^d x_i y_i .
  • The squared norm of a vector is given by ||x||^2 = x cdot x = x^T x = sum_i=1^d x_i^2 . This highlights the importance of both the dot product and norm in vector spaces.

Orthogonality in Vector Spaces

  • Two vectors x and y are considered orthogonal if their dot product equals zero: x cdot y = 0. This concept is crucial for understanding relationships between vectors.

Introduction to Functions

  • A function is defined as a mapping from one set (domain) to another (co-domain), where real-valued functions have a co-domain of real numbers ( R ).
  • One-dimensional functions map from R^1 to R^1, while multi-dimensional functions extend this concept to mappings like f: R^d to R.

Graphing Functions

  • The graph of a function, denoted as G_f, is a subset of R^d+1, representing all pairs of inputs and outputs. For example, it includes points like (x, f(x)).

Visualizing One-Dimensional Functions

  • One-dimensional functions can be easily visualized using plots on two axes, where the X-axis represents input values and the Y-axis represents output values.
  • An example function could be f(x)=x^2, which produces a parabolic curve when plotted. The graph corresponds to points in the subset of R^2.

Challenges with Two-Dimensional Functions

  • Visualizing two-dimensional functions ( f: R^2 to R) becomes complex since they require three dimensions for representation. Standard paper or screens cannot accommodate this directly.

Contour Plots for Visualization

  • To visualize two-dimensional functions effectively, contour plots are used. These represent levels of constant output values across different input combinations.
  • For instance, consider the function defined by f(x_1,x_2)=x_1+x_2. By setting specific output values (e.g., -1, 0, 1), we can derive curves that represent solutions satisfying these equations.

Example Contour Analysis

  • When analyzing contours such as when setting f(x)= -1, we find that it leads to linear equations like x_1 + x_2 = -1. Plotting these gives us specific curves on our contour plot.

Understanding Contour and Heat Maps in 2D Functions

Introduction to Contours

  • The concept of contours is introduced, explaining that these lines represent constant values within a function. More values can be added to create additional contours.

Relation to Geography

  • The speaker draws parallels between contour plots and geographical concepts such as isotherms (lines of constant temperature) and iso bars (lines of constant pressure), highlighting their commonality in representing data visually.

Visualization of 2D Functions

  • A specific example is provided with the function f(x) = x_1 times x_2 . The contour plot illustrates where this function equals zero, indicating points where either x_1 or x_2 is zero.

Adding Complexity to Contours

  • Different values for the function can yield various contours. For instance, setting f(x) = 10 results in multiple valid combinations that form its contour.

Enhancing Contour Plots with Color

  • While color isn't necessary for contour plots, it enhances visualization. In the example given, yellow indicates high values while purple represents low values across the contours.

Increasing Detail in Contour Representation

  • The number of contours can be increased significantly; more detailed representations fill entire regions. This leads to a distinction between simple contour maps and more complex heat maps.

Comparison Between Heat Maps and Contour Maps

  • Heat maps provide more information than contour maps but may obscure geometric shapes. The speaker notes that while heat maps contain infinite contours, they can make it harder to discern the shape of those contours compared to traditional contour maps.

Example Function Visualization

Video description

Sets, Sequences, Vector Spaces, Functions and graphs, Contour plots IIT Madras welcomes you to the world’s first BSc Degree program in Programming and Data Science. This program was designed for students and working professionals from various educational backgrounds and different age groups to give them an opportunity to study from IIT Madras without having to write the JEE. Through our online programs, we help our learners to get access to a world-class curriculum in Data Science and Programming. To know more about our Programs, please visit : BSc Degree in Programming and Data Science - https://onlinedegree.iitm.ac.in/ Diploma in Programming / Data Science - https://diploma.iitm.ac.in/