Machine Learning: Supervised and Unsupervised Learning

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which of the following algorithms fall under the category of supervised learning?

  • Hierarchical Clustering
  • Density-Based Clustering
  • K-Means
  • Decision Tree (correct)

In binary classification, an instance can only be classified into one of two classes.

True (A)

What type of data structures are commonly used to represent structured data in machine learning?

Relational databases

The process of breaking down text into individual words or terms for analysis is known as _________.

<p>tokenization</p> Signup and view all the answers

Match the operations on matrices with their descriptions:

<p>Matrix Addition = Adding corresponding elements of two matrices Matrix Multiplication = Combining matrices based on the dot product of rows and columns</p> Signup and view all the answers

In instance-based learning, what is the primary factor used to classify new instances?

<p>Similarity to stored examples (B)</p> Signup and view all the answers

Euclidean distance is calculated by summing the absolute differences between points.

<p>False (B)</p> Signup and view all the answers

What type of distance is typically used with binary-valued features?

<p>Hamming</p> Signup and view all the answers

In K-NN, if we are performing regression, the prediction for a new point is typically the _________ of the K nearest neighbors' values.

<p>mean</p> Signup and view all the answers

Match the K-NN characteristic with the implication:

<p>Small K = Creates many small unstable regions Large K = Smooths decision boundaries, may underfit</p> Signup and view all the answers

Which of the following is a characteristic of unstructured data?

<p>High dimensionality (D)</p> Signup and view all the answers

Adding two matrices involves multiplying corresponding elements.

<p>False (B)</p> Signup and view all the answers

What is the algorithmic complexity of K-NN at test time, assuming N training points and D features?

<p>O(ND)</p> Signup and view all the answers

In semi-supervised learning, the algorithm learns from both labeled and _________ data.

<p>unlabeled</p> Signup and view all the answers

Match the term with its definition in K-NN:

<p>Parameter K = Number of nearest neighbors considered Majority Rule = Assigning class label based on most frequent class among neighbors</p> Signup and view all the answers

Which characteristic makes K-NN a non-parametric method?

<p>It does not learn an explicit mapping from the training data. (C)</p> Signup and view all the answers

Multiplying a matrix by a vector is always defined, regardless of their dimensions.

<p>False (B)</p> Signup and view all the answers

What characteristic of a dataset can make K-NN challenging to use effectively?

<p>Noisy features</p> Signup and view all the answers

The first step in the KNN algorithm, after initializing K, is to calculate the _________ between the query example and the current example from the data.

<p>distance</p> Signup and view all the answers

Match the Machine Learning method with their use case:

<p>Supervised Learning = Predicting housing prices based on features like size and location. Unsupervised Learning = Clustering customers based on purchasing behavior to identify market segments.</p> Signup and view all the answers

How does increasing the value of K generally affect the decision boundaries in K-NN?

<p>Makes them smoother (D)</p> Signup and view all the answers

Text categorization involves manually assigning categories to documents.

<p>False (B)</p> Signup and view all the answers

Name one type of clustering algorithm.

<p>K-Means</p> Signup and view all the answers

In K-NN, the choice of K is often _________ dependent and heuristic based.

<p>data</p> Signup and view all the answers

Match the distance metric with its use case:

<p>Euclidean Distance = Measuring straight-line distance in continuous space Manhattan Distance = Measuring distance along axes, useful for grid-like spaces</p> Signup and view all the answers

Which statement accurately describes the role of the 'Teacher' in supervised learning?

<p>It offers examples and desired labels. (C)</p> Signup and view all the answers

KNN works well even with a small dataset.

<p>False (B)</p> Signup and view all the answers

What is the effect of using a very large 'K' value in KNN?

<p>underfitting</p> Signup and view all the answers

Principal Component Analysis (PCA) is generally used with ______ learning.

<p>unsupervised</p> Signup and view all the answers

Match the following Matrix multiplication expression with its definition:

<p>$A(B + C) = AB + AC$ = Left distributive $(A + B)C = AC + BC$ = Right distributive</p> Signup and view all the answers

Which method can be used to choose K in K-NN more effectively?

<p>Cross-validation (A)</p> Signup and view all the answers

Supervised learning algorithms use unlabeled data.

<p>False (B)</p> Signup and view all the answers

In a classification by rule list, what is returned when no rule matches a value?

<p>unclassified</p> Signup and view all the answers

Hamming distance measures the similarity between two ______ sequences.

