Theory Questions & Computational Exercises for Exam Preparation
Q1.1: What is the main goal of Artificial Intelligence?
Q1.2: Name 4 mathematical tools commonly used in AI.
Q1.3: What is the difference between supervised and unsupervised learning?
Q1.4: Explain the difference between classification and regression.
Q2.1: Describe the k-NN algorithm in 3 steps.
Q2.2: Write the formula for Euclidean distance between vectors x and y.
Q2.3: Why is k-NN called a "lazy learner"?
P2.1: Given vectors belonging to 2 classes:
P2.2: Calculate the Euclidean distance between v=(3,-1,2) and w=(1,2,0).
Q3.1: What is a perceptron? Describe its components.
Q3.2: Write the perceptron learning rule (delta rule) for weights and threshold.
Q3.3: What is the difference between unipolar and bipolar activation?
P3.1: Given: p=(1,-1,2), w=(2,1,-1), θ=1, α=1
a) Compute perceptron output (unipolar discrete)
b) If output is incorrect, compute new weights
c) Will threshold increase or decrease?
P3.2: Given: p=(2,0,-1), w=(-1,3,2), θ=-2. Compute the output for a unipolar discrete perceptron.
Q4.1: What are TP, TN, FP, FN in a confusion matrix?
Q4.2: Write formulas for Accuracy, Precision, Recall, and F-measure.
Q4.3: What does the F-measure represent and why is it useful?
P4.1: Given confusion matrix:
| Pred P | Pred N | |
|---|---|---|
| Actual P | 40 | 10 |
| Actual N | 20 | 30 |
Calculate: Accuracy, Precision, Recall, F-measure
P4.2: A classifier has: TP=15, TN=25, FP=5, FN=5. Calculate all metrics.
Q5.1: What problem can a multi-layer network solve that a single perceptron cannot?
Q5.2: What is the purpose of the backpropagation algorithm?
Q5.3: Why do we need non-linear activation functions in hidden layers?
Q6.1: What is overfitting? Give an example.
Q6.2: What is cross-validation and why do we use it?
Q6.3: What is the difference between a decision rule and a decision tree?
Q6.4: What is entropy and how is it used in decision trees?
Q7.1: Describe the k-Means algorithm in 4 steps.
Q7.2: How is the centroid of a cluster computed?
Q7.3: What is hierarchical clustering? Name its two types.
P7.1: Given vectors: a=(0,0), b=(1,0), c=(4,4), d=(5,4)
Initial centroids: c₁=(0,0), c₂=(4,4), k=2
Perform one iteration of k-Means.
P7.2: Given: a=(1,1), b=(2,1), c=(5,5). Initial centroids: c₁=(1,1), c₂=(2,1). Simulate k-Means until convergence.
Q8.1: What is the "naive" assumption in Naive Bayes?
Q8.2: Write Bayes' theorem in the context of classification.
Q8.3: What is Laplace smoothing and when do we use it?
P8.1: Given training data for playing tennis:
| Weather | Wind | Play? |
|---|---|---|
| Sunny | Weak | No |
| Sunny | Strong | No |
| Rainy | Weak | Yes |
| Rainy | Weak | Yes |
| Rainy | Strong | No |
| Sunny | Weak | Yes |
Classify: (Sunny, Strong)
Q9.1: Define the 0/1 Knapsack problem.
Q9.2: What is the greedy approach? When does it work optimally?
Q9.3: What is the difference between 0/1 and Fractional Knapsack?
P9.1: Knapsack: Capacity=7, Items:
| Item | Value | Weight |
|---|---|---|
| a | 4 | 3 |
| b | 3 | 2 |
| c | 2 | 1 |
| d | 5 | 4 |
Find the optimal solution.
P9.2: Capacity=6, values=(5,3,2,4), weights=(3,2,1,3). Find optimal value.
Q10.1: What is the hill climbing algorithm?
Q10.2: What is the main weakness of hill climbing? How does simulated annealing address it?
Q10.3: What is a "neighborhood" in local search? Give an example for TSP.
V1: Given v=(2,-1,3) and w=(1,2,-1). Calculate:
a) Dot product v·w
b) Are they orthogonal?
c) Length of v
d) Distance between v and w
V2: Which is longer: a=(1,2,2) or b=(2,1,1)?