1. Homepage
  2. Programming
  3. Assignment 1: Decision Trees

Assignment 1: Decision Trees

Engage in a Conversation
PythonDecision TreesClassifierMushroomReflectionNew ZealandAuckland

Assignment 1: Decision Trees

Task 1 (No coding- show your general working):

A. You are building a classifier to determine which walking trail is best suited for a weekend outing with your friends. You scouted around and gathered data about eleven different walking trails and about the difficulty level (easy, some difficulty or advance), the distance from Auckland (within, short distance or far), their direction (North, South or West), whether they can comply with restrictions (none, wheelchair access or flat terrain) and whether you enjoyed them or not. Using this data build a decision tree to decide whether you would enjoy a particular trail or not, showing at each level how you decided which attribute to expand next. CourseNana.COM

Use the following data: CourseNana.COM

Trail Type Distance Direction Restriction OK
T1 Easy short distance West none 1
T2 Some Difficulty within West none 1
T3 Advanced within South flat terrain 0
T4 Easy far North none 0
T5 Some Difficulty short distance South wheelchair access 1
T6 Advanced short distance South flat terrain 1
T7 Easy within North wheelchair access 0
T8 Some Difficulty short distance West flat terrain 0
T9 Advanced short distance West none 0
T10 Advanced far South wheelchair access 0
T11 Advanced within North wheelchair access 1

 B. What is the training set accuracy of your decision tree?  C. Given a new data set with several other trails, which ones would you choose? CourseNana.COM

Tail Type Distance Direction Restriction
T12 Easy within West none
T13 Some Difficulty within North flat terrain
T14 Advanced within South wheelchair access
T15 Some Difficulty within West flat terrain
T16 Some Difficulty short distance South none

 C. To verify your decision tree accuracy, you decide to try them all. The results are: CourseNana.COM

Trail OK
T12 0
T13 0
T14 1
T15 0
T16 1

 D. What is the test set error?  Is this result ideal? Explain your answer. CourseNana.COM

Task 2 (coding):

In this task, we will implement a full ML classifier based on decision trees (in python using Jupyter notebook). We will use the Mushroom Data Set (https://archive.ics.uci.edu/ml/datasets/Mushroom) to train and evaluate your classifier. This dataset comes from the UCI ML repository (https://archive.ics.uci.edu/ml/index.php) . (Hint: There are missing values in this dataset. CourseNana.COM

At this particular time, you may ignore instances that have missing values and just remove them, or replace missing values with the mean value of the column. Please note  that there are other ways of preprocessing data which we have not seen yet.) CourseNana.COM

You can use libraries e.g., Pandas, NumPy but you may NOT use any prebuilt decision tree packages. CourseNana.COM

A. Implement the basic decision tree procedure as discussed in the lectures. Implement DecisionTree algorithm with a train procedure. Implement the information gain criterion as described in our lectures. In your report use one or two sentences to discuss the output (the output of the training procedure is the trained decision tree which is a representation of the if-then-else rules). You may print out your decision tree (you don't have to, however it might help you discuss the trained trees)  (This may be large - consider the best way to print it). B. Implement tree depth control as a means of controlling the model complexity.  In the procedure train implement a parameter stopping_depth. CourseNana.COM

Use the stopping_depth parameter to stop further splits of the tree. In your report use one or two sentences to discuss the output at stopping level 2, 3, 4.  You can print out your decision tree. C. Implement a test procedure for your DecisionTree algorithm (a procedure that takes new data and the trained model and returns a prediction).  Describe your test evaluation. D. Propose and implement an evaluation method for your DecisionTree algorithm (this evaluates the whole procedure, given a data set, trains the tree, applies the tree to data, calculates a performance measure) . Please explain your steps and results. CourseNana.COM

Task 3 (Reflection - not coding):

A. Discuss what will happen if you decide to change the splitting criterion. Explain the new splitting criterion and how it might change your decision tree. B. Explain whether your evaluation method can indicate whether your tree is over- or underfitting. CourseNana.COM

What to submit? You need to submit: CourseNana.COM

  1. The raw jupyter notebook .ipynb AND CourseNana.COM

  2. An HTML generated from the notebook (including the outputs from the execution of the code). CourseNana.COM

The notebook needs to be clearly structured according to the assignment tasks listed above. Each part should contain a header pointing out which task it contains, your code with results, and one paragraph containing your answers to the questions. You won't get any marks for your code and results alone, they need to be explained; the discussion is the most important part! CourseNana.COM

The assignment must be submitted to Canvas. It will be run through Turnitin, so make sure that everything you submit has been done by you. CourseNana.COM

Note that we will deduct marks if the solution is not submitted in the correct format. You can only submit html and ipynb files. CourseNana.COM

Make sure everything is reproducible, all the parameters are defined, random seeds are set, and results repeatable. CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Python代写,Decision Trees代写,Classifier代写,Mushroom代写,Reflection代写,New Zealand代写,Auckland代写,Python代编,Decision Trees代编,Classifier代编,Mushroom代编,Reflection代编,New Zealand代编,Auckland代编,Python代考,Decision Trees代考,Classifier代考,Mushroom代考,Reflection代考,New Zealand代考,Auckland代考,Pythonhelp,Decision Treeshelp,Classifierhelp,Mushroomhelp,Reflectionhelp,New Zealandhelp,Aucklandhelp,Python作业代写,Decision Trees作业代写,Classifier作业代写,Mushroom作业代写,Reflection作业代写,New Zealand作业代写,Auckland作业代写,Python编程代写,Decision Trees编程代写,Classifier编程代写,Mushroom编程代写,Reflection编程代写,New Zealand编程代写,Auckland编程代写,Pythonprogramming help,Decision Treesprogramming help,Classifierprogramming help,Mushroomprogramming help,Reflectionprogramming help,New Zealandprogramming help,Aucklandprogramming help,Pythonassignment help,Decision Treesassignment help,Classifierassignment help,Mushroomassignment help,Reflectionassignment help,New Zealandassignment help,Aucklandassignment help,Pythonsolution,Decision Treessolution,Classifiersolution,Mushroomsolution,Reflectionsolution,New Zealandsolution,Aucklandsolution,