Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Weight Initialization configurable #153

Open
3 tasks
Samyssmile opened this issue Dec 21, 2023 · 4 comments
Open
3 tasks

Make Weight Initialization configurable #153

Samyssmile opened this issue Dec 21, 2023 · 4 comments
Labels
good first issue Good for newcomers
Milestone

Comments

@Samyssmile
Copy link
Owner

Samyssmile commented Dec 21, 2023

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 Samyssmile added the good first issue Good for newcomers label Dec 21, 2023
@Samyssmile Samyssmile added this to the 1.0.8 milestone Dec 21, 2023
@manumafe98
Copy link
Collaborator

I would like to try on this one as well!

@manumafe98
Copy link
Collaborator

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?

@Samyssmile
Copy link
Owner Author

Samyssmile commented Jan 8, 2024

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

@manumafe98
Copy link
Collaborator

Joined!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants