[Python] DecisiontreeClassifier, why is the sum of values wrong?

Discussão em 'Python' iniciado por Stack, Julho 1, 2025.

  1. Stack

    Stack Membro Participativo

    I visualized my decisiontreeclassifier and I noticed, that the sum of samples are wrong or formulated differently the 'value' value does not fit with the value of the samples(Screenshot)? Do I misinterpret my Decisiontree? I thought if got 100 samples in my node and 40 are True and 60 are False, I got in my next node 40 (or 60) samples which are divided again...

    import matplotlib.pyplot as plt
    from sklearn import tree
    tree1=DecisionTreeClassifier(criterion="entropy",max_features=13,max_leaf_nodes=75,min_impurity_decrease=0.001,min_samples_leaf=12,min_samples_split=20,splitter="best",max_depth=9)

    tree1.fit(X_train,y_train)
    feature_names=Daten.drop("Abwanderung_LabelEncode",axis=1).columns
    class_names=["Keine Abwanderung","Abwanderung"]
    fig = plt.figure(figsize=(25,20))
    _ = tree.plot_tree(tree1,
    feature_names=feature_names,
    class_names=class_names,
    rounded=True,
    filled=True)


    [​IMG]

    Continue reading...

Compartilhe esta Página