You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

randInitializeWeights.m 1.0 kB

8 years ago
1234567891011121314151617181920212223242526272829
  1. function W = randInitializeWeights(L_in, L_out)
  2. %RANDINITIALIZEWEIGHTS Randomly initialize the weights of a layer with L_in
  3. %incoming connections and L_out outgoing connections
  4. % W = RANDINITIALIZEWEIGHTS(L_in, L_out) randomly initializes the weights
  5. % of a layer with L_in incoming connections and L_out outgoing
  6. % connections.
  7. %
  8. % Note that W should be set to a matrix of size(L_out, 1 + L_in) as
  9. % the column row of W handles the "bias" terms
  10. %
  11. % You need to return the following variables correctly
  12. W = zeros(L_out, 1 + L_in);
  13. % ====================== YOUR CODE HERE ======================
  14. % Instructions: Initialize W randomly so that we break the symmetry while
  15. % training the neural network.
  16. %
  17. % Note: The first row of W corresponds to the parameters for the bias units
  18. %
  19. epsilon_init = sqrt(6) / sqrt(L_in + L_out);
  20. W = rand(L_out, 1 + L_in) * 2 * epsilon_init - epsilon_init;
  21. % =========================================================================
  22. end

机器学习

Contributors (1)