<p>binary</p> Signup and view all the answers

Match the Clustering with their subtypes:

<p>Binary clustering = clustering the whole set into two clusters Multiple clustering = clustering the whole set into multiple clusters</p> Signup and view all the answers

Which algorithm falls under instance-based learning?

<p>K-Nearest Neighbors (D)</p> Signup and view all the answers

Machine learning is a subset of data science.

<p>True (A)</p> Signup and view all the answers

In KNN, how does the algorithm predict new data?

<p>similarity</p> Signup and view all the answers

K-NN approaches the best possible classifier or ______ optimal.

<p>Bayes</p> Signup and view all the answers

Match the characteristics of the distance functions

<p>Euclidean = Square root of the sum of the squared distances between points Manhattan = Absolute sum of the differences between points</p> Signup and view all the answers

Flashcards

Machine Learning

A field of AI focused on enabling machines to learn from data.

Supervised Learning

A type of machine learning where an algorithm learns from labeled data.

Regression

Predicts a continuous output value based on input features.

Clustering

A method of splitting data points into subgroups based on their similarities without prior knowledge of the categories.

Signup and view all the flashcards

Structured Data

Data organized in rows and columns, easily searchable and sortable, typically found in relational databases.

Signup and view all the flashcards

Unstructured Data

Data without a predefined format, like text, images, and videos.

Signup and view all the flashcards

Tokenization

The process of breaking down text into individual words or tokens.

Signup and view all the flashcards

Look-up Table

A primitive instance-based learning method that leverages directly storing training examples

Signup and view all the flashcards

K-Nearest Neighbors (KNN)

A non-parametric, instance-based learning algorithm that classifies new data points based on the majority class among its k-nearest neighbors in the feature space.

Signup and view all the flashcards

Euclidean Distance

A measure of distance calculated as the square root of the sum of squared differences between points.

Signup and view all the flashcards

Manhattan Distance

Distance calculated as the sum of the absolute differences between points.

Signup and view all the flashcards

Hamming Distance

A distance metric suited for binary-valued features, counting the number of places the features disagree.

Signup and view all the flashcards

Classification

Assign the majority class label from the K most similar training examples.

Signup and view all the flashcards

Regression

Assign the average response from the K most similar training examples.

Signup and view all the flashcards

Study Notes

Machine Learning

  • Machine Learning sits within Artificial Intelligence
  • Supervised learning and unsupervised learning are types of machine learning
  • Deep learning is a type of machine learning, and uses neural networks

Foundation for Supervised and Unsupervised Machine Learning

  • Introduction
  • Numerical Vectors
  • Data Encoding
  • Simple Machine Learning algorithms

Supervised Machine Learning

  • Instance-Based Learning
  • Probabilistic Learning
  • Decision Tree
  • Support Vector Machine

Unsupervised Machine Learning

  • Simple Clustering Algorithms
  • K-Means Algorithm
  • EM Algorithm
  • Advanced Clustering

Advanced Topics

  • Ensemble Learning
  • Semi-Supervised Learning
  • Temporal Learning
  • Reinforcement Learning

Supervised Learning

  • An environment provides examples to a teacher
  • The teacher provides desired labels
  • The machine learning algorithm classifies labels and sends it for correction
  • Errors from the machine learning are used for future classifications

Classification

  • Logistic Regression
  • SVM
  • Neural Network
  • Decision Tree
  • Random Forest
  • GBDT
  • KNN
  • Naive Bayes

Regression

  • Linear Regression
  • SVM
  • Neural Network
  • Decision Tree
  • Random Forest
  • GBDT

Clustering

  • K-Means
  • Hierarchical Clustering
  • Density-Based Clustering

Other Machine Learning Methods

  • Correlation Rule
  • Principal Component Analysis (PCA)
  • Gaussian Mixture Model (GMM)

Binary Classification

  • Data is classified as positive or negative

Multiple Classification

  • Data is put into Class 1, Class 2, up to Class M

Decomposition Into Binary Classifications

  • Can be broken down into multiple classifications and decisions

How Unsupervised Learning Works

  • An environment gives examples to machine learning algortithm
  • The Machine learning algorithm then puts the data into clusters
  • A cluster prototype is then developed using similarity

Univariate Regression

  • An input vector goes into a regression model
  • The result is a continuous output value

Multivariate Regression

  • An input vector goes into a regression model
  • The result is multiple continuous output values, from 1 to M

