hummingbird.ml.operator_converters._tree_implementations

Base classes for tree algorithm implementations.

class hummingbird.ml.operator_converters._tree_implementations.AbstracTreeImpl(logical_operator, **kwargs)[source]

Bases: PhysicalOperator

Abstract class definig the basic structure for tree-base models.

_abc_impl = <_abc_data object>
abstract aggregation(x)[source]

Method defining the aggregation operation to execute after the model is evaluated.

Args:

x: An input tensor

Returns:

The tensor result of the aggregation

class hummingbird.ml.operator_converters._tree_implementations.AbstractPyTorchTreeImpl(*args: Any, **kwargs: Any)[source]

Bases: AbstracTreeImpl, Module

Abstract class definig the basic structure for tree-base models implemented in PyTorch.

_abc_impl = <_abc_data object>
class hummingbird.ml.operator_converters._tree_implementations.GEMMDecisionTreeImpl(*args: Any, **kwargs: Any)[source]

Bases: GEMMTreeImpl

Class implementing the GEMM strategy in PyTorch for decision tree models.

_abc_impl = <_abc_data object>
aggregation(x)[source]

Method defining the aggregation operation to execute after the model is evaluated.

Args:

x: An input tensor

Returns:

The tensor result of the aggregation

class hummingbird.ml.operator_converters._tree_implementations.GEMMGBDTImpl(*args: Any, **kwargs: Any)[source]

Bases: GEMMTreeImpl

Class implementing the GEMM strategy (in PyTorch) for GBDT models.

_abc_impl = <_abc_data object>
aggregation(x)[source]

Method defining the aggregation operation to execute after the model is evaluated.

Args:

x: An input tensor

Returns:

The tensor result of the aggregation

class hummingbird.ml.operator_converters._tree_implementations.GEMMTreeImpl(*args: Any, **kwargs: Any)[source]

Bases: AbstractPyTorchTreeImpl

Class implementing the GEMM strategy in PyTorch for tree-base models.

_abc_impl = <_abc_data object>
aggregation(x)[source]

Method defining the aggregation operation to execute after the model is evaluated.

Args:

x: An input tensor

Returns:

The tensor result of the aggregation

forward(x)[source]
class hummingbird.ml.operator_converters._tree_implementations.PerfectTreeTraversalDecisionTreeImpl(*args: Any, **kwargs: Any)[source]

Bases: PerfectTreeTraversalTreeImpl

Class implementing the Perfect Tree Traversal strategy in PyTorch for decision tree models.

_abc_impl = <_abc_data object>
aggregation(x)[source]

Method defining the aggregation operation to execute after the model is evaluated.

Args:

x: An input tensor

Returns:

The tensor result of the aggregation

class hummingbird.ml.operator_converters._tree_implementations.PerfectTreeTraversalGBDTImpl(*args: Any, **kwargs: Any)[source]

Bases: PerfectTreeTraversalTreeImpl

Class implementing the Perfect Tree Traversal strategy in PyTorch.

_abc_impl = <_abc_data object>
aggregation(x)[source]

Method defining the aggregation operation to execute after the model is evaluated.

Args:

x: An input tensor

Returns:

The tensor result of the aggregation

class hummingbird.ml.operator_converters._tree_implementations.PerfectTreeTraversalTreeImpl(*args: Any, **kwargs: Any)[source]

Bases: AbstractPyTorchTreeImpl

Class implementing the Perfect Tree Traversal strategy in PyTorch for tree-base models.

_abc_impl = <_abc_data object>
_get_weights_and_biases(nodes_map, tree_depth, weight_0, weight_1, bias_0)[source]
_traverse_by_level(node_by_levels, node_id, current_level, max_level)[source]
aggregation(x)[source]

Method defining the aggregation operation to execute after the model is evaluated.

Args:

x: An input tensor

Returns:

The tensor result of the aggregation

forward(x)[source]
class hummingbird.ml.operator_converters._tree_implementations.TreeImpl(value)[source]

Bases: Enum

Enum definig the available implementations for tree scoring.

gemm = 1[source]
perf_tree_trav = 3[source]
tree_trav = 2[source]
class hummingbird.ml.operator_converters._tree_implementations.TreeTraversalDecisionTreeImpl(*args: Any, **kwargs: Any)[source]

Bases: TreeTraversalTreeImpl

Class implementing the Tree Traversal strategy in PyTorch for decision tree models.

_abc_impl = <_abc_data object>
aggregation(x)[source]

Method defining the aggregation operation to execute after the model is evaluated.

Args:

x: An input tensor

Returns:

The tensor result of the aggregation

class hummingbird.ml.operator_converters._tree_implementations.TreeTraversalGBDTImpl(*args: Any, **kwargs: Any)[source]

Bases: TreeTraversalTreeImpl

Class implementing the Tree Traversal strategy in PyTorch.

_abc_impl = <_abc_data object>
aggregation(x)[source]

Method defining the aggregation operation to execute after the model is evaluated.

Args:

x: An input tensor

Returns:

The tensor result of the aggregation

class hummingbird.ml.operator_converters._tree_implementations.TreeTraversalTreeImpl(*args: Any, **kwargs: Any)[source]

Bases: AbstractPyTorchTreeImpl

Class implementing the Tree Traversal strategy in PyTorch for tree-base models.

_abc_impl = <_abc_data object>
_expand_indexes(batch_size)[source]
aggregation(x)[source]

Method defining the aggregation operation to execute after the model is evaluated.

Args:

x: An input tensor

Returns:

The tensor result of the aggregation

forward(x)[source]