package com.naaturel.ANN;

import com.naaturel.ANN.domain.model.neuron.Neuron;
import com.naaturel.ANN.domain.abstraction.Trainer;
import com.naaturel.ANN.domain.model.dataset.DataSet;
import com.naaturel.ANN.domain.model.dataset.DatasetExtractor;
import com.naaturel.ANN.domain.model.neuron.*;
import com.naaturel.ANN.implementation.gradientDescent.Linear;
import com.naaturel.ANN.implementation.training.AdalineTraining;
import com.naaturel.ANN.implementation.training.GradientDescentTraining;

import java.util.*;

public class Main {

    public static void main(String[] args){

        int nbrInput = 2;
        int nbrClass = 3;

        DataSet dataset = new DatasetExtractor()
                .extract("C:/Users/Laurent/Desktop/ANN-framework/src/main/resources/assets/table_3_1.csv", nbrClass);

        List<Neuron> neurons = new ArrayList<>();

        for (int i=0; i < nbrClass; i++){
            List<Synapse> syns = new ArrayList<>();
            for (int j=0; j < nbrInput; j++){
                syns.add(new Synapse(new Input(0), new Weight(0)));
            }

            Bias bias =  new Bias(new Weight(0));

            Neuron n = new Neuron(syns, bias, new Linear());
            neurons.add(n);
        }

        Layer layer = new Layer(neurons);
        Network network = new Network(List.of(layer));

        Trainer trainer = new AdalineTraining();
        trainer.train(network, dataset);

    }
}
