Write a Java program to create a decision tree using ID3 algorithm. Use entropy and information gain calculation to…

Write a Java program to create a decision tree using ID3 algorithm. Use entropy and information gain calculation to…

Question:

  

Transcribed Image Text:

Write a Java program to create a decision tree using ID3 algorithm. Use entropy and information gain calculation to create subtrees. To test your program, use the following dataset table. The dataset is used to predict a student’s grade in first year computer science programming course based on their records in math, statistics, science and English in high school. Math Statistics Science English (A+) grade in programming? A B A- A No A B A- No A+ B A- Yes B B+ A- Yes B A Yes B A No A+ A Yes A B+ A A B B+ A B+ A+ B+ B B+ A+ B A A A A- A A A A- A A- A+ A A A A+ A+ A A A A+ A+ A A+ No Yes Yes Yes Yes Yes No The program should read the dataset from a text file (CSV format) and prints out the tree structure. Marking Criteria for programming question 4 Marks Description 1 1 1 6 1 One mark for accepting CSV file and reading the training set correctly. One mark for writing the code that calculates the entropy and information gain correctly. One mark for writing the loop condition that checks if a solution is found Six marks for writing the core of the ID3 search, including recursive functions to build the subtrees and exclude visited nodes. One marks for writing the code that prints out the solution correctly. (Submit both the input data (CSV) file and the screenshots showing the outputs of your program)

Expert Answer:

Answer rating: 100% (QA)

Node class implementation public class Node Parent node null if this is the root node private Node parent Map of child nodes key attribute value value child node private Map children public Node this
View the full answer