MilkBot® Fitting

An important piece of MilkBot® technology is the fitting engine which calculates a lactation curve to fit a set of data points. There are several different fitting algorithms which may be used, and in most cases, MilkBot does a good job of choosing an appropriate algorithm automatically. Still, there are cases where a particular fitting method is more or less appropriate to the intended use of the result. What constitutes a "best fit" warrants some discussion.

For an incomplete lactation, the "best" fit is generally the one that predicts future production most accurately. "Most accurately" we take to mean "with minimum standard error", though here too there is room for alternative views. One approach is to assume that the fit with lowest standard error is best, but this is not really the case. To explain why this is true, it is necessary to understand what have been called "maximum liklihood" fitting techniques.

Let us consider the extreme case where we want to draw a curve based on a single data point. We can make a curve go exactly through that point (zero standard error) by adjusting any one of the parameter values. The curve at right is MilkBot's first guess. It looks reasonable. Standard error is 0.06, extremely low.


But if we want to improve that standard error, we can. For the green curve we manually adjusted parameters to get a standard error of zero. Is this an improvement? Which curve is most likely to predict future production accurately?

MilkBot is smart enough to prefer the blue curve because it knows that a persistence value of 2,000 , or a ramp of 100, is not very likely in real lactations.


When we add another point, MilkBot adjusts its estimate slightly (the blue curve) yielding standard error of 1.93. The manually fitted green curve achieves standard error of .02, but MilkBot knows the shape is unlikely. It has made that judgement based on historical knowledge of the distribution of parameter values in a normal population.


Addition of third and fourth points calls for another minor adjustment. By this point it seems clear that MilkBot made sensible guesses. Early projections, even from a single data point, are turning out to have been quite accurate.


This "intelligent" fitting by the MilkBot fitting engine depends on learned knowledge of what shapes to expect in lactation curves. This knowledge base can be customized. For example, first lactations are generally more persistent than later lactations. MilkBot can easily make use of knowledge of this type in selecting and tuning a fitting algorithm.