Skip to content

modsim/OverfittingExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This code provides an example of how overfitting can occurr, even if a "correct" model is used, if insufficient data is at hand.

Explanation of the figure produced by the code:

In all subplots, the solid blue line shows the function f(x) = 10*sin(pi*x) + 20*sin(pi*x*2) + 2*sin(pi*x*11). The black dots represent simulated measurements from the function f(x), with added gaussian noise: 12 measurements in the upper row and 24 in the lower row. The dashed orange curves represents fits to the simulated measurements using differen trigonometric polynomials : a*sin(pi*x) in column A, a*sin(pi*x) + b*sin(pi*x*2) in column B and a*sin(pi*x) + b*sin(pi*x*2) + c*sin(pi*x*11) in column C.


The example is part of the manuscript "Ockham’s Razor in Biology: Keeping It Simple" by A. Theorell, K. Nöh, A. Rocco and JJ. McFadden, distributed under the CC-BY license.To run the code, execute the script "main.m" in Matlab. Note that the graphs produced take random data as input, and thus differ slightly between consecutive runs.  


About

A small matlab example demonstrating how complex models lead to overfitting.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages