Python code for a decision tree built from scratch (w/o sckit-learn). Works for continuous/numerical variables.
Task:
- construct a decision tree classifier from the given training data
- use the learned tree classifier to classify the unlabeled test data, and
- output the predictions of your classifier on the test data into a file named blackbox1*_predictions.csv
The format of *_train.csvlooks like: x1, x2, y Where x1 andx2are the attribute values and yis the label, and _test.csvare unlabeled. Your output blackbox1_predictions.csvwill look like 1 0 0 ร. (A single column indicates the predicted labels for each unlabeled sample in the input test file)