diff --git a/src/machine_learning/perceptron/Perceptron.java b/src/machine_learning/perceptron/Perceptron.java index 3d84713..5ee45ef 100644 --- a/src/machine_learning/perceptron/Perceptron.java +++ b/src/machine_learning/perceptron/Perceptron.java @@ -6,10 +6,12 @@ import java.util.List; public class Perceptron { + private Vector weight; + public void learn(List positives, List negatives) { var iterationCounter = 0; - var weight = this.getInitializationVector(positives, negatives); + this.weight = this.getInitializationVector(positives, negatives); do { diff --git a/test/machine_learning/perceptron/PerceptronTest.java b/test/machine_learning/perceptron/PerceptronTest.java index 5acce2e..4740fca 100644 --- a/test/machine_learning/perceptron/PerceptronTest.java +++ b/test/machine_learning/perceptron/PerceptronTest.java @@ -1,5 +1,6 @@ package machine_learning.perceptron; +import machine_learning.Vector; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; @@ -18,17 +19,17 @@ class PerceptronTest { double biasUnit = 1d; this.positives = new ArrayList<>(List.of( - new Vector(List.of(8d, 4d, biasUnit)), - new Vector(List.of(8d, 6d, biasUnit)), - new Vector(List.of(9d, 2d, biasUnit)), - new Vector(List.of(9d, 5d, biasUnit))) + new Vector(8d, 4d, biasUnit), + new Vector(8d, 6d, biasUnit), + new Vector(9d, 2d, biasUnit), + new Vector(9d, 5d, biasUnit)) ); this.negatives = new ArrayList<>(List.of( - new Vector(List.of(6d, 1d, biasUnit)), - new Vector(List.of(7d, 3d, biasUnit)), - new Vector(List.of(8d, 2d, biasUnit)), - new Vector(List.of(9d, 0d, biasUnit))) + new Vector(6d, 1d, biasUnit), + new Vector(7d, 3d, biasUnit), + new Vector(8d, 2d, biasUnit), + new Vector(9d, 0d, biasUnit)) ); }