WorksheetsPage 1
Total questions: 125
Worksheet time: 1hrs 3mins
In ML, which of the following best defines a “hypothesis”?
A ground truth
A learned mapping
Input features
Label distribution
What is the best k value to start with in practice for a balanced dataset?
n
log(n)
2n
Fixed at 5
df = pd.DataFrame({'a':[1,2], 'b':[3,4]}); df['c']=df['a']+df['b']; What is df['c'][0]?
3
4
5
6
Mistake Bound Model is used to:
Measure error
Count support vectors
Bound incorrect outputs
Predict probabilities
A feature divides a dataset into subsets with entropies 0.4 and 0.6. If the subsets have equal size, what is the information gain?
0.5
0.6
0.4
1
Which optimizer adapts learning rate per parameter?
Adam
SGD
Momentum
Adagrad
What is the hypothesis space?
Set of outputs
Set of all features
Set of possible functions
Set of input samples
A case base adds 25 new cases per month. How many new cases are added in 5 months?
50
100
125
150
Infinite hypothesis space implies:
Fixed solutions
Random guessing
Larger model capacity
Poor accuracy
Gibbs algorithm chooses h with posterior = 0.4. What is chance of incorrect prediction if its error is 0.2?
0.2
0.6
0.4
0.8
What is the typical loss function in backpropagation?
Precision
Cross-entropy
Mutation loss
Gradient ratio
Which of the following is NOT a component of a learning problem?
Hypothesis space
Target function
Output label
Hyperparameter tuning
A learning problem with multiple possible outputs is referred to as:
Regression
Clustering
Classification
Multi-class classification
Which function gives the first 5 rows of a DataFrame?
df.head()
df.tail()
df.sample()
df.describe()
What is the goal of the EM algorithm?
Maximize likelihood
Minimize bias
Compute gradient
Reduce variance
Given weights [0.2, 0.3] and input [1, 1], bias = -0.6. Will perceptron fire?
Yes
No
Can’t say
Maybe
What is the basic unit of a neural network?
Neuron
Pixel
Weight
Classifier
Why do deeper neural networks require more data?
Faster convergence
Higher parameters
Prevent overfitting
Better scaling
A dataset with 100 samples is split into two sets: 40 and 60 samples, with entropies 0.8 and 0.5 respectively. Find weighted average entropy.
0.62
0.64
0.68
0.7
Case-based learning is similar to:
Genetic programming
Memory-based reasoning
Clustering
Neural Networks
What does inductive bias help with in machine learning?
Increase data size
Improve accuracy
Guide hypothesis selection
Add noise to data
What type of join keeps only common rows between two DataFrames?
Inner
Outer
Left
Right
What does np.std(np.array([1,2,3,4])) compute?
Standard deviation
Variance
Mean
Mode
Which parameter in concat() can ignore duplicate indices?
ignore_index=True
drop_index=True
axis=1
index=False
If hypothesis space H has 1,000 hypotheses, I^μ=0.05 , I^=0.05 , compute required sample size using PAC bound: (1/I^μ)∗(ln∣H∣+ln(1/I^) .
373
460
420
380
What is np.percentile([1,2,3,4,5], 50)?
3
2.5
4
5
In a belief network, what do edges represent?
Feature weights
Dependencies
Bias terms
Layers
Which learning scenario best applies to concept learning?
Supervised
Unsupervised
Reinforcement
Self-supervised
You want to append data to a CSV file. What mode do you use in open()?
'a'
'w'
'x'
'r'
If two points are equidistant from a test point, how are their weights treated in Gaussian kernel LWR?
Differently
Equally
Zero
Inversely
What will df.set_index('id') do?
Set 'id' column as index
Drop index
Remove 'id'
Create multi-index
A model consistently prefers linear boundaries even for non-linear problems. What is the result of this bias?
Faster learning
Underfitting
Overfitting
Perfect generalization
Which distance metric is commonly used in KNN?
Manhattan
Hamming
Euclidean
Cosine
Genetic programming differs from GA in:
No selection
Representation type
Uses weights
No fitness function
What causes overfitting in decision trees?
Too few nodes
Too few samples
Too many branches
Low variance
The output layer of an RBF network is usually:
Sigmoid
Decision tree
Linear
Tanh
The Find-S algorithm always converges to:
Most general hypothesis
A random hypothesis
Most specific consistent hypothesis
All consistent hypotheses
What is the result of np.sqrt(np.array([4, 9, 16]))?
[2. 3. 4.]
[4 9 16]
[1.4, 3.0, 4.0]
[2,3,5]
In 2D space, an RBF neuron with center (2, 2) and input (4, 5) gives Euclidean distance of:
3
13
17
5
What is vanishing gradient problem commonly associated with?
Sigmoid activation
ReLU activation
Large batch size
Weight initialization
Which step in EM is responsible for assigning probabilities to latent variables?
E-step
M-step
Initialization
Inference
In concept learning, examples are typically labeled as:
Numerical
Categorical
Positive/Negative
Null values
Which method returns the standard deviation of a NumPy array?
array.std()
array.mean()
np.sqrt()
array.sum()
Which method can reset DataFrame index?
reset_index()
reindex()
drop_index()
set_index()
What does the Candidate Elimination algorithm eliminate?
Incorrect data
Inconsistent hypotheses
Labels
Bias
If Gain(S, A) = 0.1 and Gain(S, B) = 0.3, which feature is chosen for the root of the decision tree?
A
B
None
Both equally
During retrieval, which of the following is used?
Weight matrix
Euclidean similarity
Similarity measure
Decision rules
In a noisy learning scenario, 20% of 1000 samples are mislabeled. How many are correctly labelled?
800
200
700
900
What assumption is made in a Naïve Bayes classifier?
Features are correlated
Features are independent
Classes are balanced
Features are binary
In high-dimensional data, which distance metric is most sensitive to dimensionality?
Cosine
Manhattan
Euclidean
Hamming
A chromosome has fitness 8, total fitness of population is 40. What is selection probability in roulette wheel?
0.2
0.4
0.8
0.1
Genetic algorithm is most suitable for:
Continuous optimization
Discrete search
Symbolic logic
Deterministic problems
A model has 4 hypotheses. It misclassifies 1 out of 10 training samples. What is the training error rate?
0.1
0.4
0.01
0.25
Which option in to_csv() controls column separator?
sep=','
delimiter=','
format=','
split=','
Given df['a'] = [1,2,3], what does df['a'] > 1 return?
Boolean Series
List
DataFrame
Error
When does Gibbs equal Bayes Optimal?
When one hypothesis dominates
Always
Never
If H is infinite
How many weights are needed between input (5 nodes) and hidden layer (3 neurons) with bias for each hidden node?
15
18
20
12
A learner chooses a hypothesis that minimizes entropy but ignores generalization error. What bias does this introduce?
Entropy bias
Accuracy bias
Overconfidence bias
Prior-based bias
Which of the following attributes will shrink version space faster?
Irrelevant
Redundant
Discriminative
Missing
Which feature selection metric is used in C4.5 algorithm?
Chi-square
Information Gain
Gain Ratio
Mean Decrease Accuracy
Sample complexity refers to:
Model size
Number of features
Data needed for accuracy
Runtime
If a model gives zero weight to rare features during training, what kind of bias is introduced?
Regularization bias
Frequency bias
Overfitting bias
Capacity bias
In MDL, what is the best model?
Minimizes data
Minimizes total encoding
Maximizes likelihood
Reduces entropy
Which expression selects the diagonal of np.array([[1,2,3],[4,5,6],[7,8,9]])?
np.diag(arr)
arr[:,0]
arr[::2]
arr.diagonal()
How to load CSV file into Pandas with header at first row?
pd.read_csv('f.csv')
pd.load_csv('f.csv')
np.load('f.csv')
pd.open('f.csv')
Which algorithm gives the best prediction if prior and likelihood are known?
KNN
Bayes Optimal Classifier
Perceptron
Logistic Regression
pd.DataFrame({'a':[1,2],'b':[3,4]}) creates how many
1
2
4
None
Which Pandas function is used to combine data along columns with alignment on indexes?
join()
concat()
merge()
groupby()
In KNN, the "K" refers to:
Number of features
Nearest neighbors
Clusters
Rules
What defines the version space in concept learning?
All data
All concepts
Consistent hypotheses
Labeled instances
In concept learning, if 3 out of 8 hypotheses are consistent with data, what's the version space size?
3
5
8
1
Decision trees work best with which type of data?
Continuous only
Categorical
Noisy
Binary
What is the time complexity of making a prediction with LWR using n training examples?
O(n)
O(log n)
O(1)
O(n2)
For 20 hypotheses, and 90% confidence, μ=0.1, how many examples needed?
Approximately 298
Approximately 300
Approximately 280
Approximately 260
A model uses bandwidth σ = 0.3 and distance from query point is 0.6. What is the exponent value in Gaussian weight formula?
-1
-2
-0.5
-1.5
Output of arr = np.array([1,2,3,4]); arr[arr≥2]*2?
[6 8]
[3 4]
[2 4 6 8]
Error
A dataset has 100 hypotheses, and 1 consistent hypothesis. What is the probability of picking it at random?
0.01
0.1
0.5
1
What learning rate range ensures convergence without overshooting in perceptron?
0.9–1.0
0.1–0.5
0.0–0.1
>1.0
Which method exports a Pandas DataFrame to a dictionary format?
df.to_dict()
df.save_dict()
df.to_json()
dict(df)
When is LWR unsuitable?
Real-time systems
Structured data
Missing values
Small datasets
A weight update is computed as -0.1. What does it mean?
Increase weight
Decrease weight
Stop training
Reset gradient
For a test point, distances to 3 training points are [0.2, 0.5, 0.9]. Using Gaussian kernel with σ = 0.5, which point gets highest weight?
First
Second
Third
All equal
Given df1 with index A, B and df2 with index B, C — df1.add(df2, fill_value=0) will result in:
Index A, B, C
Index A, B
Index B, C
Only C
Given initial θ₁=0.5, data x=[1,0,1], after E-step π=[0.8,0.3,0.9], compute new θ₁ (mean of π³).
0.67
0.75
0.65
0.8
What does EM (Expectation-Maximization) algorithm do?
Reduces overfitting
Handles missing data
Normalizes input
Converts to binary
Which function is most used for binary classification?
ReLU
Softmax
Sigmoid
Tanh
In Candidate Elimination, how are inconsistent hypotheses treated?
Removed
Modified
Stored
Merged
Why is sigmoid rarely used in hidden layers of deep networks?
High accuracy
Large gradients
Saturation issue
Fast convergence
Which of the following affects the convergence of EM?
Initialization
Step size
Gradient
Batch norm
Why is the ReLU activation commonly used in deep networks?
It is nonlinear
Prevents vanishing gradients
Linear output
Makes output discrete
Why is the perceptron learning rule guaranteed to converge?
Fixed weights
No learning
Guaranteed
Finite
np.savetxt('test.txt', arr, fmt='%d') saves data in:
Integer format
Float format
Binary
String format
What does Bayes' theorem help compute?
Prior probability
Posterior probability
Mean value
Error rate
A disease affects 1% of a population. A test has 99% sensitivity and 95% specificity. What is the probability a person has the disease given a positive result?
0.166
0.5
0.99
0.01
If initial population has poor fitness, what is GA’s long-term behavior?
Stuck early
Still improve
Degrade performance
Random converg
If a DNN has 3 hidden layers with 100 neurons each, how many total neurons are there (excluding input and output)?
300
100
102
302
A perceptron fails to classify a linearly non-separable function because:
No update rule
Not enough neurons
Activation is weak
Linear limitation
In supervised learning, the data contains:
Only inputs
Only outputs
No labels
Input-output pairs
In a test scenario, Class A has k=7 neighbors: 3 close (0.2–0.4), 4 far (1.5–2.0). Using weighted voting, class prediction tends toward:
Class A
Class B
Unknown
Class C
What is a key disadvantage of KNN?
High accuracy
Noisy predictions
Lazy learning
Small dataset needed
Which of the following is NOT a property of instance-based learning?
Fast training
Lazy learning
Storage intensive
Feature selection
What happens if we use a step activation function in training?
Slower training
Gradient vanishes
Non-differentiable
Always converges
What does np.where(arr>3) return for arr = np.array([1,2,3,4,5])?
(array([3, 4]))
[4 5]
1
[3, 4]
If L=0.125 , log-likelihood (base 2) is?
-2
-3
-4
-1
What causes error in probabilistic learning?
Overtraining
Wrong priors
Zero variance
Infinite data
A dataset has 10,000 samples. How many models are trained to classify 1000 test instances in LWR?
10
1
1000
10000
How many hypotheses are there in the version space if S = {Sunny, Warm, ?} and G = {?,?} after one positive example?
2
4
6
8
Input: [2,1], Weights: [0.5, 0.5], Bias = 0.2 → ReLU output = ?
1.2
1
0
0.7
For δ=0.1 and x=4 , with learning rate 0.25, what is the weight change?
0.1
-0.1
-0.05
-0.025
If cosine distance = 0, what is the angle between the test and training vector?
0°
90°
180°
Undefined
Which splitting strategy is least sensitive to noise?
Information Gain
Gain Ratio
Gini Index
Chi-Square
Similarity = 1 − normalized_distance. For distance 0.25, compute similarity.
0.25
0.5
0.75
1.25
What will df.set_index('id') do?
Set 'id' column as index
Drop index
Remove 'id'
Create multi-index
To concatenate DataFrames vertically, which axis is
0
1
columns
rows
For Gaussian Mixture Model with 3 components, how many parameters (means) are learned?
2
3
4
1
P(x1)=0.4, P(x2)=0.5, P(C)=0.3, P(x1|C)=0.7, P(x2|C)=0.8, P(x1,x2|¬C)=0.1. Find likelihood ratio.
13.4
12.5
14.7
11.2
If hypothesis h1 has accuracy 0.6 and h2 has 0.8, what is error of Bayes Optimal Classifier if h2 is correct?
0.2
0.4
0.1
0.3
In a noisy data scenario, what is the expected impact on the Candidate Elimination algorithm?
Version space expands
Version space collapses
Hypotheses generalize
S and G become identical
When would you prefer Hamming distance over Euclidean?
Real-valued features
Categorical/binary
Large datasets
High variance
You want smoother predictions using Gaussian kernel. Which adjustment to σ yields smoother predictions?
Increase σ
Decrease σ
Set σ = 0
Use Laplace
Which of the following learning strategies is most suitable for maintaining a dynamic hypothesis boundary while minimizing version space?
Eager learning
Lazy learning
Online learning
Batch learning
Which method can be used to search through hypothesis space?
Gradient Descent
Heuristic Space Search
Beam Search
Batch Normalization
If EM convergence after 10 iterations reaches log-likelihood -55, and earlier was -70, what is the likelihood improvement?
15
10
20
25
Output of np.sum(np.array([1,2,3,4]) > 2) is:
2
3
1
0
If a decision tree is too deep and fits all training data, it is likely:
Overfitting
Underfitting
Optimal
Bias-free
