select_realizations
builtin
¶
select_realizations(realizations, n, *, seed=0)
Representative realizations by k-medoids, e.g. the truths of a drill hole spacing study.
Realizations are compared by the Euclidean distance between their values (block or panel grades, one column per target). A seeded k-medoids++ start is refined by PAM swaps until no exchange of a medoid for another realization lowers the total distance of every realization to its nearest medoid. Each medoid is a simulated realization standing for its cluster, so a few medoids span the range of outcomes that a random draw of the same size may miss. Distances are computed in parallel, identically on any number of threads.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
realizations
|
SimulationSummary or array_like
|
A summary simulated with |
required |
n
|
int
|
Number of realizations to select, 1 to the number of realizations. |
required |
seed
|
int
|
Seed of the k-medoids++ start. |
0
|
Returns:
| Type | Description |
|---|---|
ndarray
|
|
Raises:
| Type | Description |
|---|---|
InvalidInput
|
If a summary holds no realizations, |
Examples:
>>> truths = bt.select_realizations(summary, 5, seed=1)
>>> summary.realizations[truths].shape
(5, 400)
used in