Compare commits

..

No commits in common. "4206edd60fe696f43f6646a4e1002c2ea9a8e09b" and "642450e40c7dcb752143fa8ed6187844dcf927f2" have entirely different histories.

2 changed files with 0 additions and 54 deletions

View File

@ -5,7 +5,6 @@ import os
import numpy as np
import csv
from ...helpers.treenum import Tree
from enum import Enum
CSV_PATH = "src\\experiments\\algorithms\\data\\"
IMG_PATH = "dataset\\accasia_1210048 (2023_09_28 12_19_26 UTC).JPG"

View File

@ -1,53 +0,0 @@
from sklearn import tree
# from ...helpers.treenum import Tree
from enum import Enum
import csv
import random
SIFT_PATH = "..\\algorithms\\data\\sift.csv"
class Tree(Enum):
ACCASIA = 0
BERK = 1
EIK = 2
ELS = 3
ESDOORN = 4
ES = 5
LINDE = 6
PLATAAN = 7
# [[tree1_data],[tree2_data]]
# [tree1_label, tree2_label]
labels = []
dialect = csv.Dialect
i = 0
done = False
test_index = random.randint(0, 102)
print(test_index)
with open(SIFT_PATH, 'r') as file:
reader = csv.reader(file, delimiter= ',')
matrix = list(reader)
data = [[] for x in range(len(matrix)-1)]
for row in matrix[1:]:
## Remove test case
if i == test_index and done == False:
done = True
data.pop(i)
continue
## append data to lists
labels.append(Tree[row[0].upper()].value)
for element in row[1:]:
data[i].append(element)
## iterator
i += 1
clf = tree.DecisionTreeClassifier()
clf = clf.fit(data, labels)
# tree.plot_tree(clf)
print(Tree[matrix[test_index][0].upper()])
result = clf.predict([matrix[test_index][1:]])
print(Tree(result[0]).name)