Rename some stuff

This commit is contained in:
2026-03-29 21:32:08 +02:00
parent 83526b72d4
commit 0fe309cd4e
38 changed files with 334 additions and 215 deletions

View File

@@ -9,10 +9,10 @@ import com.naaturel.ANN.domain.model.neuron.*;
import com.naaturel.ANN.domain.model.training.TrainingPipeline;
import com.naaturel.ANN.implementation.adaline.AdalineTrainingContext;
import com.naaturel.ANN.implementation.gradientDescent.*;
import com.naaturel.ANN.implementation.simplePerceptron.SimpleCorrectionStrategy;
import com.naaturel.ANN.implementation.simplePerceptron.SimpleDeltaStrategy;
import com.naaturel.ANN.implementation.simplePerceptron.SimpleErrorRegistrationStrategy;
import com.naaturel.ANN.implementation.simplePerceptron.SimplePredictionStrategy;
import com.naaturel.ANN.implementation.simplePerceptron.SimpleCorrectionStep;
import com.naaturel.ANN.implementation.simplePerceptron.SimpleDeltaStep;
import com.naaturel.ANN.implementation.simplePerceptron.SimpleErrorRegistrationStep;
import com.naaturel.ANN.implementation.simplePerceptron.SimplePredictionStep;
import com.naaturel.ANN.implementation.training.steps.*;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -29,7 +29,7 @@ public class AdalineTest {
private List<Synapse> synapses;
private Bias bias;
private Network network;
private FullyConnectedNetwork network;
private TrainingPipeline pipeline;
@@ -44,20 +44,20 @@ public class AdalineTest {
bias = new Bias(new Weight(0));
Neuron neuron = new Neuron(syns, bias, new Linear());
Neuron neuron = new Neuron(syns, bias, new Linear(1, 0));
Layer layer = new Layer(List.of(neuron));
network = new Network(List.of(layer));
network = new FullyConnectedNetwork(List.of(layer));
context = new AdalineTrainingContext();
context.dataset = dataset;
context.model = network;
List<TrainingStep> steps = List.of(
new PredictionStep(new SimplePredictionStrategy(context)),
new DeltaStep(new SimpleDeltaStrategy(context)),
new LossStep(new SquareLossStrategy(context)),
new ErrorRegistrationStep(new SimpleErrorRegistrationStrategy(context)),
new WeightCorrectionStep(new SimpleCorrectionStrategy(context))
new PredictionStep(new SimplePredictionStep(context)),
new DeltaStep(new SimpleDeltaStep(context)),
new LossStep(new SquareLossStep(context)),
new ErrorRegistrationStep(new SimpleErrorRegistrationStep(context)),
new WeightCorrectionStep(new SimpleCorrectionStep(context))
);
pipeline = new TrainingPipeline(steps)

View File

@@ -25,7 +25,7 @@ public class GradientDescentTest {
private List<Synapse> synapses;
private Bias bias;
private Network network;
private FullyConnectedNetwork network;
private TrainingPipeline pipeline;
@@ -40,9 +40,9 @@ public class GradientDescentTest {
bias = new Bias(new Weight(0));
Neuron neuron = new Neuron(syns, bias, new Linear());
Neuron neuron = new Neuron(syns, bias, new Linear(1, 0));
Layer layer = new Layer(List.of(neuron));
network = new Network(List.of(layer));
network = new FullyConnectedNetwork(List.of(layer));
context = new GradientDescentTrainingContext();
context.dataset = dataset;
@@ -50,9 +50,9 @@ public class GradientDescentTest {
context.correctorTerms = new ArrayList<>();
List<TrainingStep> steps = List.of(
new PredictionStep(new SimplePredictionStrategy(context)),
new DeltaStep(new SimpleDeltaStrategy(context)),
new LossStep(new SquareLossStrategy(context)),
new PredictionStep(new SimplePredictionStep(context)),
new DeltaStep(new SimpleDeltaStep(context)),
new LossStep(new SquareLossStep(context)),
new ErrorRegistrationStep(new GradientDescentErrorStrategy(context))
);
@@ -82,7 +82,7 @@ public class GradientDescentTest {
context.learningRate = 0.2F;
pipeline.afterEpoch(ctx -> {
context.globalLoss /= context.dataset.size();
new GradientDescentCorrectionStrategy(context).apply();
new GradientDescentCorrectionStrategy(context).run();
int index = ctx.epoch-1;
if(index >= expectedGlobalLosses.size()) return;

View File

@@ -24,7 +24,7 @@ public class SimplePerceptronTest {
private List<Synapse> synapses;
private Bias bias;
private Network network;
private FullyConnectedNetwork network;
private TrainingPipeline pipeline;
@@ -41,18 +41,18 @@ public class SimplePerceptronTest {
Neuron neuron = new Neuron(syns, bias, new Heaviside());
Layer layer = new Layer(List.of(neuron));
network = new Network(List.of(layer));
network = new FullyConnectedNetwork(List.of(layer));
context = new SimpleTrainingContext();
context.dataset = dataset;
context.model = network;
List<TrainingStep> steps = List.of(
new PredictionStep(new SimplePredictionStrategy(context)),
new DeltaStep(new SimpleDeltaStrategy(context)),
new PredictionStep(new SimplePredictionStep(context)),
new DeltaStep(new SimpleDeltaStep(context)),
new LossStep(new SimpleLossStrategy(context)),
new ErrorRegistrationStep(new SimpleErrorRegistrationStrategy(context)),
new WeightCorrectionStep(new SimpleCorrectionStrategy(context))
new ErrorRegistrationStep(new SimpleErrorRegistrationStep(context)),
new WeightCorrectionStep(new SimpleCorrectionStep(context))
);
pipeline = new TrainingPipeline(steps);