2
$\begingroup$

I read the following from a book:

You can intuitively understand the dimensionality of your representation space as “how much freedom you’re allowing the model to have when learning internal representations.” Having more units (a higher-dimensional representation space) allows your model to learn more-complex representations, but it makes the model more computationally expensive and may lead to learning unwanted patterns (patterns that will improve performance on the training data but not on the test data).

Why does using a higher representation space lead to performance increase on the training data but not on the test data?

Surely the representations/patterns learnt in the training data will be found too in the test data.

$\endgroup$
3
  • 1
    $\begingroup$ The idea is memorizing something without understanding will lead to failure in solving future problems. The answer to your question can be simply explained as "overfitting". But that's a very general answer (and will most likely be given as the cause by someone below), but there's some involved theory to show what is said is actually true which can't be explained in an answer (whole chapters are devoted to such topics). $\endgroup$
    – user9947
    Sep 1, 2020 at 0:40
  • $\begingroup$ Which book did you read that from? $\endgroup$
    – nbro
    Sep 1, 2020 at 11:22
  • $\begingroup$ I read it from "Deep Learning with Python" by François Chollet. You can also read it here: rpubs.com/kennyboy/503107 $\endgroup$ Sep 1, 2020 at 23:19

1 Answer 1

1
$\begingroup$

The answer to your question is that the capacity of your model (i.e. the number and type of function that your model can compute) generally increases with the number of parameters. So, a bigger model can potentially approximate better the function represented by your training data, but, at the same time, it may not take into account the test data, a phenomenon known as over-fitting the training data (i.e. fitting "too much" the training data).

In theory, you want to fit the training data perfectly, so over-fitting should not make sense, right? The problem is that, if we just fit all the (training) data, there is no way of empirically checking that our model will perform well on unseen data, i.e. will it generalize to data not seen during training? We split our data into training and test data because of this: we want to understand whether our model will perform well also on unseen data or not.

There are also some theoretical bounds that ensure you that, probabilistically and approximately, you can generalize: if you have more training data than a certain threshold, the probability that you perform badly is small. However, these theoretical bounds are often not taken into account in practice because, for example, we may not be able to collect more data to ensure that the bounds are satisfied.

Surely the representations/patterns learnt in the training data will be found too in the test data.

This is possibly the wrong assumption and the reason why you are confused. You may assume that both your training data and test data come from the same distribution $p(x, y)$, but it does not necessarily mean that they have the same patterns. For example, I can sample e.g. 13 numbers from a Gaussian $N(0, 1)$, the first 10 numbers could be very close to $0$ and the last $3$ could be close to $1$. If you split this data so that your training data contains different patterns than the test data, then it is not guaranteed that you will perform well also on the test data.

Finally, note that, in supervised learning, our ultimate goal when we fit models to labeled data is to learn a function (or a probability distribution over functions), where we often assume that both the training and test data are input-output pairs from our unknown target function, i.e. $y_i = f(x_i)$, where $(x_i, y_i) \in D$ (where $D$ is your labelled dataset), and $f$ is the unknown target function (i.e. the function we want to compute with our model), so, if our model performs well on the training data but not on the test data and we assume that both training and test data come from the same function $f$, there is no way that our model is computing our target function $f$ if it performs badly on the test data.

$\endgroup$
1
  • 1
    $\begingroup$ Fantastic explanation! Thank you. $\endgroup$ Sep 1, 2020 at 23:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .