Answers.Body: <blockquote>
    <p>The language used here is confusing me, because it is discussing a "distribution", as in a "probability distribution", but then refers to inputs, which are data gathered from outside of any probability distribution. Based on the limited information my studying of machine learning has taught me so far, my understanding is that the machine learning algorithm (or, rather, some machine learning algorithms) uses training data to implicitly construct some probability distribution, right? So is this what it is referring to here?</p>
  </blockquote>
  
  <p>They're not referring to probability distributions of training data that ML algorithms (implicitly) construct here. The main point of confusion seems to be where you state this:</p>
  
  <blockquote>
    <p>but then refers to inputs, which are data gathered from outside of any probability distribution</p>
  </blockquote>
  
  <p><strong>Any</strong> data / inputs ever collected <strong>always</strong> originate from <em>some</em> distribution. We will typically not exactly know what that distribution is, we are often not able to provide a clean expression for it, and it might not even be a nice "smooth" distribution, but that doesn't mean it doesn't exist. </p>
  
  <p>If I collect a large number of photographs of <span class="math-container">$H \times W$</span> pixels of streets for the purpose of training a self-driving car, then this collection of training data was collected from <em>some</em> distribution. For each of the pixels in the <span class="math-container">$H \times W$</span> plane, there exists some probability distribution that tells us how likely it is for such a pixel to have a certain colour under the data collection procedure that was used to generate our data. This is a largely unknown distribution, for which we don't have a nice mathematical expression, but it does exist. I assume that, in this distribution, it's relatively likely for pixels in the centre to be gray (because streets tend to be gray and we collected data by taking photographs of streets). I also guess it's relatively likely for pixels at the top of the images to be blue, because of the sky. Other than that, we can't say much about the distribution, but it does exist.</p>
  
  <blockquote>
    <p>Is the "distribution of inputs we expect the system to encounter in practice" the so called "test set"?</p>
  </blockquote>
  
  <p>Kind of, yeah. Although I suppose the "test set" is mostly a thing in academic settings, where we use a test set to evaluate how well an approach performs on data that it did not observe during training. In the "real world", the distribution of inputs we expect the system to encounter in practice refers to the distribution that generates samples we encounter after "deployment" of the model. For example, this could be the distribution over all images that a self-driving car may encounter when driving anywhere in the world.</p>
  
  <p>Continuing with the self-driving car example, we may get a large generalization error if we only train it on images of streets in one particular city or country, but then afterwards have it drive in many different cities or countries around the world (which may look very different).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-04T15:25:53.783Z
Answers.LastActivityDate: 2020-03-04T15:25:53.783Z
Answers.UserDisplayName: Dennis Soemers
Answers.Body: <p>For illustration, I use the dog/cat classification task. Suppose, the training data of cat and dog follows the Gaussian distribution(for simplicity) and we trained a model which gives an accuracy as below.</p>
  
  <ul>
  <li>train - 98.2% </li>
  <li>val - 97.7% </li>
  <li>test - 97.2%</li>
  </ul>
  
  <p>The model is neither overfitting nor underfitting but we want the classifier to achieve an accuracy of 100%  in all the three sets theoretically. You are right that the model learns the distribution of training data to classify the classes. Due to the overlapping of fat-tail in the distribution of cat and dog, it is highly impossible for the model to get 100% accuracy practically. There will be infinite edge cases that we encounter in reality so we can only improve the model by an iterative approach.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-04T15:31:09.607Z
Answers.LastActivityDate: 2020-03-04T15:31:09.607Z
Answers.UserDisplayName: Sudhakar17
Body: <p>I am currently studying <em>Deep Learning</em> by Goodfellow, Bengio, and Courville. In chapter <strong>5.2 Capacity, Overfitting and Underfitting</strong>, the authors say the following:</p>
  
  <blockquote>
    <p>Typically, when training a machine learning model, we have access to a training set; we can compute some error measure on the training set, called the <strong>training error</strong>; and we reduce this training error. So far, what we have described is simply an optimization problem. What separates machine learning from optimization is that we want the <strong>generalization error</strong>, also called the <strong>test error</strong>, to be low as well. The generalization error is defined as the expected value of the error on a new input. Here the expectation is taken across different possible inputs, drawn from the distribution of inputs we expect the system to encounter in practice. </p>
  </blockquote>
  
  <p>I found this part unclear:</p>
  
  <blockquote>
    <p>Here the expectation is taken across different possible inputs, drawn from the distribution of inputs we expect the system to encounter in practice. </p>
  </blockquote>
  
  <p>The language used here is confusing me, because it is discussing a "distribution", as in a "probability distribution", but then refers to inputs, which are data gathered from outside of any probability distribution. Based on the limited information my studying of machine learning has taught me so far, my understanding is that the machine learning algorithm (or, rather, <em>some</em> machine learning algorithms) uses training data to implicitly construct some probability distribution, right? So is this what it is referring to here? Is the "distribution of inputs we expect the system to encounter in practice" the so called "test set"? I would greatly appreciate it if people would please take the time to clarify this.</p>
  
