MarkLogic 9 Product Documentation
math:linear-model-coeff

math:linear-model-coeff(
   $linear-model as math:linear-model
) as xs:double*

Summary

Returns the coefficients of the linear model. Currently only simple linear regression model is supported so the return should contain only one coefficient (also called "slope").

Parameters
linear-model A linear model.

Example

  let $array :=
    for $i in (1 to 10)
    let $j := 2*$i + 1
    return json:to-array(($j,$i))
  let $lm := math:linear-model($array)
  return math:linear-model-coeff($lm)

  => 2
Powered by MarkLogic Server | Terms of Use | Privacy Policy