UBay constraints¶
UBayFS
- class UBayconstraint.UBayconstraint(rho, A=None, b=None, block_matrix=None, block_list=None, constraint_types=None, constraint_vars=None, num_elements=None)¶
This class initializes user-defined constraints.
- Parameters:
rho (<numpy array>) – Vector of regularization strenghts for the defined constraints.
A (<numpy array>) – Matrix describing constraints. Left side of the equation system. Default:
A=None
b (<numpy array>) – 1-d dimensional array defining the right sight of the equation system. Default:
b=None
block_matrix (<numpy array>) – Matrix describing the block assignment for each feature. If no block-structure given, block_matrix is a diagonal-unity matrix. Default :
block_matrix=None
.block_list (<list>) – List describing the block assignment for each feature, if block structure is present. Default :
block_list=None
.constraint_types (<list> of <strings>) –
- Constraint types. Possible options are:
”max_size” : maximal number of features that shall be selected
”must_link” : the defined feature set must be selected together
”cannot_link” : the defined feature set must not be selected together
constraint_vars (<list> of <int> or <lists>) – For each constraint_type, define features sets that are concerned. Default :
`constraint_vars=None
.num_elements (<int>) – Total number of features. Default :
num_elements=None
.
- get_constraints()¶
Get the constraints.
- Return type:
A dictionary including A, b, and block_matrix.
- get_dimensions()¶
Get the dimensions of the constraint matrix A and the block matrix.
- Return type:
…
- get_maxsize()¶
Get the right side (b) of the max size constraint.
- Return type:
An integer.
- group_admissibility(state, log=True)¶
Evaluate the value of the admissibility function ‘kappa’ for a group of constraints (with a common block)-
- Parameters:
state (<np.array>) – 1-dimensional binary array describing a feature set. 1: feature selected, 0: feature not selected.
log (<boolean>) – Indicates whether the admissibility should be returned on log scale.
- Return type:
An admissibility value <float>.