bosk.block.zoo.models.classification.ferns#

Module Contents#

Classes#

RandomFernsBlock

Random Ferns Classifier Block.

class bosk.block.zoo.models.classification.ferns.RandomFernsBlock(n_groups=10, n_ferns_in_group=20, fern_size=7, kind='unary', bootstrap=False, n_jobs=None, random_state=None)#

Bases: bosk.block.base.BaseBlock

Random Ferns Classifier Block.

Parameters:
  • n_groups (int) – Number of ferns groups (like a number of estimators).

  • n_ferns_in_group (int) – Number of ferns in a group.

  • fern_size (int) – Number of tests in fern.

  • kind (str) – Kind of tests (‘unary’ or ‘binary’).

  • bootstrap (bool) – Apply data bootstrap or not.

  • n_jobs (Optional[int]) – Number of threads.

  • random_state (Optional[int]) – Random state.

Input slots#

Fit inputs#
  • X: Input features.

  • y: Ground truth labels.

Transform inputs#
  • X: Input features.

Output slots#

  • probas: Predicted probabilities.

meta#
__getstate__()#
Return type:

dict

__setstate__(state)#
Parameters:

state (dict) –

_classifier_init(y)#
_parallel_calc_bucket_stats(bucket_indices, y, group_data_indices)#
_make_ferns(X, prng_key)#
_apply_ferns(X, ferns)#
fit(inputs)#

Fit the Random Ferns Block. The implementation is device-agnostic.

Parameters:

inputs (bosk.block.base.BlockInputData) –

Return type:

RandomFernsBlock

_predict_proba(X)#
transform(inputs)#

Transform the given input data, i.e. compute values for each output slot.

Parameters:

inputs (bosk.block.base.BlockInputData) – Block input data for the transforming stage.

Returns:

Outputs calculated for the given inputs.

Return type:

bosk.block.base.TransformOutputData