edux icon indicating copy to clipboard operation
edux copied to clipboard

Make Weight Initialization configurable

Open Samyssmile opened this issue 1 year ago • 4 comments

Educational

https://towardsdatascience.com/weight-initialization-techniques-in-neural-networks-26c649eb3b78

Task

e.g. our DenseLayer implement the HE-Weight Initialization. In some cases its better to use XAVIER

  private void initialize() {
    double standartDeviation = Math.sqrt(2.0 / (weights.get().getRows() + weights.get().getCols()));

    for (int i = 0; i < weights.get().getRows(); i++) {
      for (int j = 0; j < weights.get().getCols(); j++) {
        weights.get().set(i, j, random.nextGaussian() * standartDeviation);
      }
    }
    for (int i = 0; i < bias.get().getRows(); i++) {
      for (int j = 0; j < bias.get().getCols(); j++) {
        bias.get().set(i, j, 0);
      }
    }
  }

We want to make user decide what kind of initialization he want to use. XAVIER or HE.

  • [ ] Create an Enum Initialization with HE function
  • [ ] Make Network configurable
    new NetworkBuilder()
        .withExecutionMode(singleThread)
        .withEpochs(5)
        .withLearningRates(0.001f, 0.001f)
        **.withWeightInitialization(Initialization.HE)**
        .loadModel("mnist_trained.edux")
        .fit(trainLoader, testLoader);
  • [ ] If no Initialization paramter is given, HE is used by default

Samyssmile avatar Dec 21 '23 11:12 Samyssmile

I would like to try on this one as well!

manumafe98 avatar Dec 23 '23 16:12 manumafe98

Hi @Samyssmile where can we discuss about this one? I'm having a bit trouble on knowing how to start. This Initialization is related to the task?

manumafe98 avatar Jan 05 '24 01:01 manumafe98

We have our Discord Chat: https://discord.gg/9aD4pDTQ @manumafe98

Samyssmile avatar Jan 08 '24 13:01 Samyssmile

Joined!

manumafe98 avatar Jan 08 '24 13:01 manumafe98