lactationcurve
A package for fitting dairy animal lactation curves, evaluating lactation curve characteristics (LCCs) (time to peak, peak yield, cumulative yield, persistency), and computing 305-day milk yield using the ICAR guideline.
Contact: Meike van Leerdam, mbv32@cornell.edu
Authors: Meike van Leerdam, Douwe de Kok, Judith Osei-Tete, Lucia Trapanese
Initial authored: 2025‑08‑12
Updated: 2026-10-26
Lactation curves are widely used in dairy science to model milk production over time. They provide insights into the lactation performance of individual animals and herds, enabling better management decisions and genetic evaluations. The 305-day yield is a standard metric for assessing milk production, and accurate estimation of this yield is crucial for dairy farmers, researchers, and breeding programs.
The International Committee for Animal Recording (ICAR) provides guidelines outlining approved methods for the 305 day yield for milk, fat, and protein calculation. However, a global survey of milk recording organizations revealed substantial variation in how these methods are implemented. The Test Interval Method is used by 74% of the organizations, reflecting a preference for methodological simplicity, but it comes with trade-offs in estimation accuracy. The use of the other approved methods showed wide variation in correction factors, standard lactation curves, test day definitions, minimum sample requirements, and exclusion criteria. Such inconsistencies can introduce yield variability that complicates comparisons, for example in international breeding value evaluation, and limit the metric’s usefulness in universal models, such as decision support tools. Thus, the objective of this work was to reformulate the ICAR guideline section 2, procedure 2, into a unified, transparent, and accessible software implementation to improve standardization, enhance documentation, support continuous development, and increase the accuracy of 305 day yield estimation.
To achieve this, the ICAR guideline was translated into an open-source Python package that serves as a reference implementation for 305-day yield calculation, with lactation curve modelling at its core. In addition to the methods described in the original guideline, the package incorporates 14 lactation curve models, including both traditional and Bayesian fitting approaches as well as AI-based models. It also provides tools to derive biologically relevant characteristics such as time to peak, peak yield, cumulative yield, and persistency.
The framework can be directly integrated into analytical workflows, allowing users to calculate 305-day yields, fit and compare lactation curves, and derive key lactation characteristics through a single function call. These functionalities are further supported through an interactive website and an openly available GitHub repository. In addition, the project includes an online validation platform that enables users to use standardized lactation data to compare self-estimated 305-day yields against both reference calculations (from the package) and observed daily milk yields.
We encourage everyone to use, test, and contribute to the package, which is available under the AGPL-3.0-or-later license. We welcome feedback and suggestions for improvement, and we are committed to maintaining and updating the package to ensure it remains a valuable resource for the dairy industry and research community. For bug reports or feature requests, please submit them on the GitHub issues page or contact us directly via email.
What can this package do?
- Frequentist fitting of lactation curve models (numeric optimization):
- Wood, Wilmink, Ali & Schaeffer, Fischer, MilkBot
- Frequentist fitting of lactation curve models (algebraic least squares):
- MilkBot
- Bayesian fitting of the MilkBot lactation curve model via MilkBot API:
- MilkBot
- Calculate Lactation Curve Characteristics — symbolic + numeric:
- time_to_peak, peak_yield, cumulative_milk_yield, persistency
- Calculate cumulative milk yield over a lactation period:
- Test Interval Method (also called the Fleischmann method)
- Centering Date Method
- Interpolation Standard Lactation Curve (ISLC) Method
- Best Predict Method
- Data quality control for lactation curves:
- Input validation/normalization via
validate_and_prepare_inputs
- Input validation/normalization via
Main Lactation curve models implemented
Fischer: A combination of an exponential and a linear component, characterized by an early exponential phase followed by an approximately linear decline.
Wood: An incomplete gamma-type function combining a power-law growth term t^b with an exponential decay term e^(-ct).
Ali & Schaeffer: A linear regression model based on quadratic polynomials in standardized time (t/305) and in the log-transformed inverse time log(305/t), where the log term increases flexibility in modelling the ascending phase and peak of lactation.
Wilmink: A combination of an exponential and a linear component. In contrast to the Fischer model, the additional parameter scaling the exponential term increases flexibility in describing early-lactation dynamics and peak formation.
MilkBot: An empirical, mechanistically motivated four-parameter model describing lactation as the development and decay of udder capacity. It consists of a ramp-up phase and exponential decline, with parameters controlling scale, onset, growth rate, and decay. Both Bayesian and frequentist fitting approaches are implemented for the MilkBot model, allowing users to choose between traditional optimization methods and a probabilistic framework that incorporates prior knowledge.
Additional models available for a.o. symbolic lactation curve characteristics (LCC) derivations: Brody, Sikka, Nelder, Dhanoa, Emmans, Hayashi, Rook, Dijkstra, Prasad.
Model Formulas
- Wood :
y(t) = a * t^b * exp(-c * t) - Wilmink :
y(t) = a + b * t + c * exp(k * t)with defaultk = -0.05 - Ali & Schaeffer :
t_scaled = t / 305,L = ln(305 / t)y(t) = a + b*t_scaled + c*t_scaled^2 + d*L + k*L^2 - Fischer :
y(t) = a - b*t - a*exp(-c*t) - MilkBot :
y(t) = a * (1 - exp((c - t)/b) / 2) * exp(-d*t)
Package Structure
The package is organized into three main modules:
Core functions
The functions below are the main tools most users need. A lactation means the milk records belonging to one cow after one calving. A TestId is the label used to keep each lactation separate.
| Function | What it does | What it returns |
|---|---|---|
fit_lactation_curve |
Fits a mathematical curve to milk records and predicts milk yield for each day of the lactation. | A NumPy array of predicted daily yields. |
get_lc_parameters |
Finds the numerical parameters that describe a fitted lactation-curve model. | A tuple of model parameters. |
bayesian_fit_milkbot_single_lactation |
Fits the MilkBot model to one lactation using Bayesian statistics and prior knowledge. | A dictionary containing the fitted MilkBot parameters. |
lactation_curve_characteristic_function |
Prepares a function for calculating a lactation-curve characteristic, such as peak yield or time to peak. | A symbolic expression, parameter names, and a callable function. |
calculate_characteristic |
Calculates one lactation-curve characteristic from milk records or a fitted curve. | One number, such as peak yield, time to peak, or cumulative yield. |
test_interval_method |
Estimates total milk yield by calculating the area between consecutive test days. Use this for one or more lactations in a dataframe. | A dataframe with one cumulative milk-yield total per TestId. |
centering_date_method |
Estimates total milk yield by treating each monthly test-day yield as representative of a centered part of that calendar month. | A dataframe with one cumulative milk-yield total per TestId. |
ISLC_method |
Estimates the total yield by using a standard lactation curve to fill in missing test days from a predefined grid. | A dataframe with one cumulative milk-yield total per TestId. |
best_predict_method |
Estimates the total yield by using a standard lactation curve to fill in all missing test days. | A dataframe with one cumulative milk-yield total per TestId. |
For the dataframe-based methods, the result usually has two columns:
TestId identifies the lactation, and LactationMilkYield contains the
estimated cumulative milk yield. The yield uses the same unit as the input
records, such as kilograms or pounds.
The meaning of a TestId
The TestId is an identifier for a lactation,
which can be used to group records belonging to the same lactation together.
It is not the same as a cow ID, as a cow can have multiple lactations
(e.g., across different calvings).
If a TestId column is not provided,
the package will assume all records belong to a single lactation
and will create a TestId column with all values set to 0.
Minimum number of records per lactation needed per method
There are many different testing schemes and data collection protocols in the dairy industry, which can result in varying numbers of milk yield records per lactation. Furthermore, somethimes records are missing or excluded due to quality control, which can lead to incomplete lactation data. Or the other option is that the lactation is still ongoing and not all records are available yet. The minimum number of records needed to technically be able to calculate the 305-day yield depends on the method used:
- Test Interval Method: At least 2 records
- Centering Date Method: At least 2 records
- ISLC Method: The method can be applied to lactations without any measurements, in which case the result will be the population mean from the standard curve.
- Best Predict Method: The method can be applied to lactations without any measurements, in which case the result will be the population mean from the standard curve.
- Lactation curve models: In general you need at least one record more than the number of parameters in the model to be able to fit the model. So Wood and Fischer (3 parameters) need at least 4 records, Wilmink and MilkBot (4 parameters) need at least 5 records, Ali & Schaeffer (5 parameters) needs at least 6 records.
However, in practice it is recommended to have more records than the minimum to ensure a reliable fit and avoid overfitting. Ideally, the records should be well-distributed across the lactation period to capture the curve's shape accurately.
Often used abreviations
- DIM: Days in Milk (the days since calving in the current lactation)
- LC: Lactation Curve
- LCC: Lactation Curve Characteristic
- ISLC: Interpolation using the Standard Lactation Curve
- ICAR: International Committee for Animal Recording
- API: Application Programming Interface
Bayesian Fitting (MilkBot API)
- Set
fitting="bayesian"andmodel="milkbot"infit_lactation_curveorcalculate_characteristic. - Provide an API key via .env
Choose priors via custom_priors:
- "CHEN" → Chen et al. 2023 published priors
- dict → Custom priors in MilkBot format (overrides
continent) Custom priors have a specific format, to help you build them, use thebuild_priorhelper function. To make your own prior you need for each MilkBot parameter (scale,ramp,decay,onset) to specify a mean and a standard deviation (std). Also provide a standard deviation for milk yield through seMilk to specify the expected noise in the data. This seMilk is default set to 4 kg to reflect typical day-to-day variation in milk yield, but you can adjust it based on the expected variability in your data.
if no custom priors are provided, the default MilkBot priors will be used: In that case set cutsom_priors to None and specify the desired continent and breed. continent options:
- "USA" → MilkBot USA priors (default)
- "EU" → MilkBot EU priors > mainly estimates lower milk production
breed options:
- H → Holstein (default)
- J → Jersey
If also parity is provided, the continent-specific priors will be further refined by parity-specific priors. The priors are sensitive to the used metric. The default is kg, but if you use lb, specify milk_unit="lb" to use the appropriate priors.
The helper
bayesian_fit_milkbot_single_lactation(...)normalizes differing API responses.- The key can be requested by sending an email to Jim Ehrlich jehrlich@MilkBot.com.
- More information about the API can be found in the API documentation, or in the corresponding paper.
Tutorials
Hands-on programming example notebooks are available through GitHub tutorials and example notebooks. The tutorials will guide you through how to work with the package, including how to import the package, fit lactation curves, calculate 305-day yields, and derive lactation curve characteristics.
Available tutorials:
lactationcurve_pip_tutorial.ipynb: install the package, fit lactation curves, calculate characteristics, and apply the Test Interval Method.test_interval_method_tutorial.ipynb: calculate cumulative yield with the Test Interval Method and explore its settings.centering_date_method_tutorial.ipynb: calculate cumulative yield with the Centering Date Method for monthly test-day records.interpolation_using_standard_lactation_curve_tutorial.ipynb: calculate cumulative yield with the Interpolation Using Standard Lactation Curves method, fill gaps with standard lactation curves, compare interpolation methods, and use the method with your own data.best_predict_tutorial.ipynb: calculate cumulative yield with the best predict method, explore settings, and use the method with your own data.
Citing the lactationcurve package
If you use the lactationcurve package in your research, please consider citing it as follows:
van Leerdam, M. B., de Kok, D., Osei-Tete, J. A., & Hostens, M. (2026). Bovi-analytics/bovi: v.1.1.6. (v.1.1.6). Zenodo. https://doi.org/10.5281/zenodo.18715145
If you also use the Bayesian fitting functionality that relies on the MilkBot API, please also cite the following paper:
Ehrlich, J.L., 2013. Quantifying inter-group variability in lactation curve shape and magnitude with the MilkBot lactation model. PeerJ 1, e54. https://doi.org/10.7717/peerj.54
If you use the 305-day yield calculation methods based on the ICAR guideline, please also cite the following paper: Best Predict method: VanRaden, P. M. (1997). Lactation yields and accuracies computed from test day yields and (co) variances by best prediction. Journal of dairy science, 80(11), 3015-3022.
ISLC: Wilmink, J. B. M. (1987). Comparison of different methods of predicting 305-day milk yield using means calculated from within-herd lactation curves. Livestock Production Science, 17, 1-17.
Test Interval Method: Sargent, F. D., V. H. Lyton, and 0. G. Wall, J r . 1968. Test interval method of calculating Dairy Herd Improvement Association records. Journal of dairy science, 51-170.
Centering Date Method: *U.S. Department of Agriculture, Bureau of Dairying. (1925). Cow Testing Association Letter No. 1. Washington, DC.
License
Current version
0.1.dev1+g69a8552f9
1from importlib.metadata import PackageNotFoundError, version 2 3# import submodules to make them available at the package level 4from . import characteristics, fitting, preprocessing 5 6__all__ = ["fitting", "characteristics", "preprocessing"] 7 8try: 9 __version__ = version("lactationcurve") 10except PackageNotFoundError: 11 __version__ = "unknown" 12 13 14_core_functions_table = "\n".join( 15 [ 16 "| Function | What it does | What it returns |", 17 "|---|---|---|", 18 ( 19 "| `fit_lactation_curve` | Fits a mathematical curve to milk records " 20 "and predicts milk yield for each day of the lactation. | A NumPy " 21 "array of predicted daily yields. |" 22 ), 23 ( 24 "| `get_lc_parameters` | Finds the numerical parameters that describe " 25 "a fitted lactation-curve model. | A tuple of model parameters. |" 26 ), 27 ( 28 "| `bayesian_fit_milkbot_single_lactation` | Fits the MilkBot model to " 29 "one lactation using Bayesian statistics and prior knowledge. | A " 30 "dictionary containing the fitted MilkBot parameters. |" 31 ), 32 ( 33 "| `lactation_curve_characteristic_function` | Prepares a function " 34 "for calculating a lactation-curve characteristic, such as peak " 35 "yield or time to peak. | A symbolic expression, parameter names, " 36 "and a callable function. |" 37 ), 38 ( 39 "| `calculate_characteristic` | Calculates one lactation-curve " 40 "characteristic from milk records or a fitted curve. | One number, " 41 "such as peak yield, time to peak, or cumulative yield. |" 42 ), 43 ( 44 "| `test_interval_method` | Estimates total milk yield by calculating " 45 "the area between consecutive test days. Use this for one or more " 46 "lactations in a dataframe. | A dataframe with one cumulative " 47 "milk-yield total per `TestId`. |" 48 ), 49 ( 50 "| `centering_date_method` | Estimates total milk yield by treating " 51 "each monthly test-day yield as representative of a centered part of " 52 "that calendar month. | A dataframe with one cumulative milk-yield " 53 "total per `TestId`. |" 54 ), 55 ( 56 "| `ISLC_method` | Estimates the total yield by using a standard " 57 "lactation curve to fill in missing test days from a predefined " 58 "grid. | A dataframe with one cumulative milk-yield total per " 59 "`TestId`. |" 60 ), 61 ( 62 "| `best_predict_method` | Estimates the total yield by using a " 63 "standard lactation curve to fill in all missing test days. | A " 64 "dataframe with one cumulative milk-yield total per `TestId`. |" 65 ), 66 ] 67) 68 69 70__doc__ = f""" 71A package for fitting **dairy animal lactation curves**, evaluating 72**lactation curve characteristics (LCCs)** (time to peak, peak yield, 73cumulative yield, persistency), and computing **305-day milk yield** 74using the **ICAR guideline**. 75 76> **Contact:** Meike van Leerdam, mbv32@cornell.edu 77> 78> **Authors:** Meike van Leerdam, Douwe de Kok, Judith Osei-Tete, Lucia Trapanese 79 80> **Initial authored:** 2025‑08‑12 81 82> **Updated:** 2026-10-26 83 84--- 85 Lactation curves are widely used in dairy science to model milk production 86 over time. They provide insights into the lactation performance of individual 87 animals and herds, enabling better management decisions and genetic evaluations. 88 The 305-day yield is a standard metric for assessing milk production, 89 and accurate estimation of this yield is crucial for dairy farmers, researchers, 90 and breeding programs. 91 92 The International Committee for Animal 93 Recording (ICAR) provides guidelines outlining approved methods for 94 the 305 day yield for milk, fat, and protein calculation. 95 However, a global survey of milk recording 96 organizations revealed substantial variation in how these methods are 97 implemented. The Test Interval Method is used by 74% of the 98 organizations, reflecting a preference for methodological simplicity, 99 but it comes with trade-offs in estimation accuracy. The use of the 100 other approved methods showed wide variation in correction factors, 101 standard lactation curves, test day definitions, minimum sample 102 requirements, and exclusion criteria. Such inconsistencies can 103 introduce yield variability that complicates comparisons, for 104 example in international breeding value evaluation, and limit the 105 metric’s usefulness in universal models, such as decision support 106 tools. Thus, the objective of this work was to reformulate the ICAR 107 guideline section 2, procedure 2, into a unified, transparent, and 108 accessible software implementation to improve standardization, 109 enhance documentation, support continuous development, and increase 110 the accuracy of 305 day yield estimation. 111 112 To achieve this, the ICAR guideline was translated into an 113 open-source Python package that serves as a reference implementation 114 for 305-day yield calculation, with lactation curve modelling at its 115 core. In addition to the methods described in the original guideline, 116 the package incorporates 14 lactation curve models, including both 117 traditional and Bayesian fitting approaches as well as AI-based 118 models. It also provides tools to derive biologically relevant 119 characteristics such as time to peak, peak yield, cumulative yield, 120 and persistency. 121 122 The framework can be directly integrated into analytical workflows, 123 allowing users to calculate 305-day yields, fit and compare 124 lactation curves, and derive key lactation characteristics through a 125 single function call. These functionalities are further supported 126 through an interactive website and an openly available [GitHub 127 repository](https://github.com/Bovi-analytics/bovi). 128 In addition, the project includes an online validation 129 platform that enables users to use standardized lactation data to 130 compare self-estimated 305-day yields against both reference 131 calculations (from the package) and observed daily milk yields. 132 133 We encourage everyone to use, test, and contribute to the package, 134 which is available under the AGPL-3.0-or-later license. We welcome feedback and 135 suggestions for improvement, and we are committed to maintaining and 136 updating the package to ensure it remains a valuable resource 137 for the dairy industry and research community. 138 For bug reports or feature requests, please submit them on the 139 [GitHub issues page](https://github.com/Bovi-analytics/bovi/issues) 140 or contact us directly via [email](mbv32@cornell.edu). 141 142--- 143 144## What can this package do? 145 146- **Frequentist fitting of lactation curve models** (numeric optimization): 147 - Wood, Wilmink, Ali & Schaeffer, Fischer, MilkBot 148- **Frequentist fitting of lactation curve models** (algebraic least squares): 149 - MilkBot 150- **Bayesian fitting of the MilkBot lactation curve model via MilkBot API**: 151 - MilkBot 152- **Calculate Lactation Curve Characteristics** — symbolic + numeric: 153 - time_to_peak, peak_yield, cumulative_milk_yield, persistency 154- **Calculate cumulative milk yield over a lactation period**: 155 - Test Interval Method (also called the Fleischmann method) 156 - Centering Date Method 157 - Interpolation Standard Lactation Curve (ISLC) Method 158 - Best Predict Method 159- **Data quality control for lactation curves**: 160 - Input validation/normalization via `validate_and_prepare_inputs` 161 162--- 163 164## Main Lactation curve models implemented 165 166**Fischer**: 167A combination of an exponential and a linear component, characterized by an 168early exponential phase followed by an approximately linear decline. 169 170**Wood**: 171An incomplete gamma-type function combining a power-law growth term t^b with 172an exponential decay term e^(-ct). 173 174**Ali & Schaeffer**: 175A linear regression model based on quadratic polynomials in standardized time 176(t/305) and in the log-transformed inverse time log(305/t), where the log 177term increases flexibility in modelling the ascending phase and peak of 178lactation. 179 180**Wilmink**: 181A combination of an exponential and a linear component. In contrast to the 182Fischer model, the additional parameter scaling the exponential term increases 183flexibility in describing early-lactation dynamics and peak formation. 184 185**MilkBot**: 186An empirical, mechanistically motivated four-parameter model describing 187lactation as the development and decay of udder capacity. It consists of a 188ramp-up phase and exponential decline, with parameters controlling scale, 189onset, growth rate, and decay. 190Both Bayesian and frequentist fitting approaches are implemented for the 191MilkBot model, allowing users to choose between traditional optimization 192methods and a probabilistic framework that incorporates prior knowledge. 193 194Additional models available for a.o. symbolic lactation curve 195characteristics (LCC) derivations: 196**Brody**, **Sikka**, **Nelder**, **Dhanoa**, **Emmans**, 197**Hayashi**, **Rook**, **Dijkstra**, **Prasad**. 198 199--- 200 201## Model Formulas 202 203* **Wood** : `y(t) = a * t^b * exp(-c * t)` 204* **Wilmink** : `y(t) = a + b * t + c * exp(k * t)` with default `k = -0.05` 205* **Ali & Schaeffer** : `t_scaled = t / 305`, `L = ln(305 / t)` 206 `y(t) = a + b*t_scaled + c*t_scaled^2 + d*L + k*L^2` 207* **Fischer** : `y(t) = a - b*t - a*exp(-c*t)` 208* **MilkBot** : `y(t) = a * (1 - exp((c - t)/b) / 2) * exp(-d*t)` 209 210--- 211 212## Package Structure 213 214The package is organized into three main modules: 215 2161. `lactationcurve.fitting` 2172. `lactationcurve.characteristics` 2183. `lactationcurve.preprocessing` 219 220--- 221 222## Core functions 223 224The functions below are the main tools most users need. A **lactation** means 225the milk records belonging to one cow after one calving. A **TestId** is the 226label used to keep each lactation separate. 227 228{_core_functions_table} 229 230For the dataframe-based methods, the result usually has two columns: 231`TestId` identifies the lactation, and `LactationMilkYield` contains the 232estimated cumulative milk yield. The yield uses the same unit as the input 233records, such as kilograms or pounds. 234 235--- 236 237## The meaning of a TestId 238 239 240The `TestId` is an identifier for a lactation, 241which can be used to group records belonging to the same lactation together. 242It is not the same as a cow ID, as a cow can have multiple lactations 243(e.g., across different calvings). 244If a `TestId` column is not provided, 245the package will assume all records belong to a single lactation 246and will create a `TestId` column with all values set to 0. 247 248--- 249 250## Minimum number of records per lactation needed per method 251 252 253There are many different testing schemes and data collection protocols in the dairy industry, 254which can result in varying numbers of milk yield records per lactation. Furthermore, 255somethimes records are missing or excluded due to quality control, 256which can lead to incomplete lactation data. 257Or the other option is that the lactation is still ongoing and not all records are available yet. 258The minimum number of records needed to technically be able to calculate the 305-day yield 259depends on the method used: 260- Test Interval Method: At least 2 records 261- Centering Date Method: At least 2 records 262- ISLC Method: The method can be applied to lactations without any measurements, 263 in which case the result will be the population mean from the standard curve. 264- Best Predict Method: The method can be applied to lactations without any measurements, 265 in which case the result will be the population mean from the standard curve. 266- Lactation curve models: 267In general you need at least one record more than the number of parameters in the model 268 to be able to fit the model. So Wood and Fischer (3 parameters) need at least 4 records, 269 Wilmink and MilkBot (4 parameters) need at least 5 records, Ali & Schaeffer (5 parameters) 270 needs at least 6 records. 271 272 273However, in practice it is recommended to have more records than the minimum 274to ensure a reliable fit and avoid overfitting. 275Ideally, the records should be well-distributed across the lactation 276period to capture the curve's shape accurately. 277 278--- 279 280## Often used abreviations 281 282- **DIM**: Days in Milk (the days since calving in the current lactation) 283- **LC**: Lactation Curve 284- **LCC**: Lactation Curve Characteristic 285- **ISLC**: Interpolation using the Standard Lactation Curve 286- **ICAR**: International Committee for Animal Recording 287- **API**: Application Programming Interface 288 289 290--- 291 292## Bayesian Fitting (MilkBot API) 293 294* Set `fitting="bayesian"` and `model="milkbot"` in 295 `fit_lactation_curve` or `calculate_characteristic`. 296* Provide an **API key** via .env 297* Choose priors via custom_priors: 298 - "[CHEN](https://github.com/Bovi-analytics/Chen-et-al-2023b)" → Chen et al. 2023 299 published priors 300 - dict → Custom priors in MilkBot format (overrides `continent`) 301 Custom priors have a specific format, to help you build them, 302 use the `build_prior` helper function. To make your own prior you need 303 for each MilkBot parameter 304 (scale,ramp,decay,onset) to specify a mean and a standard deviation (std). 305 Also provide a standard deviation for milk yield through seMilk to 306 specify the expected noise in the data. 307 This seMilk is default set to 4 kg to reflect typical day-to-day variation in milk yield, 308 but you can adjust it based on the expected variability in your data. 309 310* if no custom priors are provided, the default MilkBot priors will be used: 311 In that case set cutsom_priors to None and specify the desired continent and breed. 312 continent options: 313 - "USA" → MilkBot USA priors (default) 314 - "EU" → MilkBot EU priors > mainly estimates lower milk production 315 316 breed options: 317 - H → Holstein (default) 318 - J → Jersey 319 320 If also parity is provided, the continent-specific priors will be 321 further refined by parity-specific priors. 322 The priors are sensitive to the used metric. The default is kg, but if you use lb, 323 specify milk_unit="lb" to use the appropriate priors. 324 325* The helper `bayesian_fit_milkbot_single_lactation(...)` 326 normalizes differing API responses. 327* The key can be requested by sending an email to Jim Ehrlich 328 [jehrlich@MilkBot.com](mailto:jehrlich@MilkBot.com). 329* More information about the API can be found in the 330 [API documentation](https://api.milkbot.com/), or in the 331 corresponding 332 [paper](https://peerj.com/articles/54/#MainContent). 333 334--- 335 336## Tutorials 337 338Hands-on programming example notebooks are available through 339*[GitHub tutorials and example notebooks](https://github.com/Bovi-analytics/bovi/tree/main/packages/models/lactationcurve/notebooks)*. 340The tutorials will guide you through how to work with the package, 341including how to import the package, fit lactation curves, 342calculate 305-day yields, and derive lactation curve characteristics. 343 344Available tutorials: 345 346- [`lactationcurve_pip_tutorial.ipynb`](https://github.com/Bovi-analytics/bovi/blob/main/packages/models/lactationcurve/notebooks/lactationcurve_pip_tutorial.ipynb): 347 install the package, fit lactation curves, calculate characteristics, 348 and apply the Test Interval Method. 349- [`test_interval_method_tutorial.ipynb`](https://github.com/Bovi-analytics/bovi/blob/main/packages/models/lactationcurve/notebooks/test_interval_method_tutorial.ipynb): 350 calculate cumulative yield with the Test Interval Method and explore 351 its settings. 352- [`centering_date_method_tutorial.ipynb`](https://github.com/Bovi-analytics/bovi/blob/main/packages/models/lactationcurve/notebooks/centering_date_method_tutorial.ipynb): 353 calculate cumulative yield with the Centering Date Method for monthly 354 test-day records. 355- [`interpolation_using_standard_lactation_curve_tutorial.ipynb`](https://github.com/Bovi-analytics/bovi/blob/main/packages/models/lactationcurve/notebooks/interpolation_using_standard_lactation_curve_tutorial.ipynb): 356 calculate cumulative yield with the Interpolation Using Standard Lactation Curves method, 357 fill gaps with standard lactation curves, compare interpolation methods, 358 and use the method with your own data. 359- [`best_predict_tutorial.ipynb`](https://github.com/Bovi-analytics/bovi/blob/main/packages/models/lactationcurve/notebooks/best_predict_tutorial.ipynb): 360 calculate cumulative yield with the best predict method, explore settings, 361 and use the method with your own data. 362 363 364--- 365## Citing the lactationcurve package 366 367If you use the `lactationcurve` package in your research, please consider citing it as follows: 368 369*van Leerdam, M. B., de Kok, D., Osei-Tete, J. A., & 370Hostens, M. (2026). Bovi-analytics/bovi: 371v.1.1.6. (v.1.1.6). Zenodo. 372https://doi.org/10.5281/zenodo.18715145* 373 374 375If you also use the Bayesian fitting functionality that relies 376on the MilkBot API, please also cite the following paper: 377 378*Ehrlich, J.L., 2013. Quantifying inter-group variability 379in lactation curve shape and magnitude with the MilkBot 380lactation model. PeerJ 1, e54. 381https://doi.org/10.7717/peerj.54* 382 383If you use the 305-day yield calculation methods based on the ICAR guideline, 384please also cite the following paper: 385Best Predict method: 386*VanRaden, P. M. (1997). Lactation yields and accuracies computed from test 387day yields and (co) variances by best prediction. 388Journal of dairy science, 80(11), 3015-3022.* 389 390ISLC: 391*Wilmink, J. B. M. (1987). 392Comparison of different methods of predicting 305-day milk yield using means 393calculated from within-herd lactation curves. Livestock Production Science, 17, 1-17.* 394 395Test Interval Method: 396*Sargent, F. D., V. H. Lyton, and 0. G. Wall, J r . 1968. 397Test interval method of calculating Dairy Herd Improvement Association records. 398Journal of dairy science, 51-170.* 399 400Centering Date Method: 401*U.S. Department of Agriculture, Bureau of Dairying. (1925). 402Cow Testing Association Letter No. 1. Washington, DC. 403 404 405--- 406 407## License 408 409[GNU AGPLv3 License](https://github.com/Bovi-analytics/bovi/blob/main/LICENSE) 410 411--- 412 413## Current version 414 415{__version__} 416 417"""