easyiec.core.Box#
- class easyiec.core.Box(lower, upper, names=None, kinds=None, log=None, categories=None, units=None)[source]#
Bases:
objectAxis-aligned box \([\mathbf l,\mathbf u]\) with typed, named genes.
- Parameters:
- lower, upperarray_like
ofshape(d,) Bounds in natural units;
upper > lowerelementwise.- namessequence
ofstr,optional Gene names (default
x0, x1, ...). Used in plots, prompts and exports.- kindssequence
of{“real”, “int”, “cat”},optional Gene types;
"cat"genes take values0, ..., n_cat-1decoded by flooring a real in[0, n_cat).- logsequence
ofbool,optional Logarithmic scaling between the bounds (requires positive bounds).
- categories
dict,optional {gene index: list of labels}for categorical genes.- unitssequence
ofstr,optional Physical units shown in descriptions.
- lower, upperarray_like
Examples
>>> b = Box([0, 1e-2], [1, 10], names=["mix", "gain"], log=[False, True]) >>> z = b.normalize([0.5, 0.1]); [round(float(v), 4) for v in z] [0.5, 0.3333] >>> [round(float(v), 4) for v in b.denormalize(z)] [0.5, 0.1]
- property dim#
Number of genes \(d\).