Backend API¶
Every nonlinear fit tries its model from a grid of starting values, and the grid
is fitted as one batch of array operations before the best few results are
polished on the CPU. set_backend chooses the array library for that batch. See
Speed and the GPU for when the GPU
is worth it.
set_backend¶
sars.set_backend ¶
Choose the array library that screens each model's start grid.
Every fit tries each model from a grid of starting values. They're run
as one batch, on numpy (the default) or, for large datasets or many fits,
on an NVIDIA GPU through CuPy (pip install 'sars[gpu]'). The final
solve (at tight tolerances, or the defaults for a full bootstrap's
resamples) always runs on the CPU, so results agree between backends to
the solver's tolerance wherever that solve converges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
('numpy', 'cupy')
|
The backend for every fit that follows, in this process and in the
worker processes that |
"numpy"
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
ImportError
|
If |