From 89aa86d259b0421ffdb4b1ad6fa176b3b185ee42 Mon Sep 17 00:00:00 2001 From: Fabian Poker <fp168637> Date: Sat, 3 Jun 2023 10:27:13 +0200 Subject: [PATCH] Beliebig viele Features P10 --- aufgaben/p10/evaluation.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aufgaben/p10/evaluation.py b/aufgaben/p10/evaluation.py index 731165a..69f5e50 100644 --- a/aufgaben/p10/evaluation.py +++ b/aufgaben/p10/evaluation.py @@ -33,7 +33,8 @@ def evaluate_algorithm(training_data, test_data, algorithm, evaluator, args=None def evaluate(): - test_data, training_data = get_evaluation_data(200, [standard_deviation, arithmetic_mean, median, maximum]) + features = [standard_deviation, arithmetic_mean, median, maximum] + test_data, training_data = get_evaluation_data(200,features) classes = list(set(test[1] for test in test_data)) # DecisionTree @@ -47,7 +48,7 @@ def evaluate(): # PLA print("\nPLA") - weights = [random.random(), random.random(), random.random(), random.random()] + weights = [random.random() for _ in features] threshold = 0.5 perceptron = Perceptron(weights, threshold, numpy.tanh) train(perceptron, training_data, 10000, 0.1) -- GitLab