[Numpy-discussion] numpy.random.randn

Robert Kern robert.kern at gmail.com
Fri Mar 9 14:38:55 EST 2018


On Thu, Mar 8, 2018 at 12:44 PM, Marko Asplund <marko.asplund at gmail.com>
wrote:
>
> On Wed, 7 Mar 2018 13:14:36, Robert Kern wrote:
>
> > > With NumPy I'm simply using the following random initilization code:
> > >
> > > np.random.randn(n_h, n_x) * 0.01
> > >
> > > I'm trying to emulate the same behaviour in my Scala code by  sampling
> > from a
> > > Gaussian distribution with mean = 0 and std dev = 1.
>
> > `np.random.randn(n_h, n_x) * 0.01`  gives a Gaussian distribution of
mean=0
> > and stdev=0.01
>
> Sorry for being a bit inaccurate.
> My Scala code actually mirrors the NumPy based random initialization, so
I sample with Gaussian of mean = 0 and std dev = 1, then multiply with 0.01.

Have you verified this? I.e. save out the Scala-initialized network and
load it up with numpy to check the mean and std dev? How about if you run
the numpy NN training with the Scala-initialized network? Does that also
diverge?

--
Robert Kern
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20180309/027105d1/attachment.html>


More information about the NumPy-Discussion mailing list