fix: nn learn now takes training data in its order (this prevents that some vectors are never used)

This commit is contained in:
Lukas Karras
2024-11-26 08:34:27 +01:00
parent 2b1b183247
commit c724954f78
2 changed files with 5 additions and 3 deletions

View File

@@ -38,7 +38,7 @@ class NeuralNetwork:
correct_amount = 0
false_amount = 0
for i in range(len(training_set)):
fv_to_train = random.choice(training_set)
fv_to_train = training_set # random.choice(training_set)
classified_concept, correct = self.classify(fv_to_train)
if not correct:

View File

@@ -68,9 +68,9 @@ def neural_network(training = os.path.abspath(os.path.join(__file__, "..", "trai
next(reader)
i = 0
for row in reader:
i += 1
if i > num_training_vectors:
break
i += 1
float_list = ast.literal_eval(row[3])
@@ -100,4 +100,6 @@ def neural_network(training = os.path.abspath(os.path.join(__file__, "..", "trai
return [cnt_correct, cnt_data - cnt_correct, cnt_data] # richtig, falsch, amount of testing data
if __name__ == "__main__":
for i in range(100, 10000, 100):
print(f"{i} training vectors: ", end="")
neural_network()