There are no prerequisites for this page
In mathematics, a \(\htmlId{tooltip-integer}{k}^{th}\)-order polynomial offers a way to model relationships between an input variable and an output. The order of a polynomial plays a crucial role in its flexibility. A first-order polynomial (\( \htmlId{tooltip-integer}{k} \) = 1) represents a linear relationship—a straight line. As the order increases, the polynomial gains the ability to model more complex, nonlinear patterns within the data. However, this increased flexibility comes with a potential trade-off in the context of machine learning.
Overfitting occurs when a model becomes overly complex and attuned to the specific details and noise within the training data. A high-order polynomial might perfectly fit all of the training points but fail to generalize well to new, unseen examples. Conversely, underfitting happens when a model is too simple to capture the underlying pattern in the data. A first-order polynomial might not be able to sufficiently model a complex relationship, leading to poor predictions.
\(p\) | This symbol represents a polynomial. |
\(k\) | This symbol represents any given integer, \( k \in \htmlId{tooltip-setOfIntegers}{\mathbb{Z}}\). |
\(\omega\) | This symbol represents some given constant in a polynomial, \( \htmlId{tooltip-polynomial}{p} \), for the \(\htmlId{tooltip-integer}{k}^{th}\) order term. |
\(u\) | This symbol denotes the input of a model. |
Suppose we want to model the \(sin\) function using an arbitrary method for solving the coefficient weights \(w\). To highlight the problems of curve fitting, we will only use a few points in our training data which are randomly sampled from \(sin\). In the figure below, the blue line represents the prediction of our model and the green line, the true sin function.
Using (\( \htmlId{tooltip-integer}{k} \) = 1), we only obtain a straight line. As expected, this does not model the \(sin\) function very well. Since the errors of the predictions are high concerning the training data, we refer to this phenomenon as underfitting.
With (\( \htmlId{tooltip-integer}{k} \) = 3), we achieve a good fit. The model's curve more closely follows the shape of the true sin function. This demonstrates how a well-chosen polynomial order can capture the underlying pattern in the data without excessive complexity.
When (\( \htmlId{tooltip-integer}{k} \) = 5), we observe overfitting. While the model might pass nearly perfectly through all the training points, its curve exhibits erratic fluctuations that deviate significantly from the true \(sin\) function. This highlights how an overly complex model can become too attuned to the noise in the training data, failing to generalize well to unseen examples.
Was this page helpful?