Class BoostedTreesRegression
def __init__(self, forest, learner_information=None, feature_names=None): Highlight
Returns a BoostedTreesRegression consisting of trees (the forest).
Parameters
forest : list of DecisionTree
The list of trees composing the boosted trees.
learner_information : LearnerInformation (optional, default=LearnerInformation(problem_type=’regression’, extras={“base_score”: 0}) if called from Builder else None)
The information about the learning process.
feature_names : list of str (optional, default=None)
The names of the features used in the model.
class_names : list of str (optional, default=None)
The names of the classes to predict.
Examples
from pyxai import Builder, Explaining
node1_1 = Builder.DecisionNode(1, operator=Builder.GT, threshold=3000, left=1500, right=1750)
node1_2 = Builder.DecisionNode(1, operator=Builder.GT, threshold=2000, left=1000, right=node1_1)
node1_3 = Builder.DecisionNode(1, operator=Builder.GT, threshold=1000, left=0, right=node1_2)
tree1 = Builder.DecisionTree(5, node1_3)
node2_1 = Builder.DecisionNode(5, operator=Builder.EQ, threshold=1, left=100, right=250)
node2_2 = Builder.DecisionNode(4, operator=Builder.EQ, threshold=1, left=-100, right=node2_1)
node2_3 = Builder.DecisionNode(2, operator=Builder.EQ, threshold=1, left=node2_2, right=250)
tree2 = Builder.DecisionTree(5, node2_3)
node3_1 = Builder.DecisionNode(3, operator=Builder.EQ, threshold=1, left=500, right=250)
node3_2 = Builder.DecisionNode(3, operator=Builder.EQ, threshold=1, left=250, right=100)
node3_3 = Builder.DecisionNode(1, operator=Builder.GE, threshold=2000, left=0, right=node3_1)
node3_4 = Builder.DecisionNode(4, operator=Builder.EQ, threshold=1, left=node3_3, right=node3_2)
tree3 = Builder.DecisionTree(5, node3_4)
BTs = Builder.BoostedTreesRegression([tree1, tree2, tree3])