neural_trees.HardRegressionTree#

class neural_trees.HardRegressionTree(weights, biases, node_values, n_features_in, is_split=None, log_beta=None, single_output=True)[source]#

Bases: HardDecisionTree

A trained SoftDecisionTreeRegressor with its gates read as hard decisions and one value per leaf, in target units.

Built by SoftDecisionTreeRegressor.to_hard_tree(). The walk is the parent class’s; only the leaves differ: node_values_ of shape (n_nodes, n_outputs) replaces the class distributions, predict returns values and score is R^2. Like the classifier’s export it is a different model from the soft tree, not a re-encoding: it reports its agreement rather than assuming it.

predict(X) → ndarray[source]#

Leaf value of the reached leaf, shape (n_samples,) or (n_samples, n_outputs).

predict_proba(X)[source]#

Class probabilities of the reached leaf, shape (n_samples, n_classes).

score(X, y) → float[source]#

R^2 on the given data, uniform average over outputs.