morphoclass.transforms.augmentors.equalize_node_counts module

Implementation of the EqualizeNodeCounts transform.

class morphoclass.transforms.augmentors.equalize_node_counts.EqualizeNodeCounts(min_total_nodes=None)

Bases: object

Equalize node counts across the whole dataset.

If possible, nodes from the original apicals are added to the apicals as long as the node count in the sample is smaller than the threshold specified by the field min_total_nodes.

The threshold min_total_nodes can be either set manually or found automatically by fitting the transformer to a dataset, in which case the value is set to the minimal number of nodes in the original apicals across the whole dataset.

Parameters

min_total_nodes (int (optional)) – The threshold for the new node count.

fit(dataset)

Find a heuristic number of nodes to which to equalize the samples.

This is simply the minimal number of apical nodes across the whole dataset. This way we make sure that each sample can reach this number of nodes.

Parameters

dataset – The dataset to which to fit.