Question: complete the python code given below GainRatio(feature) = InformationGain(feature) / Entropy(feature) where information-gain is defined as InformationGain(feature) = Entropy(dataset) - Entropy(children) def gainratio_numeric(dataset:list, index) ->

complete the python code given below 

GainRatio(feature) = InformationGain(feature) / Entropy(feature)

where information-gain is defined as

InformationGain(feature) = Entropy(dataset) - Entropy(children)

 def gainratio_numeric(dataset:list, index) -> float: """Compute gainratio of the given numeric feature.    Enumerate all feature values to find the value that gives the  highest gainratio for the feature, as follows:  1. initialize: best_ratio = 0; best_value = None  2. for each value v:  2.1. leftchild: all samples with sample[index] <= v  2.2. rightchild: all samples with sample[index] > v  2.3. compute gainratio for current split, update best*  if necessary.  3. return best_ratio, best_value  """

Modify the code to implement the C4.5, so your code can work with numeric data as well.

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!