bosk.block.zoo.routing.cv
#
Module Contents#
Classes#
Cross-validation Training Indices Block. |
|
Block wrapper that fits the base block on the indices subset. |
- class bosk.block.zoo.routing.cv.CVTrainIndicesBlock(size, random_state)#
Bases:
bosk.block.base.BaseBlock
Cross-validation Training Indices Block.
Generates training indices for size models. The block has size outputs, each named as a number of model: “0”, “1”, ….
Dynamically specifies the meta information.
- Parameters:
size (int) – Cross-validation size (number of splits).
random_state (Optional[int]) – Random state.
Input slots#
Fit inputs#
The fit step is bypassed.
Transform inputs#
X: Features data array.
y: Target variable array.
Output slots#
“0”: Fold 0 training subset indices.
…
“<n>”: Fold n training subset indices.
- size#
Cross-validation size (number of splits).
- random_state#
Random state.
- meta :bosk.block.meta.BlockMeta#
- fit(inputs)#
The block bypasses the fit step.
- transform(inputs)#
Transform the given input data, i.e. compute values for each output slot.
- Parameters:
inputs – Block input data for the transforming stage.
- Returns:
Outputs calculated for the given inputs.
- class bosk.block.zoo.routing.cv.SubsetTrainWrapperBlock(block)#
Bases:
bosk.block.base.BaseBlock
Block wrapper that fits the base block on the indices subset.
The base block may have an arbitrary number of inputs of any type, but should not accept input named “trainin_indices”.
At FIT stage the wrapper extracts subsets of each input along the first dimension.
At TRANSFORM stage the wrapper bypasses inputs to the base block.
Input slots#
Fit inputs#
All inputs from the underlying block block.
training_indices: Training indices.
Transform inputs#
All inputs from the underlying block block.
Output slots#
All outputs from the underlying block block.
- block#
Underlying block.
- TRAINING_INDICES_NAME = training_indices#
- meta :bosk.block.meta.BlockMeta#
- _exclude_training_indices(inputs)#
- fit(inputs)#
Fit the block on the given input data.
- Parameters:
inputs – Block input data for the fitting stage.
- Returns:
Self.
- transform(inputs)#
Transform the given input data, i.e. compute values for each output slot.
- Parameters:
inputs – Block input data for the transforming stage.
- Returns:
Outputs calculated for the given inputs.
- set_random_state(seed)#
Set random seed for the block using numpy random generator or integer value.
- Parameters:
seed (Optional[Union[int, numpy.random.Generator]]) –
- Return type:
None
- Parameters:
block (bosk.block.base.BaseBlock) –