Introduction to AI with Python
- 25Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is the key assumption made by the Markov assumption in probability models?
What is the key assumption made by the Markov assumption in probability models?
25 questions
- 1
What is the key assumption made by the Markov assumption in probability models?
- A
The current state depends only on a finite fixed number of previous states
- B
The probability of any state is constant over time
- C
Future states are independent of past states given the present
- D
All states are equally likely at any time
Correct answer
AThe current state depends only on a finite fixed number of previous states
Explanation
The Markov assumption states that the current state depends only on a finite fixed number of previous states (e.g., only the most recent state). This simplifies modeling by ignoring long-range dependencies.
- A
- 2
In a Markov chain, what does the transition model describe?
- A
The probability of a state given all previous states
- B
The probability of moving from one state to another in one step
- C
The initial probability distribution over states
- D
The probability of observing a particular emission from a state
Correct answer
BThe probability of moving from one state to another in one step
Explanation
The transition model in a Markov chain defines the probabilities of transitioning from one state to another in a single time step, typically represented as a matrix.
- A
- 3
What is the sensor model (emission probabilities) in a hidden Markov model?
- A
The probability of observing evidence given the hidden state
- B
The probability of the hidden state given previous evidence
- C
The probability of transitioning from one hidden state to another
- D
The probability of the initial hidden state
Correct answer
AThe probability of observing evidence given the hidden state
Explanation
The sensor model (or emission probabilities) specifies the probability of observing a particular piece of evidence given the current hidden state.
- A
- 4
Which task in a hidden Markov model involves calculating the distribution of the current state given all observations up to the present?
- A
Filtering
- B
Most likely explanation
- C
Prediction
- D
Smoothing
Correct answer
AFiltering
Explanation
Filtering calculates the distribution over the current state given observations from the start until now.
- A
- 5
In the context of local search, what is a local minimum?
- A
A state that has no neighbors
- B
A state whose value is higher than all of its neighbors
- C
A state whose value is lower than all of its neighbors
- D
The state with the lowest possible value in the entire state space
Correct answer
CA state whose value is lower than all of its neighbors
Explanation
A local minimum is a state whose cost (or value) is lower than any of its neighboring states, but not necessarily the global minimum.
- A
- 6
What distinguishes stochastic hill climbing from steepest ascent hill climbing?
- A
Stochastic hill climbing always moves to a random neighbor, while steepest ascent moves to the best neighbor
- B
Stochastic hill climbing restarts randomly, while steepest ascent does not
- C
Stochastic hill climbing uses a queue, while steepest ascent uses a stack
- D
Stochastic hill climbing chooses randomly from among better neighbors, while steepest ascent picks the best neighbor
Correct answer
DStochastic hill climbing chooses randomly from among better neighbors, while steepest ascent picks the best neighbor
Explanation
Stochastic hill climbing selects randomly from among all neighbors that are better than the current state, whereas steepest ascent evaluates all neighbors and selects the one with the highest improvement.
- A
- 7
What is the purpose of the temperature parameter in simulated annealing?
- A
It specifies the learning rate for gradient descent
- B
It determines the number of iterations the algorithm will run
- C
It sets the initial weight of all variables
- D
It controls the probability of accepting a worse neighbor
Correct answer
DIt controls the probability of accepting a worse neighbor
Explanation
The temperature parameter in simulated annealing influences the likelihood of accepting a worse solution. At high temperatures, worse solutions are more likely to be accepted, enabling exploration; at low temperatures, the algorithm becomes more greedy.
- A
- 8
What is a constraint satisfaction problem (CSP) defined as?
- A
A graph of states connected by actions with path costs
- B
A set of variables and a single objective function to optimize
- C
A set of logical sentences and a query to prove
- D
A set of variables, each with a domain, and a set of constraints
Correct answer
DA set of variables, each with a domain, and a set of constraints
Explanation
A CSP consists of variables with domains (possible values) and constraints that restrict the combinations of values that variables can take.
- A
- 9
What does it mean for a variable to be arc consistent with respect to another variable?
- A
The first variable's domain contains at least one value that satisfies all unary constraints
- B
Every value in the first variable's domain has a possible value in the second variable's domain that satisfies the binary constraint
- C
The arc between them has been removed from the constraint graph
- D
All values in both domains are consistent with each other
Correct answer
BEvery value in the first variable's domain has a possible value in the second variable's domain that satisfies the binary constraint
Explanation
Arc consistency requires that for every value in the domain of x, there exists some value in the domain of y that satisfies the binary constraint between x and y.
- A
- 10
In backtracking search for CSPs, what is the purpose of the minimum remaining values (MRV) heuristic?
- A
It selects the unassigned variable with the smallest domain
- B
It selects the unassigned variable that appears in the most constraints
- C
It chooses the variable that has the highest degree in the constraint graph
- D
It orders the values of a variable from least to most constraining
Correct answer
AIt selects the unassigned variable with the smallest domain
Explanation
The MRV heuristic chooses the variable with the fewest remaining values to assign next, which can quickly lead to a dead end or solution and reduces branching.
- A
- 11
What is the main difference between supervised and unsupervised learning?
- A
Supervised learning is used for classification only; unsupervised learning is used for regression only
- B
Supervised learning requires a reward signal; unsupervised learning does not
- C
Supervised learning is always more accurate than unsupervised learning
- D
Supervised learning uses labeled input-output pairs; unsupervised learning uses only input data without labels
Correct answer
DSupervised learning uses labeled input-output pairs; unsupervised learning uses only input data without labels
Explanation
Supervised learning trains on data with known output labels, while unsupervised learning finds patterns in unlabeled data.
- A
- 12
In the k-nearest neighbors algorithm, what happens as k increases?
- A
The training accuracy always increases
- B
The algorithm no longer requires a distance metric
- C
The algorithm becomes more sensitive to local variations
- D
The decision boundary becomes smoother and less sensitive to noise
Correct answer
DThe decision boundary becomes smoother and less sensitive to noise
Explanation
A larger k averages over more neighbors, which smooths the decision boundary and reduces the impact of outliers, but may increase bias.
- A
- 13
What is overfitting in machine learning?
- A
A model that underperforms on the training data but generalizes well
- B
A model with too many parameters that cannot be trained
- C
A model that fits the training data too closely and fails to generalize to new data
- D
A model that requires an excessive amount of memory
Correct answer
CA model that fits the training data too closely and fails to generalize to new data
Explanation
Overfitting occurs when a model learns noise or specific patterns in the training data, harming its performance on unseen data.
- A
- 14
What is the role of the learning rate in gradient descent?
- A
It determines the batch size for mini-batch gradient descent
- B
It controls the number of hidden layers in a neural network
- C
It determines the size of the steps taken toward the minimum of the loss function
- D
It sets the initial weights of the model
Correct answer
CIt determines the size of the steps taken toward the minimum of the loss function
Explanation
The learning rate scales the update to the weights based on the gradient. A large learning rate can cause overshooting, while a small one may slow convergence.
- A
- 15
In a neural network, what is the purpose of a hidden layer?
- A
To allow the network to learn more complex, non-linear functions
- B
To store the training data for later inference
- C
To reduce the dimensionality of the input data
- D
To directly connect input to output with linear combinations
Correct answer
ATo allow the network to learn more complex, non-linear functions
Explanation
Hidden layers enable neural networks to learn hierarchical representations and non-linear mappings, increasing their expressiveness.
- A
- 16
What does backpropagation compute in a neural network?
- A
The gradient of the loss function with respect to each weight
- B
The optimal number of hidden units
- C
The forward pass output for a given input
- D
The accuracy of the model on the training set
Correct answer
AThe gradient of the loss function with respect to each weight
Explanation
Backpropagation calculates the gradient of the loss with respect to all weights by propagating errors backward through the network, enabling gradient descent updates.
- A
- 17
What is the purpose of dropout in neural network training?
- A
To permanently prune unnecessary weights after training
- B
To temporarily remove random units during training to prevent overfitting
- C
To increase the learning rate during training
- D
To add noise to the input data for regularization
Correct answer
BTo temporarily remove random units during training to prevent overfitting
Explanation
Dropout randomly drops units (and their connections) from the network during training, which reduces over-reliance on specific neurons and acts as a regularizer.
- A
- 18
What is the main advantage of using a convolutional neural network (CNN) for image analysis?
- A
It only works on grayscale images
- B
It processes images as a flat vector without losing structure
- C
It can learn spatial features like edges and textures through convolution and pooling
- D
It requires fewer training samples than other networks
Correct answer
CIt can learn spatial features like edges and textures through convolution and pooling
Explanation
CNNs use convolutional layers to detect local patterns and pooling to reduce dimensionality, effectively capturing spatial hierarchies in images.
- A
- 19
In natural language processing, what is the bag-of-words model?
- A
A representation that encodes each word as a one-hot vector
- B
A representation that treats text as an unordered collection of words
- C
A method for generating new sentences from a corpus
- D
A model that preserves word order in a sentence
Correct answer
BA representation that treats text as an unordered collection of words
Explanation
The bag-of-words model ignores word order and grammar, representing text solely by the multiset of words it contains.
- A
- 20
What is the purpose of attention in transformer models?
- A
To replace the need for positional encoding
- B
To ensure that all input words are equally important
- C
To reduce the number of layers in the network
- D
To allow the model to focus on relevant parts of the input when generating each output
Correct answer
DTo allow the model to focus on relevant parts of the input when generating each output
Explanation
Attention mechanisms compute a weighted sum of input values, enabling the model to dynamically emphasize different parts of the input sequence during output generation.
- A
- 21
What problem does positional encoding solve in transformer models?
- A
It normalizes the input values to a common scale
- B
It encodes the meaning of each word into a fixed vector
- C
It prevents the model from overfitting to short sequences
- D
It adds information about the order of tokens since transformers process all tokens in parallel
Correct answer
DIt adds information about the order of tokens since transformers process all tokens in parallel
Explanation
Positional encodings are added to input embeddings to give the model information about the position of each token in the sequence, which is necessary because transformers do not inherently process tokens in order.
- A
- 22
What is the encoder-decoder architecture used for in sequence-to-sequence tasks?
- A
To train a model that outputs a single label for an entire sequence
- B
To convert images into text descriptions
- C
To compress the input sequence for storage
- D
To encode the input sequence into a context and then decode it into an output sequence
Correct answer
DTo encode the input sequence into a context and then decode it into an output sequence
Explanation
The encoder-decoder architecture first encodes the input sequence into a fixed-length context vector (or set of vectors), then decodes that context into an output sequence, useful for machine translation and summarization.
- A
- 23
In reinforcement learning, what is the exploration vs. exploitation trade-off?
- A
Balancing trying new actions (exploration) with using known good actions (exploitation)
- B
Balancing training time with inference time
- C
Balancing supervised and unsupervised learning
- D
Balancing the number of states with the number of actions
Correct answer
ABalancing trying new actions (exploration) with using known good actions (exploitation)
Explanation
Exploration tries new actions to discover better rewards, while exploitation chooses known good actions. The trade-off is to maximize cumulative reward.
- A
- 24
What does the Q function represent in Q-learning?
- A
The immediate reward received after taking an action
- B
The expected total reward of taking an action in a given state
- C
The number of times a state-action pair has been visited
- D
The probability of a state being a goal state
Correct answer
BThe expected total reward of taking an action in a given state
Explanation
Q(s,a) estimates the expected cumulative reward of taking action a in state s and then following an optimal policy thereafter.
- A
- 25
What is the purpose of additive smoothing (e.g., Laplace smoothing) in naive Bayes classifiers?
- A
To reduce the effect of common words like 'the'
- B
To avoid zero probabilities for unseen words in a class
- C
To normalize the feature vectors
- D
To increase the bias towards majority class
Correct answer
BTo avoid zero probabilities for unseen words in a class
Explanation
Additive smoothing adds a small constant (often 1) to all word counts, preventing zero probability estimates for words not seen in a particular class during training.
- A

Ask anything
We've read this whole study set, so questions about it get the best answers.