Binary Clustering

  • Data is broken into two clusters

Multiple Clustering

  • Clusters have many different subsets

Data Structures

  • Data can be structured or unstructured

Structured Data

  • Organized in rows and columns
  • Usually from relational databases
  • The most common source of data

Unstructured Data

  • Examples: text, images, audio, video
  • Can be sourced from Facebook posts, tweets, complaints, reviews, photos, phone calls, blogs, etc.
  • In general, deep learning is used for unstructured data.

Text Categorization

  • Text categorization assigns a category, from a predefined list, to a document automatically
  • Text categorization is a pattern classification task for text mining
  • Text categorization is necessary for efficient management of textual information systems

Tokenization

  • Divides the assignment into a number of tokens

Primitive Instance Based Learning

  • Look-up table gives the Input Vectors the Labels, with + and -

Classification Rules

  • If A = v1, then C1
  • If A = v2, then C2
  • If A = vk, then Ck

Instance Based Learning

  • Classify by Rule List classifies the item example
  • It checks if the rule matches the value, and categorizes it, otherwise set to "unclassified"

Euclidean Distance

  • Calculated as the square root of the sum of the squared differences between a new point (x) and an existing point (y)
  • Formula: √Σ(xi − yi)^2

Manhattan Distance

  • Distance between real vectors using the sum of their absolute difference
  • Formula: Σ|xi − yi|

Binary-Valued Features

  • Uses Hamming distance defined as: d(xi, xj) = Σ Ⅱ(xim ≠ xjm)
  • Hamming distance counts the number of features where the two examples disagree

Machine Learning with Mixed Feature Types

  • Can use mixed distance measures

Machine Learning With Assigned Weights

  • Defined as: d(xi, xj) = Σ wmd(xim, xjm)

Similarity Computation

  • Formula: Euclidean Distance = √Σ(xi − yi)^2 where x = x₁,x₂....x(d) and y = Y₁,Y₂....y(d)
  • Formula: Cosine Similarity = 2Σ xi yi / ||x|| + ||y||

K-Nearest Neighbor (K-NN)

  • Given training data D = {(x1, y1),..., (xN, yN)} and a test point
  • Look at the K most similar training examples

KNN for Classification

  • Assigns the majority class label of K-Nearest

KNN for Regression

  • Assigns the average response of K-Nearest

KNN Algorithm Requirements

  • Requires Parameter K, the number of nearest neighbors to look for

Calculating the Test Point's Distance

  • Compute the test point's distance from each training point
  • Sort the distances in ascending (or descending) order
  • Use the sorted distances to select the K nearest neighbors
  • Use majority rule (for classification) or averaging (for regression)

K-Nearest Neighbors

  • K-Nearest Neighbors is a non-parametric method
  • K-Nearest Neighbors doesn't learn an explicit mapping from the training data
  • K-Nearest Neighbors simply uses the training data at the test time to make predictions

Small K

  • Creates many small regions for each class
  • Can lead to non-smooth decision boundaries and overfit

Large K

  • Creates fewer larger regions
  • Usually leads to smoother decision boundaries
  • Boundary can underfit

Choosing K

  • Often data-dependent and heuristic-based
  • Or using cross-validation (using some held-out data)
  • A K too small or too big is not ideal

K-Nearest Neighbor Advantages

  • Simple and intuitive, easily implementable
  • K-NN approaches the best possible classifier (Bayes optimal)

K-Nearest Neighbor Disadvantages

  • Needs to store all the training data in memory at test time
  • Can be memory intensive for large training datasets
  • An example of non-parametric, or memory/instance-based methods
  • Different from parametric, model-based learning models
  • Expensive at test time, O(ND) computations for each test point
  • Have to search through all training data to find nearest neighbors
  • Distance computations with N training points (D features each)
  • Sensitive to noisy features
  • May perform badly in high dimensions (curse of dimensionality)

The KNN Algorithm steps

  • Load the Data
  • Initialize K to your chosen number of neighbors
  • For each example in the data: Calculate the distance between the query example and the current example from the data
  • Add the distance and the index of the example to an ordered collection
  • Sort the ordered collection of distances and indices from smallest to largest (in ascending order) by the distances
  • Pick the first K entries from the sorted collection
  • Get the labels of the selected K entries
  • If there is Regression, Return the mean of the K labels
  • If there is classification, return the mode of the K labels

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Use Quizgecko on...
Browser
Browser