gpridge.policy¶
Training policies for the accelerated searches.
A policy decides whether a search calls the true potential, which measured
rows enter the training set, and whether the hyperparameters are refit.
None leaves every decision with the engine. DefaultPolicy asks
the same questions and returns the engine’s answers.
Classes¶
The engine's own answers, as a policy object. |
|
Keep at most |
|
Drop a candidate closer than |
|
Call the oracle only when the posterior energy variance is high. |
|
Stop hyperparameter optimisation after |
Functions¶
|
Indices of a farthest-point subset, in the original order. |
Module Contents¶
- gpridge.policy.farthest_point_indices(rows, max_size)¶
Indices of a farthest-point subset, in the original order.
Row 0 stays. Each later row is the one whose Euclidean distance to the nearest kept row is largest. Ties take the lowest index.
max_sizeis at least 1. A set that is already small enough is returned unchanged.
- class gpridge.policy.DefaultPolicy¶
The engine’s own answers, as a policy object.
- should_call_oracle(state)¶
- select_training_points(candidates, current_set)¶
- should_retrain_hyperparameters(state)¶
- should_rebuild_factor(state)¶
- retain_training_rows(rows)¶
- class gpridge.policy.SizeCapPolicy(max_size)¶
Keep at most
max_sizetraining rows.New rows are admitted. The stored set is then reduced to
max_sizebyfarthest_point_indices().max_sizeis an integer of at least 1.- max_size¶
- retain_training_rows(rows)¶
- class gpridge.policy.DistanceDedupPolicy(min_distance)¶
Drop a candidate closer than
min_distanceto a kept row.The distance is the Euclidean norm of the flat position difference, in the same length unit as the coordinates. A candidate is kept when that distance is greater than or equal to
min_distance, measured against the current training set and against candidates accepted earlier in the same call.min_distanceis finite and positive.- min_distance¶
- select_training_points(candidates, current_set)¶
- class gpridge.policy.VarianceThresholdPolicy(variance_threshold)¶
Call the oracle only when the posterior energy variance is high.
variance_thresholdis the energy variance, in eV^2, above which a call the engine already wants is allowed. A variance that is not finite (no posterior yet) defers to the engine. A call the engine declined is not forced. The comparison is strict: a variance equal to the threshold does not call.- variance_threshold¶
- should_call_oracle(state)¶
- class gpridge.policy.FreezeHyperparametersPolicy(freeze_after_oracle_calls)¶
Stop hyperparameter optimisation after
freeze_after_oracle_calls.While
state.oracle_callsis strictly below that count, a refit the engine already wants still runs. At the count, and after it, the search factors the model at the hyperparameters it already has. Zero freezes before the first fit: the seeded hyperparameters are kept and no optimiser run is started. A refit the engine declined stays declined.freeze_after_oracle_callsis an integer of at least 0.- freeze_after_oracle_calls¶
- should_retrain_hyperparameters(state)¶