1. Home
  2. Explore
  3. Computer Science
  4. Reinforcement Learning Basics

Study methods

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

Reinforcement Learning Basics

  • 66Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Bias Variance

What is generalization error, and why is it more important than training error in machine learning?

66 questions

  1. 1

    What is generalization error, and why is it more important than training error in machine learning?

    Model answer

    Generalization error measures how well a model performs on unseen data. It is more important than training error because machine learning aims to perform well beyond the examples used for training.

    Explanation

    A model can reduce training error by becoming highly complex without improving its performance on new data.

  2. 2

    What are the three additive components of test or generalization error?

    Model answer

    They are irreducible error, bias, and variance.

    Explanation

    These components separate noise in the test data from systematic model error and sensitivity to training data.

  3. 3

    What is irreducible error, and why cannot it be eliminated?

    Model answer

    Irreducible error is the noise inherent in the test example or data-generating process. It cannot be eliminated because it is a fact of the data rather than a limitation of the model.

    Explanation

    Even a perfect model cannot predict outcomes that contain unavoidable random noise.

  4. 4

    Define bias in the bias-variance framework.

    Model answer

    Bias is the systematic error made by a model, such as consistently underpredicting or overpredicting. It can be understood as the model's average error across possible training sets.

    Explanation

    A high-bias model is typically too simple to represent the underlying relationship adequately.

  5. 5

    Define variance in the bias-variance framework.

    Model answer

    Variance is the sensitivity of a model to noise or changes in the training data.

    Explanation

    A high-variance model can fit one training set well but behave very differently when trained on another.

  6. 6

    How does noise in test data differ from noise in training data?

    Model answer

    Noise in test data contributes to irreducible error, whereas noise in training data contributes to the variance of the learned model.

    Explanation

    The two types of noise affect different parts of the generalization-error decomposition.

  7. 7

    How does increasing model capacity affect bias and variance?

    Model answer

    Increasing model capacity generally reduces bias but may increase variance.

    Explanation

    A more complex model can represent more relationships, but it may also fit accidental patterns in the training data.

  8. 8

    How does increasing regularization affect bias and variance?

    Model answer

    Increasing regularization generally reduces variance but increases bias.

    Explanation

    Regularization restricts the model, making it less sensitive to training noise but potentially too rigid.

  9. 9

    Why must a practitioner determine whether a problem is primarily high bias or high variance before changing a model?

    Model answer

    Different interventions affect bias and variance in opposite ways. A change that helps one problem may worsen the other.

    Explanation

    For example, increasing capacity can help high bias but harm high variance, while stronger regularization has the reverse trade-off.

  10. 10

    How can training error and cross-validation error be used heuristically to diagnose bias and variance?

    Model answer

    Training error provides a heuristic indication of bias, while the gap between cross-validation error and training error indicates variance.

    Explanation

    A large training error suggests high bias, while a large difference between training and cross-validation error suggests high variance.

  11. 11

    Why should training error and cross-validation error be examined simultaneously during model development?

    Model answer

    Examining both provides actionable information about whether the model mainly has a bias or variance problem. Looking only at cross-validation error does not identify the appropriate remedy.

    Explanation

    The comparison guides choices such as increasing model capacity or increasing regularization.

  12. 12

    What is supervised learning?

    Model answer

    Supervised learning learns a hypothesis that maps an input xxx to an output yyy using labeled input-output examples.

    Explanation

    The correct output for each training example provides the supervision used to learn the mapping.

  13. 13

    How does the goal of supervised learning differ from merely solving an optimization problem?

    Model answer

    Supervised learning seeks to minimize loss on unseen data, whereas a basic optimization problem may only minimize loss on the available data.

    Explanation

    Generalization to unseen examples is what makes the task a machine learning problem.

  14. 14

    How are classification and regression distinguished?

    Model answer

    Classification predicts a discrete output, such as a binary or multiclass label, whereas regression predicts a continuous output.

    Explanation

    The distinction is based on the data type of the target variable yyy.

  15. 15

    Why is predicting one of the digits from 000 through 999 considered classification?

    Model answer

    The target is a discrete variable with multiple possible classes, so the task is multiclass classification.

    Explanation

    Classification is not limited to binary outputs; it also includes finite sets of labels.

  16. 16

    What is a generalized linear model?

    Model answer

    A generalized linear model assumes that yyy given xxx follows a distribution in the exponential family.

    Explanation

    This framework includes many possible output types, including continuous, binary, count, and positive-only variables.

  17. 17

    How do discriminative and generative models differ?

    Model answer

    A discriminative model learns the conditional distribution p(y∣x)p(y\mid x)p(y∣x), while a generative model learns how to generate the joint pair (x,y)(x,y)(x,y).

    Explanation

    Generative modeling is commonly decomposed using the chain rule as p(y)p(x∣y)p(y)p(x\mid y)p(y)p(x∣y).

  18. 18

    How can the joint distribution of a generative model be decomposed using the chain rule?

    Model answer

    It can be written as p(x,y)=p(y)p(x∣y)p(x,y)=p(y)p(x\mid y)p(x,y)=p(y)p(x∣y).

    Explanation

    This decomposition separates the distribution of the output from the distribution of inputs conditioned on that output.

  19. 19

    What are Naive Bayes and Gaussian discriminant analysis examples of?

    Model answer

    They are generative models; Naive Bayes uses discrete inputs, while Gaussian discriminant analysis uses real-valued inputs.

    Explanation

    Both model how input-output pairs are generated rather than learning only the conditional prediction rule.

  20. 20

    What relationship exists between Gaussian discriminant analysis and logistic regression under the stated assumptions?

    Model answer

    For an appropriate exponential-family conditional distribution of xxx given yyy, the resulting p(y∣x)p(y\mid x)p(y∣x) has a logistic-regression form.

    Explanation

    This shows that generative and discriminative approaches can produce equivalent conditional models in some settings.

  21. 21

    What is a kernel?

    Model answer

    A kernel is a symmetric positive-definite function that implicitly represents a feature map.

    Explanation

    Kernel methods use this implicit feature representation without explicitly constructing potentially very high-dimensional features.

  22. 22

    How do kernel methods differ from ordinary parameterized models in what determines their complexity?

    Model answer

    Ordinary models typically learn one parameter per feature, whereas kernel methods learn coefficients associated with training examples.

    Explanation

    Thus, ordinary-model complexity is related to the number of features, while kernel-method complexity is related to the number of examples.

  23. 23

    Why can kernel methods become expensive on very large datasets?

    Model answer

    Their complexity generally depends on the number of training examples, so computation can become expensive when the dataset is large.

    Explanation

    This is the main scalability limitation of kernel methods compared with methods whose complexity depends primarily on feature count.

  24. 24

    Why can kernel-based support vector machines scale relatively well despite using kernels?

    Model answer

    The learned coefficients in kernel SVMs are often sparse, so many training examples have zero coefficients.

    Explanation

    Sparsity reduces the effective number of examples contributing to predictions while kernels can still provide many implicit features.

  25. 25

    How do neural networks provide nonlinear representations?

    Model answer

    A neural network can be viewed as a generalized linear model at its final layer preceded by a learnable feature map.

    Explanation

    Unlike a hand-designed kernel or feature map, the intermediate representation is learned from data.

  26. 26

    What is reinforcement learning?

    Model answer

    Reinforcement learning trains an agent that acts in an environment over time and receives rewards rather than being given the correct action directly.

    Explanation

    The agent must learn how actions affect future states and rewards.

  27. 27

    How does reinforcement learning supervision differ from supervised learning supervision?

    Model answer

    Supervised learning provides a target output for each input, whereas reinforcement learning provides a scalar reward that evaluates the consequences of an action.

    Explanation

    A reward does not directly specify the correct action, so the agent must discover effective behavior.

  28. 28

    Why does reinforcement learning require a long-term view of decision making?

    Model answer

    The agent makes sequential decisions, and each action can affect future states and rewards. Therefore, it seeks to maximize accumulated future reward rather than only the immediate reward.

    Explanation

    This temporal dependence distinguishes reinforcement learning from independent, identically distributed supervised examples.

  29. 29

    Give three examples of reinforcement-learning agents described in the material.

    Model answer

    Examples include a walking robot, a game-playing agent for chess or Go, and an automated trading agent.

    Explanation

    Each example repeatedly acts in an environment and receives feedback over time.

  30. 30

    What is a Markov decision process, or MDP?

    Model answer

    An MDP is a five-tuple consisting of a state set, an action set, transition probabilities, a discount factor, and a reward function.

    Explanation

    The MDP specifies the environment in which an agent makes sequential decisions.

  31. 31

    What does the state set in an MDP represent?

    Model answer

    The state set contains all possible states in which the agent can be.

    Explanation

    For a grid-world problem, each accessible grid location is a possible state.

  32. 32

    What does the action set in an MDP represent?

    Model answer

    The action set contains the actions available to the agent, such as moving north, south, east, or west in a grid world.

    Explanation

    A policy selects an action from this set based on the current state.

  33. 33

    What do transition probabilities represent in an MDP?

    Model answer

    They specify the probability of reaching each possible next state given the current state and selected action.

    Explanation

    They are written using the current state and action as inputs and form a probability distribution over successor states.

  34. 34

    Why might an action lead to different next states in an MDP?

    Model answer

    The environment may be stochastic, so uncertainty such as imperfect robot movement can cause the same action to produce different outcomes.

    Explanation

    For example, an action intended to move north might move north most of the time but sometimes move sideways.

  35. 35

    What is the reward function in an MDP?

    Model answer

    The reward function assigns a real-valued immediate reward to a state or, in some formulations, to a state-action pair.

    Explanation

    Rewards may be positive or negative and can represent goals, penalties, or action-specific costs.

  36. 36

    Why might a reward function depend on both state and action rather than only state?

    Model answer

    Different actions may have different costs even when they lead to the same state, so the reward can be modeled as a function of the state-action pair.

    Explanation

    This representation captures action-specific penalties or effort.

  37. 37

    What is an episode, trajectory, or trial in reinforcement learning?

    Model answer

    It is a sequence of states and actions generated as the agent acts and the environment produces successor states.

    Explanation

    These three terms are used synonymously for a run of interaction with the environment.

  38. 38

    How is the accumulated reward of a trajectory computed when discounting is used?

    Model answer

    The immediate reward is added to future rewards multiplied by increasing powers of the discount factor, such as r0+γr1+γ2r2+⋯r_0+\gamma r_1+\gamma^2r_2+\cdotsr0​+γr1​+γ2r2​+⋯.

    Explanation

    The reward received later is weighted less when the discount factor is between 000 and 111.

  39. 39

    What is the purpose of the discount factor γ\gammaγ?

    Model answer

    The discount factor weights future rewards relative to immediate rewards and encourages the agent to obtain positive rewards sooner and postpone negative rewards.

    Explanation

    In a financial interpretation, it can be viewed similarly to an interest or discount rate.

  40. 40

    Define a policy in reinforcement learning.

    Model answer

    A policy π\piπ maps each state to an action, specifying what the agent should do when it is in that state.

    Explanation

    Learning a good policy is one of the central goals of reinforcement learning.

  41. 41

    Define the value Vπ(s)V^\pi(s)Vπ(s) of a state under a policy.

    Model answer

    The value Vπ(s)V^\pi(s)Vπ(s) is the expected sum of discounted future rewards obtained when starting in state sss and following policy π\piπ.

    Explanation

    The expectation is needed because stochastic transitions can lead to different future states and rewards.

  42. 42

    Why is a reward different from a value?

    Model answer

    A reward is an immediate payoff, whereas a value is the long-term expected sum of discounted rewards obtained by following a policy.

    Explanation

    An agent may sacrifice an immediate reward to reach states that provide greater future value.

  43. 43

    Why does the value function contain an expectation?

    Model answer

    The expectation accounts for the randomness in future states caused by stochastic transition probabilities.

    Explanation

    If transitions were deterministic, the future return would not require averaging over possible outcomes.

  44. 44

    State the Bellman equation for the value of a policy.

    Model answer

    The Bellman equation is Vπ(s)=R(s)+γ∑s′P(s,π(s),s′)Vπ(s′)V^\pi(s)=R(s)+\gamma\sum_{s'}P(s,\pi(s),s')V^\pi(s')Vπ(s)=R(s)+γ∑s′​P(s,π(s),s′)Vπ(s′).

    Explanation

    It decomposes the value into the immediate reward plus the discounted expected value of successor states.

  45. 45

    What does the Bellman equation reveal about the structure of a state's value?

    Model answer

    A state's value equals its immediate reward plus the discounted expected future value after taking the policy-prescribed action.

    Explanation

    This recursive decomposition is central to dynamic programming methods in reinforcement learning.

  46. 46

    How can a policy be used to obtain a value function?

    Model answer

    Follow the policy repeatedly from each state and compute the expected discounted sum of rewards, or solve the corresponding Bellman equations.

    Explanation

    Thus, a policy induces a value function describing the long-term payoff of following it.

  47. 47

    How can a value function be used to construct a policy?

    Model answer

    At each state, choose the action with the highest expected successor-state value according to the transition probabilities.

    Explanation

    The policy selects the action that appears most beneficial under the given value estimates.

  48. 48

    What is the optimal value function?

    Model answer

    The optimal value function is V∗(s)=max⁡πVπ(s)V^*(s)=\max_\pi V^\pi(s)V∗(s)=maxπ​Vπ(s), the greatest expected discounted return achievable from state sss over all policies.

    Explanation

    It represents the best long-term performance possible from each state.

  49. 49

    State the Bellman optimality equation.

    Model answer

    The Bellman optimality equation is V∗(s)=R(s)+max⁡aγ∑s′P(s,a,s′)V∗(s′)V^*(s)=R(s)+\max_a\gamma\sum_{s'}P(s,a,s')V^*(s')V∗(s)=R(s)+maxa​γ∑s′​P(s,a,s′)V∗(s′).

    Explanation

    Unlike the policy-specific Bellman equation, it maximizes over the available action at each state.

  50. 50

    Why cannot the Bellman optimality equation generally be solved as a single linear system?

    Model answer

    The maximization over actions makes the equation nonlinear, unlike the policy-specific Bellman equation, which is linear in the value variables.

    Explanation

    A fixed policy produces a linear system, but the optimal action is unknown and must be selected through the maximum.

  51. 51

    How is the optimal policy defined from the optimal value function?

    Model answer

    The optimal policy chooses an action that maximizes the expected discounted successor value: π∗(s)=arg⁡max⁡a∑s′P(s,a,s′)V∗(s′)\pi^*(s)=\arg\max_a\sum_{s'}P(s,a,s')V^*(s')π∗(s)=argmaxa​∑s′​P(s,a,s′)V∗(s′).

    Explanation

    The action selected at each state is the one that achieves the optimal value equation.

  52. 52

    How can the Bellman equation for a fixed policy be written in matrix form?

    Model answer

    If PπP^\piPπ contains the transition probabilities under policy π\piπ, then Vπ=R+γPπVπV^\pi=R+\gamma P^\pi V^\piVπ=R+γPπVπ.

    Explanation

    Each row of PπP^\piPπ gives the successor-state distribution for the action selected by the policy in one state.

  53. 53

    What closed-form expression gives the value function of a fixed policy?

    Model answer

    The value function is Vπ=(I−γPπ)−1RV^\pi=(I-\gamma P^\pi)^{-1}RVπ=(I−γPπ)−1R.

    Explanation

    This follows by rearranging the linear system (I−γPπ)Vπ=R(I-\gamma P^\pi)V^\pi=R(I−γPπ)Vπ=R.

  54. 54

    What is value iteration?

    Model answer

    Value iteration repeatedly updates each state's value using the Bellman optimality update until the values converge.

    Explanation

    It directly approximates the optimal value function rather than maintaining an explicit policy at every update.

  55. 55

    State the value-iteration update rule.

    Model answer

    For each state, update according to V(s)←R(s)+max⁡aγ∑s′P(s,a,s′)V(s′)V(s)\leftarrow R(s)+\max_a\gamma\sum_{s'}P(s,a,s')V(s')V(s)←R(s)+maxa​γ∑s′​P(s,a,s′)V(s′).

    Explanation

    The old value estimates on the right-hand side are used to produce improved estimates on the left-hand side.

  56. 56

    How is value iteration initialized?

    Model answer

    The value function can be initialized to zero for every state, although other initializations are also possible.

    Explanation

    Repeated Bellman updates move the estimates toward the optimal value function.

  57. 57

    Why does value iteration converge?

    Model answer

    The Bellman backup operator is a contraction mapping, so repeated application moves value estimates toward a unique fixed point, the optimal value function.

    Explanation

    Once the fixed point is reached, applying the Bellman operator produces the same values again.

  58. 58

    What is the fixed point of the Bellman backup operator?

    Model answer

    The fixed point is the optimal value function V∗V^*V∗.

    Explanation

    The optimal value function satisfies the Bellman optimality equation and remains unchanged under another optimality update.

  59. 59

    What is the difference between synchronous and asynchronous value iteration?

    Model answer

    Synchronous value iteration computes updates for all states using the old values and replaces them together, whereas asynchronous value iteration updates states one at a time and may use newly updated values immediately.

    Explanation

    The two variants differ in when updated estimates become available to other state updates.

  60. 60

    What is policy iteration?

    Model answer

    Policy iteration alternates between evaluating the current policy and improving it by choosing actions that maximize expected value.

    Explanation

    It maintains an explicit policy and repeatedly makes that policy better.

  61. 61

    What are the two main steps of policy iteration?

    Model answer

    First, policy evaluation computes VπV^\piVπ for the current policy. Second, policy improvement updates the policy to choose higher-value actions.

    Explanation

    These steps are repeated until the policy no longer changes.

  62. 62

    How does policy iteration perform policy evaluation?

    Model answer

    It solves the linear system for the current policy, using Vπ=(I−γPπ)−1RV^\pi=(I-\gamma P^\pi)^{-1}RVπ=(I−γPπ)−1R.

    Explanation

    Because the policy is fixed during evaluation, the Bellman equations are linear.

  63. 63

    What criterion can be used to determine whether policy iteration has converged?

    Model answer

    Policy iteration has converged when a full policy-improvement step makes no changes to the action selected in any state.

    Explanation

    At that point, the policy is stable and is the optimal policy under the stated assumptions.

  64. 64

    Compare the approximate computational costs of value iteration and policy iteration for a finite MDP.

    Model answer

    Value iteration is approximately O(∣S∣2∣A∣)O(|S|^2|A|)O(∣S∣2∣A∣) per update, while policy evaluation in policy iteration involves inverting an ∣S∣×∣S∣|S|\times|S|∣S∣×∣S∣ matrix and is approximately O(∣S∣3)O(|S|^3)O(∣S∣3).

    Explanation

    Policy iteration may therefore be more expensive per iteration for large state spaces.

  65. 65

    What is the main difference in the type of convergence achieved by value iteration and policy iteration?

    Model answer

    Value iteration approaches the optimal value function to an arbitrarily chosen precision but may not reach it exactly in finite updates, whereas policy iteration reaches the exact optimal policy and value after a finite number of policy changes.

    Explanation

    Once policy iteration's policy stops changing, its evaluated value function is the exact optimal value function.

  66. 66

    Can value iteration and policy iteration produce the same optimal solution?

    Model answer

    Yes. Both methods can produce the same optimal value function V∗V^*V∗ and optimal policy π∗\pi^*π∗, although they reach them through different update procedures.

    Explanation

    Value iteration repeatedly applies Bellman optimality updates, while policy iteration alternates evaluation and improvement.

1 of 66
Question 1 of 66

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent