Question: No dataset provided. Based on the question asked you should still be able to fill in the correct code. In python please import argparse import

 No dataset provided. Based on the question asked you should still

No dataset provided. Based on the question asked you should still be able to fill in the correct code. In python please

import argparse import pandas as pd import numpy as np import pickle from pathlib import Path from collections import defaultdict [10 points] Problem 1 - Building a Decision Tree A sample dataset has been provided to you in the '/data/dataset.csv' path. Here are the attributes for the dataset. Use this dataset to test your functions. Age - ['40"] Income - ["low", "medium", "high") Student - ["no", "yes") Credit Rating - ["fair", "excellent"] Loan - ["no", "yes") Note: A sample dataset to test your code has been provided in the location "data/dataset.csv". Please maintain this as it would be necessary while grading. . Do not change the variable names of the returned values. After calculating each of those values, assign them to the corresponding value that is being returned. The "Loan" attribute should be used as the target variable while making calculations for your decision tree. import math import pandas as pd def information_gain_target (dataset_file): Input: dataset_file - A string variable which references the path to the dataset file. Output: ig_loan - A floating point variable which holds the information gain associated with the target varia! NOTE: 1. Return the information gain associated with the target variable in the dataset. 2. The Loan attribute is the target variable 3. The pandas dataframe has the following attributes: Age, Income, Student, Credit Rating, Loan 4. Perform your calculations for information gain and assign it to the variable ig_loan df = pd.read_csv (dataset_file) ig_loan = 0 + your code here return ig_loan

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 Databases Questions!