master #1

Merged
s444427 merged 39 commits from s452664/Sztuczna_Inteligencja-projekt:master into master 2021-06-03 16:39:57 +02:00
Showing only changes of commit 8effe0d702 - Show all commits

8
id3.py
View File

@ -54,9 +54,6 @@ def E(cases, attribute):
e = 0 e = 0
values = [] values = []
index = cases[0].attributes.index(attribute) index = cases[0].attributes.index(attribute)
print(attribute)
print(cases[0].values)
print(index)
for case in cases: for case in cases:
if case.values[index] not in values: if case.values[index] not in values:
values.append(case.values[index]) values.append(case.values[index])
@ -83,17 +80,12 @@ def treelearn(cases, attributes, default_class):
t = Node(A) t = Node(A)
new_default_class = count_classes(cases) new_default_class = count_classes(cases)
print(attributes, end=" ")
values = [] values = []
index = attributes.index(A) index = attributes.index(A)
print(index)
for case in cases: for case in cases:
if case.values[index] not in values: if case.values[index] not in values:
values.append(case.values[index]) values.append(case.values[index])
print(values, end="")
print(A)
for value in values: for value in values:
new_cases = [] new_cases = []
for case in cases: for case in cases: