Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 1.08 KB

README.md

File metadata and controls

38 lines (28 loc) · 1.08 KB

README

JMagicBrain is a Neural network API for java with backpropagation and particle swarm optimization as training methods

Disclaimer

This is a school project, not for real world apps

Tutorial

    ActivationFunction activationFunction = new Sigmoid();
    ErrorFunction errorFunction = new MeanSquaredError();
    WeightInitializer weightInitializer = new DefaultInitializer();
    
    TrainMethod trainMethod = new BackPropagation.BackPropagationBuilder()
        .setErrorFunction(errorFunction)
        .setMaxEpochs(1000)
        .setMaxError(0.09)
        .setMomentum(0.099099)
        .setLearningRate(0.031099)
        .setTrainingSet(images)
        .setExpectedOutput(expected)
        .build();
    
    neuralNetwork = new NeuralNetwork.NeuralNetworkBuilder()
        .setActivationFunction(activationFunction)
        .setErrorFunction(errorFunction)
        .setTrainingMethod(trainMethod)
        .setWeightInitializer(weightInitializer)
        .addLayer(784)
        .addLayer(16)
        .addLayer(10)
        .build();
        
    neuralNetwotk.train();