1

I am working from this tutorial: https://dataaspirant.com/visualize-decision-tree-python-graphviz/

The code:

import pandas as pd
import numpy as np
from sklearn import tree
fruit_data_set = pd.DataFrame()
# 1 is an apple, 0 is an orange
fruit_data_set["fruit"] = np.array([   1,   1,   1,   1,   1,   0,   0,   0,   0,   0])
fruit_data_set["weight"] = np.array([170, 175, 180, 178, 182, 130, 120, 130, 138, 145])
fruit_data_set["smooth"] = np.array([  9,  10,   8,   8,   7,   3,   4,   2,   5,   6])
fruit_classifier = tree.DecisionTreeClassifier()
fruit_classifier.fit(fruit_data_set[["weight", "smooth"]], fruit_data_set["fruit"])

print (fruit_classifier)

My output is this:

DecisionTreeClassifier()

The output according to the tutorial should be:

DecisionTreeClassifier(class_weight=None, criterion='gini', max_depth=None,
            max_features=None, max_leaf_nodes=None, min_samples_leaf=1,
            min_samples_split=2, min_weight_fraction_leaf=0.0,
            presort=False, random_state=None, splitter='best')
nicomp
  • 4,344
  • 4
  • 27
  • 60
  • 2
    Hi! Check my answer [here](https://stackoverflow.com/questions/72044402/decision-tree-regression-code-when-run-shows-only-random-state-0-and-nothin/72086819#72086819). It's about the new version of scikit-learn. – Alex Serra Marrugat Dec 07 '22 at 14:10
  • 1
    or `print(fruit_classifier.get_params())` – Bushmaster Dec 07 '22 at 20:47

0 Answers0