Berserk Docs
Scalar FunctionsSeries Functions

series_fit_2lines_dynamic

Piecewise-linear best fit of a numeric series with change-point search.

Returns a property bag shaped like Microsoft Kusto's output: { split_idx, rsquare, left: { slope, interception, rsquare }, right: { slope, interception, rsquare }, line_fit: [fitted values…] }. An absent element (null) makes the result null, including for inputs too short to fit.

Syntax

series_fit_2lines_dynamic(series)

Parameters

Prop

Type

Returns: dynamic

Examples

Example 1

print series_fit_2lines_dynamic(dynamic([1.0, 2.0, 3.0, 4.0, 10.0, 20.0, 30.0, 40.0]))
print_0 (dynamic)
{"left":{"interception":1.0,"rsquare":1.0,"slope":1.0},"line_fit":[1.0,2.0,3.0,4.0,10.0,20.0,30.0,40.0],"right":{"interception":-30.0,"rsquare":1.0,"slope":10.0},"rsquare":1.0,"split_idx":4}

On this page