Question
Project 3: Decision Trees You are going to implement the ID3 algorithm to classify adults into two income brackets . Each line of the file
Project 3: Decision Trees
You are going to implement the ID3 algorithm to classify adults into two income brackets
. Each line of the file looks like this: workclass, education, marital-status, occupation, relationship, race, sex, native-country, class-label
Using the provided stub file, implement a decision tree classifier using the ID3 algorithm (see the slides or the book). You should implement the train() function before the classify() function. These two functions are required as written in order to test your code. You are free to implement a decision tree however you wish, as long as you write the algorithm from scratch. Also, be sure not to edit the function signatures, or you will break the tests. You can write any extra functions that you deem necessary. Do not use premade packages such as scikit-learn.
We have provided a convert() function that turns each attribute vector into an integer vector. Please base the decisions in your model on the values of these integers, not the categorical values themselves. Both train() and classify() will be passed integer attribute vectors during tests on Mimir.
Notes: The value "Never-worked" of attribute workclass is removed from the training set when it is groomed of unknown values ("?"). If someone has never worked, then we don't know what their occupation is.
The Program must be done in python
Here is the link to a zip folder which contains the convert() function and the data file .
Download link: https://gofile.io/?c=LgeOHy
please post your answer with screen shots.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started