MilkBot lactation API (1.4.0)

Download OpenAPI specification:Download

MilkBot Fitting

This service uses the MilkBot fitting engine to fit the MilkBot model to lactation data. The returned parameter set can be substituted into the MilkBot equation

((1 - E^((offset - t)/ramp)/2)*scale)/E^(decay X t)

to generate predicted milk production at any time in the lactation, where t is time since calving (in days, DIM=0 at calving) and E is Euler's number.

Simple formulas described at the support URL can calculate persistence, M305, or cumulative milk between dates. For a fuller description of the model see Quantifying inter-group variability in lactation curve shape and magnitude with the MilkBot® lactation model

API Keys

To use this service, a valid API key must be in a X-API-Key header of each request. For a free API Key, contact Jim Ehrlich jehrlich@MilkBot.com

Priors Tree

The fitting process uses Bayesian prior expectations as the expected means and standar deviation of parameter values as well as expected sd of fitting error. If priors are provided, they will be used. Otherwise default values based on breed and parity will be used. Use GET /priorsTree to see default priors. The PriorsTree uses a discriminator at each node to value lactations to an appropriate Priors.

Customizing

  • Priors It is easy to generate a customized PriorsTree by fitting a training set of lactations, then using the averages from that set as the priors for future fittings.
  • Options The optional Options object may be included with a FittingJob to control what data is returned.
  • Milk Units Milk values may be in Kg (the default) or pounds (by specifying "milkUnit": "Lb")

Data constraints

  • Fitting Jobs may exceed the maximum memory available to the fitting function. If that becomes a problem please contact us and we will consider increasing the memory pool. A Workaround is to fit in small batches or as individual lactations.

Fit single lactation

Fit a single lactation from the supplied array of (DIM, milk weight) data pairs using a default tree of Bayesian priors stratified by on breed and parity.

Authorizations:
ApiKeyAuth
Request Body schema: application/json

a single lactation

required
object (Lactation)

A single lactation of any length.

object (Priors)

Optional Bayesian prior expectations for use by fitting engine. If not provided, defaults based on breed and parity will be used. means are the expected mean parameter values for the population and sd are expected standard deviation of parameter values for the population seMilk is expected standard error of milk measurements excluding the effects of a normal lactation curve

Responses

Request samples

Content type
application/json
{
  • "lactation": {
    },
  • "priors": {
    }
}

Response samples

Content type
application/json
{
  • "lacKey": "string",
  • "fittedParams": {
    },
  • "lactation": {
    },
  • "priors": {
    },
  • "seMilk": 0,
  • "path": [
    ]
}

Fit a list of lactations.

Fit a group of lactations returning fitted parameter values. If 'priors' are supplied they will be used. Otherwise fitting will be done from defaults.

Authorizations:
ApiKeyAuth
Request Body schema: application/json
required
object (FittingJob)

A set of lactations to fit with optional priors tree and fit options..

Responses

Request samples

Content type
application/json
{
  • "fittingJob": {
    }
}

Response samples

Content type
application/json
[
  • {
    }
]

version number of server

Get the current version number of the server

Authorizations:
ApiKeyAuth

Responses

Response samples

Content type
application/json
"string"

Get default tree of prior expectations

Get the default Priors that will be used if an alternative is not supplied by the user

Authorizations:
ApiKeyAuth

Responses

Response samples

Content type
application/json
{
  • "scale": 25.3,
  • "ramp": 20,
  • "offset": 0,
  • "decay": 0.02,
  • "milkUnit": {
    }
}