nntoolbox.components.dndf module

Deep Neural Decision Forest

class nntoolbox.components.dndf.DNDF(in_features: int, out_features: int, n_trees: int, tree_depth: int, output_activation=functools.partial(<class 'torch.nn.modules.activation.Softmax'>, dim=1))[source]

Bases: nntoolbox.components.merge.Mean

References:

Peter Kontschieder, Madalina Fiterau, Antonio Criminisi, Samuel Rota Bulo. “Deep Neural Decision Forests.” https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/Kontschieder_Deep_Neural_Decision_ICCV_2015_paper.pdf

training: bool
class nntoolbox.components.dndf.DNDFTree(in_features: int, out_features: int, tree_depth: int, output_activation=functools.partial(<class 'torch.nn.modules.activation.Softmax'>, dim=1))[source]

Bases: torch.nn.modules.module.Module

Based on Deep Neural Decision Forest, but with the leaf node parameterized for end-to-end training, and the decision trees balanced. Use BFS + DP for fast path computations

References:

Peter Kontschieder, Madalina Fiterau, Antonio Criminisi, Samuel Rota Bulo. “Deep Neural Decision Forests.” https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/Kontschieder_Deep_Neural_Decision_ICCV_2015_paper.pdf

forward(input: torch.Tensor) → torch.Tensor[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

training: bool