Skip to content

FindFit ​

Generated from the engine's own definition: compute-engine's symbol, which we neither extend nor document by hand. No examples yet — the crosswalk is the reason it has a page.

Nonlinear least-squares fit of a model to data. FindFit(data, model, params, vars): fit model (an expression in vars and the parameters) to data, a list of (x…, y) tuples or a plain list of y values. Each parameter spec is a bare symbol, (a, a0), or (a, a0, lo, hi) with box constraints. Returns a record {parameters, converged, residualNorm, iterations}. converged is true at a stationary point of the sum of squared residuals (a minimum of the misfit, which is not zero for noisy data), and at an exact fit: every residual within the engine's tolerance of the terms its own row computes. The joint form takes a list of models and matching datasets sharing parameters. An optional fifth argument is a dictionary of options: {global: {b: [lo, hi]}} searches the named parameters (at most two) over the given range for the lowest sum of squared residuals instead of returning the local minimum nearest the start; iterations is then the total over every solver run. The search samples each parameter on a grid: a parameter that scales the phase of a periodic function of a variable (b in cos(b x + c)) gets a point in every basin of the residual, about π / (span of x) apart; {global: {b: [lo, hi, step]}} sets the step of the grid instead (when the model is linear in the other parameters; otherwise the solver runs from each point of a coarse grid of 24 points, or 6 × 6). A step on the phase c of a cos(b x + c) keeps it on the grid; without a step the phase is solved by least squares. With more than 300 data rows the grid is scanned on a stratified sample of 300 rows, and the best grid points are then solved again and refined on every row. With a kernel pool on the engine (ce.workers), evaluateAsync() scans the grid on the workers and gives the record of evaluate(); the solver runs stay on the calling thread. The record of evaluateAsync() also has route: "pool" when the workers scanned the grid, or "calling-thread" with a reason ("no-pool", "pool-unusable", "no-global-search", "not-separable", "not-compilable", "pool-declined", "no-points-to-ship", "step-budget", "setup-timeout"). On the calling thread evaluateAsync() gives the event loop a turn about every 8 ms, and it keeps the limit of a withTimeLimit span that encloses the call.

FindFit(any, any, any, any, dictionary?) -> dictionaryas compute-engine declares it
Typed signatures
TypePackageApplies
(any, any, any, any, dictionary?) -> dictionarycompute-enginealways

Domain: Compute engine

About