Tags: <machine-learning><probability-distribution><generalization>
Title: What does "the expectation is taken across different possible inputs, drawn from the distribution of inputs we expect the system to encounter" mean?
UserDisplayName: The Pointer
ThreadText: # What does "the expectation is taken across different possible inputs, drawn from the distribution of inputs we expect the system to encounter" mean?
  
  (Asked by: username_0 on 2020-03-02)
  
  I am currently studying *Deep Learning* by Goodfellow, Bengio, and Courville. In chapter **5.2 Capacity, Overfitting and Underfitting**, the authors say the following:
  
  > Typically, when training a machine learning model, we have access to a training set; we can compute some error measure on the training set, called the **training error**; and we reduce this training error. So far, what we have described is simply an optimization problem. What separates machine learning from optimization is that we want the **generalization error**, also called the **test error**, to be low as well. The generalization error is defined as the expected value of the error on a new input. Here the expectation is taken across different possible inputs, drawn from the distribution of inputs we expect the system to encounter in practice.
  
  I found this part unclear:
  
  > Here the expectation is taken across different possible inputs, drawn from the distribution of inputs we expect the system to encounter in practice.
  
  The language used here is confusing me, because it is discussing a "distribution", as in a "probability distribution", but then refers to inputs, which are data gathered from outside of any probability distribution. Based on the limited information my studying of machine learning has taught me so far, my understanding is that the machine learning algorithm (or, rather, *some* machine learning algorithms) uses training data to implicitly construct some probability distribution, right? So is this what it is referring to here? Is the "distribution of inputs we expect the system to encounter in practice" the so called "test set"? I would greatly appreciate it if people would please take the time to clarify this.
  
  **Tags:** machine-learning, probability-distribution, generalization
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-03-04. Score: 2 | Accepted answer
  
  > The language used here is confusing me, because it is discussing a "distribution", as in a "probability distribution", but then refers to inputs, which are data gathered from outside of any probability distribution. Based on the limited information my studying of machine learning has taught me so far, my understanding is that the machine learning algorithm (or, rather, some machine learning algorithms) uses training data to implicitly construct some probability distribution, right? So is this what it is referring to here?
  
  They're not referring to probability distributions of training data that ML algorithms (implicitly) construct here. The main point of confusion seems to be where you state this:
  
  > but then refers to inputs, which are data gathered from outside of any probability distribution
  
  **Any** data / inputs ever collected **always** originate from *some* distribution. We will typically not exactly know what that distribution is, we are often not able to provide a clean expression for it, and it might not even be a nice "smooth" distribution, but that doesn't mean it doesn't exist.
  
  If I collect a large number of photographs of $H \times W$ pixels of streets for the purpose of training a self-driving car, then this collection of training data was collected from *some* distribution. For each of the pixels in the $H \times W$ plane, there exists some probability distribution that tells us how likely it is for such a pixel to have a certain colour under the data collection procedure that was used to generate our data. This is a largely unknown distribution, for which we don't have a nice mathematical expression, but it does exist. I assume that, in this distribution, it's relatively likely for pixels in the centre to be gray (because streets tend to be gray and we collected data by taking photographs of streets). I also guess it's relatively likely for pixels at the top of the images to be blue, because of the sky. Other than that, we can't say much about the distribution, but it does exist.
  
  > Is the "distribution of inputs we expect the system to encounter in practice" the so called "test set"?
  
  Kind of, yeah. Although I suppose the "test set" is mostly a thing in academic settings, where we use a test set to evaluate how well an approach performs on data that it did not observe during training. In the "real world", the distribution of inputs we expect the system to encounter in practice refers to the distribution that generates samples we encounter after "deployment" of the model. For example, this could be the distribution over all images that a self-driving car may encounter when driving anywhere in the world.
  
  Continuing with the self-driving car example, we may get a large generalization error if we only train it on images of streets in one particular city or country, but then afterwards have it drive in many different cities or countries around the world (which may look very different).
  
  
  ---
  
  ### Answer by username_2 on 2020-03-04. Score: 0
  
  For illustration, I use the dog/cat classification task. Suppose, the training data of cat and dog follows the Gaussian distribution(for simplicity) and we trained a model which gives an accuracy as below.
  
  * train - 98.2%
  * val - 97.7%
  * test - 97.2%
  
  The model is neither overfitting nor underfitting but we want the classifier to achieve an accuracy of 100% in all the three sets theoretically. You are right that the model learns the distribution of training data to classify the classes. Due to the overlapping of fat-tail in the distribution of cat and dog, it is highly impossible for the model to get 100% accuracy practically. There will be infinite edge cases that we encounter in reality so we can only improve the model by an iterative approach.
  
  
  ---
  
  