PineForge HPO 1.11.0
Native hyperparameter optimization for PineForge strategies
Loading...
Searching...
No Matches
pineforge_hpo.neighbourhood.Dimension Class Reference

Public Member Functions

bool constant (self)
 
float decode (self, int ordinal)
 
int ordinal (self, float value)
 
Any normalise (self, Any value)
 
Moves neighbours (self, Any value, float|None fraction=None, float|None ratio=None)
 
Any rank (self, Any value)
 
list sort_values (self, Any values)
 

Public Attributes

 rule
 
 low
 
 step
 
 kind
 
 high
 
 choices
 

Static Public Attributes

str name
 
str kind
 
str rule
 
Any low = None
 
Any high = None
 
Any step = None
 
bool log = False
 
tuple choices = ()
 
int last = None
 

Detailed Description

One search dimension of the recorded space, with its neighbour rule.

``rule`` names how a value moves: ``step`` (integer lattice), ``ratio_rounded``
(log integer), ``ordinal`` (stepped real), ``fraction`` (continuous real),
``ratio`` (log real), ``other_value`` (boolean), ``other_choices``
(categorical) or ``constant`` (exactly one legal value, no neighbours).
``last`` is the last lattice ordinal of a stepped real.

Definition at line 207 of file neighbourhood.py.

Member Function Documentation

◆ constant()

bool pineforge_hpo.neighbourhood.Dimension.constant (   self)

Definition at line 228 of file neighbourhood.py.

◆ decode()

◆ neighbours()

Moves pineforge_hpo.neighbourhood.Dimension.neighbours (   self,
Any  value,
float | None   fraction = None,
float | None   ratio = None 
)
The values one move away from ``value`` and the moves that were dropped.

``value`` must be a normalised value of this dimension. Order: lower
first; a categorical keeps its declared order. A rule that needs
``fraction`` or ``ratio`` raises ValueError when it is None. No log,
exp or pow function is called: log integers use exact rational
arithmetic, log reals use one binary64 multiplication or division.

Definition at line 285 of file neighbourhood.py.

References pineforge_hpo.neighbourhood.Dimension.decode(), pineforge::hpo::IntegerDimension.high(), pineforge::hpo::RealDimension.high(), pineforge_hpo.neighbourhood.Dimension.high, pineforge_hpo.study_spec.ParameterSpec.high, pineforge_hpo.neighbourhood.Dimension.last, pineforge::hpo::IntegerDimension.low(), pineforge::hpo::RealDimension.low(), pineforge_hpo.neighbourhood.Dimension.low, pineforge_hpo.study_spec.ParameterSpec.low, pineforge_hpo.neighbourhood.Dimension.ordinal(), pineforge_hpo.neighbourhood.Dimension.rule, pineforge::hpo::IntegerDimension.step(), pineforge::hpo::RealDimension.step(), pineforge_hpo.neighbourhood.Dimension.step, and pineforge_hpo.study_spec.ParameterSpec.step.

◆ normalise()

Any pineforge_hpo.neighbourhood.Dimension.normalise (   self,
Any  value 
)
The value as this dimension holds it; ValueError when it does not fit.

The checks are those of the continuation loader for one parameter. A
stepped real within four units in the last place of a lattice point is
taken as that point, and -0.0 is taken as 0.0.

Definition at line 246 of file neighbourhood.py.

◆ ordinal()

int pineforge_hpo.neighbourhood.Dimension.ordinal (   self,
float  value 
)
Nearest lattice ordinal of a stepped-real value (continuation.py:228).

Definition at line 242 of file neighbourhood.py.

Referenced by pineforge_hpo.neighbourhood.Dimension.neighbours().

◆ rank()

Any pineforge_hpo.neighbourhood.Dimension.rank (   self,
Any  value 
)

◆ sort_values()

list pineforge_hpo.neighbourhood.Dimension.sort_values (   self,
Any  values 
)
The values in this dimension's order: ascending, or declared order.

Definition at line 357 of file neighbourhood.py.

References pineforge_hpo.neighbourhood.Dimension.rank(), and pineforge_hpo.neighbourhood.Study.rank().

Member Data Documentation

◆ choices [1/2]

tuple pineforge_hpo.neighbourhood.Dimension.choices = ()
static

Definition at line 224 of file neighbourhood.py.

◆ choices [2/2]

pineforge_hpo.neighbourhood.Dimension.choices

Definition at line 351 of file neighbourhood.py.

◆ high [1/2]

Any pineforge_hpo.neighbourhood.Dimension.high = None
static

◆ high [2/2]

pineforge_hpo.neighbourhood.Dimension.high

◆ kind [1/2]

str pineforge_hpo.neighbourhood.Dimension.kind
static

◆ kind [2/2]

pineforge_hpo.neighbourhood.Dimension.kind

◆ last

int pineforge_hpo.neighbourhood.Dimension.last = None
static

◆ log

bool pineforge_hpo.neighbourhood.Dimension.log = False
static

Definition at line 223 of file neighbourhood.py.

◆ low [1/2]

Any pineforge_hpo.neighbourhood.Dimension.low = None
static

◆ low [2/2]

pineforge_hpo.neighbourhood.Dimension.low

◆ name

str pineforge_hpo.neighbourhood.Dimension.name
static

Definition at line 217 of file neighbourhood.py.

◆ rule [1/2]

str pineforge_hpo.neighbourhood.Dimension.rule
static

Definition at line 219 of file neighbourhood.py.

Referenced by pineforge_hpo.neighbourhood.Dimension.neighbours().

◆ rule [2/2]

pineforge_hpo.neighbourhood.Dimension.rule

Definition at line 229 of file neighbourhood.py.

Referenced by pineforge_hpo.neighbourhood.Dimension.neighbours().

◆ step [1/2]

Any pineforge_hpo.neighbourhood.Dimension.step = None
static

◆ step [2/2]

pineforge_hpo.neighbourhood.Dimension.step

The documentation for this class was generated from the following file: