Skip to main content
added 11 characters in body
Source Link
dipetkov
  • 10.7k
  • 2
  • 20
  • 56

You don't provide a minimal reproducible example, so there is room for one more guess about the issue you report.

In a comment you say that you are working with 100 data points. So when you do 3-fold cross validation you end up training the model on 66, 67 and 67 points and evaluating it on another 34, 33 and 33 data points.

Obviously that's not much data to train a model on. The polynomial features compound the issuemake it even more challenging because polynomials are bad at extrapolating outside of the observed range.

So my stab at what's happening is that: (a) your data is small, so the in-fold range and the out-fold range of the predictor(s) end up being "different enough"; (b) you use polynomials which are bad at extrapolating outside of the range of the predictor(s) observed during training; and (c) you compound the problem with the intrinsic variability/instability of high-degree polynomials by using a different 3-fold split for each polynomial degree.

PS: There is another issue with how you do cross validation: You normalize the entire training data first, using all 100 points. However, the normalization step (I assume this is mean 0, variance 1 scaling?) is part of the modeling pipeline, so it should be cross validated as well.

You don't provide a minimal reproducible example, so there is room for one more guess about the issue you report.

In a comment you say that you are working with 100 data points. So when you do 3-fold cross validation you end up training the model on 66, 67 and 67 points and evaluating it on another 34, 33 and 33 data points.

Obviously that's not much data to train a model on. The polynomial features compound the issue because polynomials are bad at extrapolating outside of the observed range.

So my stab at what's happening is that: (a) your data is small, so the in-fold range and the out-fold range of the predictor(s) end up being "different enough"; (b) you use polynomials which are bad at extrapolating outside of the range of the predictor(s) observed during training; and (c) you compound the problem with the intrinsic variability/instability of high-degree polynomials by using a different 3-fold split for each polynomial degree.

PS: There is another issue with how you do cross validation: You normalize the entire training data first, using all 100 points. However, the normalization step (I assume this is mean 0, variance 1 scaling?) is part of the modeling pipeline, so it should be cross validated as well.

You don't provide a minimal reproducible example, so there is room for one more guess about the issue you report.

In a comment you say that you are working with 100 data points. So when you do 3-fold cross validation you end up training the model on 66, 67 and 67 points and evaluating it on another 34, 33 and 33 data points.

Obviously that's not much data to train a model on. The polynomial features make it even more challenging because polynomials are bad at extrapolating outside of the observed range.

So my stab at what's happening is that: (a) your data is small, so the in-fold range and the out-fold range of the predictor(s) end up being "different enough"; (b) you use polynomials which are bad at extrapolating outside of the range of the predictor(s) observed during training; and (c) you compound the problem with the intrinsic variability/instability of high-degree polynomials by using a different 3-fold split for each polynomial degree.

PS: There is another issue with how you do cross validation: You normalize the entire training data first, using all 100 points. However, the normalization step (I assume this is mean 0, variance 1 scaling?) is part of the modeling pipeline, so it should be cross validated as well.

added 329 characters in body
Source Link
dipetkov
  • 10.7k
  • 2
  • 20
  • 56

You don't provide a minimal reproducible example, so there is room for one more guess about the issue you report.

In a comment you say that you are working with 100 data points. So when you do 3-fold cross validation you end up training the model on 66, 67 and 67 points and evaluating it on another 34, 33 and 33 data points.

Obviously that's not much data to train a model on. The polynomial features compound the issue because polynomials are bad at extrapolating outside of the observed range.

So my stab at what's happening is that: (a) your data is small, so the in-fold range and the out-fold range of the predictor(s) end up being "different enough"; (b) you use polynomials which are bad at extrapolating outside of the range of the predictor(s) observed during training; and (c) you compound the problem with the intrinsic variability/instability of high-degree polynomials by using a different 3-fold split for each polynomial degree.

PS: There is another issue with how you do cross validation: You normalize the entire training data first, using all 100 points. However, the normalization step (I assume this is mean 0, variance 1 scaling?) is part of the modeling pipeline, so it should be cross validated as well.

You don't provide a minimal reproducible example, so there is room for one more guess about the issue you report.

In a comment you say that you are working with 100 data points. So when you do 3-fold cross validation you end up training the model on 66, 67 and 67 points and evaluating it on another 34, 33 and 33 data points.

Obviously that's not much data to train a model on. The polynomial features compound the issue because polynomials are bad at extrapolating outside of the observed range.

So my stab at what's happening is that: (a) your data is small, so the in-fold range and the out-fold range of the predictor(s) end up being "different enough"; (b) you use polynomials which are bad at extrapolating outside of the range of the predictor(s) observed during training; and (c) you compound the problem with variability/instability by using a different 3-fold split for each polynomial degree.

You don't provide a minimal reproducible example, so there is room for one more guess about the issue you report.

In a comment you say that you are working with 100 data points. So when you do 3-fold cross validation you end up training the model on 66, 67 and 67 points and evaluating it on another 34, 33 and 33 data points.

Obviously that's not much data to train a model on. The polynomial features compound the issue because polynomials are bad at extrapolating outside of the observed range.

So my stab at what's happening is that: (a) your data is small, so the in-fold range and the out-fold range of the predictor(s) end up being "different enough"; (b) you use polynomials which are bad at extrapolating outside of the range of the predictor(s) observed during training; and (c) you compound the problem with the intrinsic variability/instability of high-degree polynomials by using a different 3-fold split for each polynomial degree.

PS: There is another issue with how you do cross validation: You normalize the entire training data first, using all 100 points. However, the normalization step (I assume this is mean 0, variance 1 scaling?) is part of the modeling pipeline, so it should be cross validated as well.

Source Link
dipetkov
  • 10.7k
  • 2
  • 20
  • 56

You don't provide a minimal reproducible example, so there is room for one more guess about the issue you report.

In a comment you say that you are working with 100 data points. So when you do 3-fold cross validation you end up training the model on 66, 67 and 67 points and evaluating it on another 34, 33 and 33 data points.

Obviously that's not much data to train a model on. The polynomial features compound the issue because polynomials are bad at extrapolating outside of the observed range.

So my stab at what's happening is that: (a) your data is small, so the in-fold range and the out-fold range of the predictor(s) end up being "different enough"; (b) you use polynomials which are bad at extrapolating outside of the range of the predictor(s) observed during training; and (c) you compound the problem with variability/instability by using a different 3-fold split for each polynomial degree.