I don't know why I keep getting the following error:
AttributeError: 'tuple' object has no attribute 'size'
I am using python in Anaconda.
import numpy as np
def information_gain(x_array, y_array):
parent_entropy = entropy(x_array)
split_dict = split(y_array)
for val in split_dict.values():
freq = val.size / x_array.size
child_entropy = entropy([x_array[i] for i in val])
parent_entropy -= child_entropy* freq
return parent_entropy
x = np.array([0, 1, 0, 1, 0, 1])
y = np.array([0, 1, 0, 1, 1, 1])
print(round(information_gain(x, y), 4))
x = np.array([0,...