1. Home
  2. Explore
  3. Computer Science
  4. Introduction to AI with Python

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Introduction to AI with Python

  • 25Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Probability & Markov Models

What is the key assumption made by the Markov assumption in probability models?

25 questions

  1. 1

    What is the key assumption made by the Markov assumption in probability models?

    1. A

      The current state depends only on a finite fixed number of previous states

    2. B

      The probability of any state is constant over time

    3. C

      Future states are independent of past states given the present

    4. D

      All states are equally likely at any time

    Correct answer
    A

    The 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.

  2. 2

    In a Markov chain, what does the transition model describe?

    1. A

      The probability of a state given all previous states

    2. B

      The probability of moving from one state to another in one step

    3. C

      The initial probability distribution over states

    4. D

      The probability of observing a particular emission from a state

    Correct answer
    B

    The 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.

  3. 3

    What is the sensor model (emission probabilities) in a hidden Markov model?

    1. A

      The probability of observing evidence given the hidden state

    2. B

      The probability of the hidden state given previous evidence

    3. C

      The probability of transitioning from one hidden state to another

    4. D

      The probability of the initial hidden state

    Correct answer
    A

    The 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.

  4. 4

    Which task in a hidden Markov model involves calculating the distribution of the current state given all observations up to the present?

    1. A

      Filtering

    2. B

      Most likely explanation

    3. C

      Prediction

    4. D

      Smoothing

    Correct answer
    A

    Filtering

    Explanation

    Filtering calculates the distribution over the current state given observations from the start until now.

  5. 5

    In the context of local search, what is a local minimum?

    1. A

      A state that has no neighbors

    2. B

      A state whose value is higher than all of its neighbors

    3. C

      A state whose value is lower than all of its neighbors

    4. D

      The state with the lowest possible value in the entire state space

    Correct answer
    C

    A 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.

  6. 6

    What distinguishes stochastic hill climbing from steepest ascent hill climbing?

    1. A

      Stochastic hill climbing always moves to a random neighbor, while steepest ascent moves to the best neighbor

    2. B

      Stochastic hill climbing restarts randomly, while steepest ascent does not

    3. C

      Stochastic hill climbing uses a queue, while steepest ascent uses a stack

    4. D

      Stochastic hill climbing chooses randomly from among better neighbors, while steepest ascent picks the best neighbor

    Correct answer
    D

    Stochastic 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.

  7. 7

    What is the purpose of the temperature parameter in simulated annealing?

    1. A

      It specifies the learning rate for gradient descent

    2. B

      It determines the number of iterations the algorithm will run

    3. C

      It sets the initial weight of all variables

    4. D

      It controls the probability of accepting a worse neighbor

    Correct answer
    D

    It 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.

  8. 8

    What is a constraint satisfaction problem (CSP) defined as?

    1. A

      A graph of states connected by actions with path costs

    2. B

      A set of variables and a single objective function to optimize

    3. C

      A set of logical sentences and a query to prove

    4. D

      A set of variables, each with a domain, and a set of constraints

    Correct answer
    D

    A 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.

  9. 9

    What does it mean for a variable to be arc consistent with respect to another variable?

    1. A

      The first variable's domain contains at least one value that satisfies all unary constraints

    2. B

      Every value in the first variable's domain has a possible value in the second variable's domain that satisfies the binary constraint

    3. C

      The arc between them has been removed from the constraint graph

    4. D

      All values in both domains are consistent with each other

    Correct answer
    B

    Every 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.

  10. 10

    In backtracking search for CSPs, what is the purpose of the minimum remaining values (MRV) heuristic?

    1. A

      It selects the unassigned variable with the smallest domain

    2. B

      It selects the unassigned variable that appears in the most constraints

    3. C

      It chooses the variable that has the highest degree in the constraint graph

    4. D

      It orders the values of a variable from least to most constraining

    Correct answer
    A

    It 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.

  11. 11

    What is the main difference between supervised and unsupervised learning?

    1. A

      Supervised learning is used for classification only; unsupervised learning is used for regression only

    2. B

      Supervised learning requires a reward signal; unsupervised learning does not

    3. C

      Supervised learning is always more accurate than unsupervised learning

    4. D

      Supervised learning uses labeled input-output pairs; unsupervised learning uses only input data without labels

    Correct answer
    D

    Supervised 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.

  12. 12

    In the k-nearest neighbors algorithm, what happens as k increases?

    1. A

      The training accuracy always increases

    2. B

      The algorithm no longer requires a distance metric

    3. C

      The algorithm becomes more sensitive to local variations

    4. D

      The decision boundary becomes smoother and less sensitive to noise

    Correct answer
    D

    The 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.

  13. 13

    What is overfitting in machine learning?

    1. A

      A model that underperforms on the training data but generalizes well

    2. B

      A model with too many parameters that cannot be trained

    3. C

      A model that fits the training data too closely and fails to generalize to new data

    4. D

      A model that requires an excessive amount of memory

    Correct answer
    C

    A 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.

  14. 14

    What is the role of the learning rate in gradient descent?

    1. A

      It determines the batch size for mini-batch gradient descent

    2. B

      It controls the number of hidden layers in a neural network

    3. C

      It determines the size of the steps taken toward the minimum of the loss function

    4. D

      It sets the initial weights of the model

    Correct answer
    C

    It 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.

  15. 15

    In a neural network, what is the purpose of a hidden layer?

    1. A

      To allow the network to learn more complex, non-linear functions

    2. B

      To store the training data for later inference

    3. C

      To reduce the dimensionality of the input data

    4. D

      To directly connect input to output with linear combinations

    Correct answer
    A

    To 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.

  16. 16

    What does backpropagation compute in a neural network?

    1. A

      The gradient of the loss function with respect to each weight

    2. B

      The optimal number of hidden units

    3. C

      The forward pass output for a given input

    4. D

      The accuracy of the model on the training set

    Correct answer
    A

    The 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.

  17. 17

    What is the purpose of dropout in neural network training?

    1. A

      To permanently prune unnecessary weights after training

    2. B

      To temporarily remove random units during training to prevent overfitting

    3. C

      To increase the learning rate during training

    4. D

      To add noise to the input data for regularization

    Correct answer
    B

    To 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.

  18. 18

    What is the main advantage of using a convolutional neural network (CNN) for image analysis?

    1. A

      It only works on grayscale images

    2. B

      It processes images as a flat vector without losing structure

    3. C

      It can learn spatial features like edges and textures through convolution and pooling

    4. D

      It requires fewer training samples than other networks

    Correct answer
    C

    It 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.

  19. 19

    In natural language processing, what is the bag-of-words model?

    1. A

      A representation that encodes each word as a one-hot vector

    2. B

      A representation that treats text as an unordered collection of words

    3. C

      A method for generating new sentences from a corpus

    4. D

      A model that preserves word order in a sentence

    Correct answer
    B

    A 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.

  20. 20

    What is the purpose of attention in transformer models?

    1. A

      To replace the need for positional encoding

    2. B

      To ensure that all input words are equally important

    3. C

      To reduce the number of layers in the network

    4. D

      To allow the model to focus on relevant parts of the input when generating each output

    Correct answer
    D

    To 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.

  21. 21

    What problem does positional encoding solve in transformer models?

    1. A

      It normalizes the input values to a common scale

    2. B

      It encodes the meaning of each word into a fixed vector

    3. C

      It prevents the model from overfitting to short sequences

    4. D

      It adds information about the order of tokens since transformers process all tokens in parallel

    Correct answer
    D

    It 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.

  22. 22

    What is the encoder-decoder architecture used for in sequence-to-sequence tasks?

    1. A

      To train a model that outputs a single label for an entire sequence

    2. B

      To convert images into text descriptions

    3. C

      To compress the input sequence for storage

    4. D

      To encode the input sequence into a context and then decode it into an output sequence

    Correct answer
    D

    To 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.

  23. 23

    In reinforcement learning, what is the exploration vs. exploitation trade-off?

    1. A

      Balancing trying new actions (exploration) with using known good actions (exploitation)

    2. B

      Balancing training time with inference time

    3. C

      Balancing supervised and unsupervised learning

    4. D

      Balancing the number of states with the number of actions

    Correct answer
    A

    Balancing 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.

  24. 24

    What does the Q function represent in Q-learning?

    1. A

      The immediate reward received after taking an action

    2. B

      The expected total reward of taking an action in a given state

    3. C

      The number of times a state-action pair has been visited

    4. D

      The probability of a state being a goal state

    Correct answer
    B

    The 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.

  25. 25

    What is the purpose of additive smoothing (e.g., Laplace smoothing) in naive Bayes classifiers?

    1. A

      To reduce the effect of common words like 'the'

    2. B

      To avoid zero probabilities for unseen words in a class

    3. C

      To normalize the feature vectors

    4. D

      To increase the bias towards majority class

    Correct answer
    B

    To 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.

Question 1 of 25
Question 1 of 25

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent