ProximityPivotTreeStump#

class ProximityPivotTreeStump[source]#

Bases: object

Mixin of the proximity pivot stumps (ProximityPivotTreeStumpClassifier and ObliqueProximityPivotTreeStumpClassifier): the ProximityPivotTransformer built from the parameters of the stump, the pivots of the split and its rule, P_<a> <= P_<b> (closer to the training instance a than to b).

get_pivots()[source]#

Pivots of the node, as indices of instances of the training set.

Returns:

pivots – descriptives, discriminatives and candidates pivots of the node, and the two pivots used by the split.

Return type:

dict

get_rule(columns_names=None, scaler=None, float_precision=3)[source]#

Rule of the split, P_<a> <= P_<b>: the instances closer to the training instance a than to b go left.

Parameters:
  • columns_names (list of str, default=None) – Not used: the rule does not name the features.

  • scaler (TransformerMixin, default=None) – Not used: the distances are computed on the data standardized by the stump.

  • float_precision (int, default=3) – Not used: the rule has no number.

Returns:

rule – See RuleTreeBaseStump.get_rule. Empty if the stump is not fitted.

Return type:

dict

get_plot_rule(columns_names=None, scaler=None, float_precision=3)[source]#

What the node of the split shows in RuleTree.plot_tree: the rule, and the two pivots as given to fit, drawn with show_media on the arrows of the children: the first one on the left arrow (“true”, the instances closer to it), the second one on the right arrow.

Parameters:
  • columns_names (list of str, default=None) – Not used.

  • scaler (TransformerMixin, default=None) – Not used.

  • float_precision (int, default=3) – Not used.

Returns:

rule – label, media_on_edges (True), and media_values with the two pivots (see pivot_media()).

Return type:

dict