master #1
8
id3.py
8
id3.py
@ -54,9 +54,6 @@ def E(cases, attribute):
|
||||
e = 0
|
||||
values = []
|
||||
index = cases[0].attributes.index(attribute)
|
||||
print(attribute)
|
||||
print(cases[0].values)
|
||||
print(index)
|
||||
for case in cases:
|
||||
if case.values[index] not in values:
|
||||
values.append(case.values[index])
|
||||
@ -83,17 +80,12 @@ def treelearn(cases, attributes, default_class):
|
||||
t = Node(A)
|
||||
new_default_class = count_classes(cases)
|
||||
|
||||
print(attributes, end=" ")
|
||||
|
||||
values = []
|
||||
index = attributes.index(A)
|
||||
print(index)
|
||||
for case in cases:
|
||||
if case.values[index] not in values:
|
||||
values.append(case.values[index])
|
||||
|
||||
print(values, end="")
|
||||
print(A)
|
||||
for value in values:
|
||||
new_cases = []
|
||||
for case in cases:
|
||||
|
Loading…
Reference in New Issue
Block a user