Question: Please solve this it in Python and make the Calculations shown as much as possible. make it readable by Google Collaboratory Decision Tree: A sample

Please solve this it in Python and make the Calculations shown as much as possible. make it readable by Google Collaboratory
Decision Tree:
A sample training dataset for decision trees is given as follows.
a) Using this data set, create the most appropriate Decision Tree by making Information
Gain and entropy calculations. (Show all steps and calculations)
b) Draw this decision tree.
c) When you consider the following Test Data set
Show the Confusion Matrix?
Calculate the Recall Value?
Calculate the Precision Value
its give me this error:
ValueError Traceback (most recent call last)
in ()
57 tree = build_tree(df, df, df.columns[:-1])
58 clf = DecisionTreeClassifier(criterion="entropy")
--->59 clf.fit(df.drop('Class', axis=1), df['Class'])
60 predictions = clf.predict(test_df)
61
5 frames
/usr/local/lib/python3.10/dist-packages/pandas/core/generic.py in __array__(self, dtype)
1996 def __array__(self, dtype: npt.DTypeLike | None = None)-> np.ndarray:
1997 values = self._values
->1998 arr = np.asarray(values, dtype=dtype)
1999 if (
2000 astype_is_view(values.dtype, arr.dtype)
ValueError: could not convert string to float: 'Small'
Please solve this it in Python and make the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!