Options that bound the work of a search or a fit
Source:R/spatialkit-topics.R
spatialkit-options.RdThe package reads two options. Each bounds a step whose cost grows with
the square of the rows or of the cells, so that such a step stops, or is
skipped, before it starts. Set them with options().
The options
spatialkit.exact_pairs_maxDefault
2e9pairs. The most pairs a search made without the FNN package may compare. Without FNN, a nearest-neighbour search (each cell's neighbours, each row's nearest centre, each location's nearest other location) compares every pair, and a search over the pairs of about 44,700 cells or locations reaches the default. With FNN, which installs with spatialkit, these searches use a kd-tree and the limit is not read. The result of every search is the same with and without FNN. Above the limit:resolution_profile()stops with an error of classspatialkit_work_limitbefore the search: on a ladder of sizes, for the weights ofpartition = "density"; with anestimate, on any ladder, for the estimate's searches.cell_values_at()stops with the same error before the search.summarize_by_cell()returnsNApooled columns with a warning of classspatialkit_pool_unavailable(reason = "work limit"), and does not run the check of the count record ("not checked: work limit").select_resolution()hands on the centres fitted to the subsample without refitting them to every point, with a logged warning.
spatialkit.fit_work_maxDefault
1e10point-to-centre comparisons. The most work the partition fits of a ladder of sizes may do: the points times the cells of the finest level timesnstart, timesiter_maxforpartition = "density"without FNN. With FNN andinit = "random"the density kind has no step that compares every point with every centre, and nothing is counted. Above the limit,resolution_profile()stops with an error of classspatialkit_work_limitbefore any fit. At the default size the work grows with the square of the rows.select_resolution()refits the centres of a profile fitted to a subsample to every point, and counts the points times the cells of the count it selects, timesiter_maxfor the density kind without FNN, whatever the start. Above the limit it hands on the centres fitted to the subsample, with a logged warning.
Setting a limit
Each option takes a single number, 0 or more; Inf removes the limit.
Any other value is an error when the option is read. The error of class
spatialkit_work_limit carries work (the count), limit and what
(the step), and its message says what to change: for a fit, fewer
starts, a coarser obs_per_cell, random starts of the density kind or a
higher limit; for a search, reinstalling FNN. A
profile just below spatialkit.fit_work_max prints nothing while its
fits run.
The console log is set with spatialkit_quiet(), not with an option.
See also
spatialkit-conditions for the classes named here, and
resolution_profile() for the work its fits do.
Other options and caches:
clear_fitted_cache(),
clear_grid_cache(),
spatialkit-conditions,
spatialkit_quiet()