0% found this document useful (0 votes)
11 views4 pages

AI Midterm Review

The document outlines the details for a revised midterm exam scheduled for February 27, 2025, including its structure of short Q&A, multiple choice questions, and a coding exercise. It provides preparation material covering key concepts in Artificial Intelligence, Supervised Learning, Gradient Descent, and Polynomial Regression. Additionally, it includes a coding task to implement Gradient Descent for linear regression in Python.

Uploaded by

Tommy smith
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

AI Midterm Review

The document outlines the details for a revised midterm exam scheduled for February 27, 2025, including its structure of short Q&A, multiple choice questions, and a coding exercise. It provides preparation material covering key concepts in Artificial Intelligence, Supervised Learning, Gradient Descent, and Polynomial Regression. Additionally, it includes a coding task to implement Gradient Descent for linear regression in Python.

Uploaded by

Tommy smith
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Revised Midterm Exam Preparation

Basic Information

• Date: February 27, 2025


• Duration: 60 minutes
• Location: AUPP Campus, Classroom D8

Exam Structure

• 5 short Q&A
• 5 multiple choice questions
• 1 coding exercise

Short Q&A Preparation (5 Questions)

1. What is Artificial Intelligence (AI)? A: AI refers to the simulation of human intelligence in


machines that can perform tasks like problem-solving, learning, and decision-making.

2. What is Supervised Learning? A: Supervised Learning is a type of machine learning that


uses labeled data to train a model to make predictions or classifications.

3. What is a cost function in machine learning? A: The cost function measures the difference
between predicted values and actual values, helping optimize the model by adjusting parameters
to minimize error.

4. What is Polynomial Regression? A: Polynomial Regression is a type of regression where the


relationship between the input variables and output is modeled as an nth-degree polynomial.

5. What are the types of Gradient Descent? A:

• Batch Gradient Descent: Uses the entire dataset to compute the gradient.
• Stochastic Gradient Descent (SGD): Updates parameters using a single randomly
chosen example.
• Mini-Batch Gradient Descent: Updates parameters using small batches of data.

Multiple Choice Questions (5 Questions)

1. Which of the following is a type of Supervised Learning?

• A) Clustering
• B) Reinforcement Learning
• C) Regression
• D) Anomaly Detection
Answer: C) Regression

2. What is the primary goal of Gradient Descent?

• A) Maximize the cost function


• B) Minimize the loss function
• C) Increase model complexity
• D) Improve training time
Answer: B) Minimize the loss function

3. In Linear Regression, the relationship between the variables is modeled by which


equation?

• A) 𝑦𝑦 = 𝑎𝑎𝑥𝑥 2 + 𝑏𝑏𝑏𝑏 + 𝑐𝑐
• B) 𝑦𝑦 = 𝑤𝑤𝑤𝑤 + 𝜖𝜖
• C) 𝑦𝑦 = 𝑎𝑎𝑥𝑥 3 + 𝑏𝑏𝑥𝑥 2 + 𝑐𝑐𝑐𝑐 + 𝑑𝑑
• D) 𝑦𝑦 = 𝑒𝑒 𝑏𝑏𝑏𝑏
Answer: B) 𝒚𝒚 = 𝒘𝒘𝒘𝒘 + 𝝐𝝐

4. What is the time complexity of the Normal Equation for Linear Regression?

• A) O(n)
• B) O(n^2)
• C) O(n^3)
• D) O(log n)
Answer: C) O(n^3)

5. Which of the following is NOT a type of polynomial?

• A) Linear
• B) Quadratic
• C) Exponential
• D) Cubic
Answer: C) Exponential

Coding Exercise

Write a Python function to implement Gradient Descent for a simple linear regression problem.
The function should update the weights until the cost function is minimized.

import numpy as np

def gradient_descent(X, y, learning_rate=0.01, iterations=1000):


m, n = X.shape
weights = np.zeros(n)
for i in range(iterations):
predictions = X.dot(weights)
errors = predictions - y
gradients = X.T.dot(errors) / m
weights -= learning_rate * gradients
return weights

This function uses Gradient Descent to update the weights for a given input matrix XX and
output vector yy, iterating to minimize the cost function.

Details

Q: What is Artificial Intelligence? A: Artificial Intelligence refers to the development of


computer systems that can perform tasks typically requiring human intelligence, such as
learning, problem-solving, and decision-making.

Q: What are the types of Machine Learning? A: The main types of Machine Learning are
Supervised Learning, Unsupervised Learning, and Reinforcement Learning.

Q: What is Supervised Learning? A: Supervised Learning is a type of machine learning where


a model is trained using labeled data to predict outcomes.

Q: What is a cost function in Linear Regression? A: The cost function measures the error
between the predicted values and actual values. It helps optimize the model by adjusting the
parameters to minimize this error.

Q: What are the types of polynomials in Polynomial Regression? A:

• Linear Polynomial: 𝑎𝑎𝑎𝑎 + 𝑏𝑏 = 0


• Quadratic Polynomial: 𝑎𝑎𝑥𝑥 2 + 𝑏𝑏𝑏𝑏 + 𝑐𝑐 = 0
• Cubic Polynomial: 𝑎𝑎𝑥𝑥 3 + 𝑏𝑏𝑥𝑥 2 + 𝑏𝑏𝑏𝑏 + 𝑐𝑐 = 0
• Q: What is Gradient Descent? A: Gradient Descent is an iterative optimization
technique used to minimize the loss function by adjusting the model’s parameters.

Q: What are the types of Gradient Descent? A:

• Batch Gradient Descent: Uses the entire dataset to compute the gradient.
• Stochastic Gradient Descent (SGD): Updates parameters using one random training
example.
• Mini-Batch Gradient Descent: Uses a small batch of training examples for updates.
Q: What are the advantages and disadvantages of the Normal Equation in Gradient
Descent? A:

• Advantages: Direct computation of the exact solution.


• Disadvantages: Computationally expensive and memory-intensive for large datasets.

You might also like