>
> I wonder if it's just me or if it's actually confusing: I ran the RBM
> before reading the code and noticed that the higher n_particles is, the
> quicker it is, whereas my ignorant intuition was that "using more stuff
> should take more time". I commented once before about that parameter and I
> still argue that it's a particularity of the learning algorithm and not
> directly of RBMs themselves, so I wouldn't mind having its effect
> intuitively explained.


This is the number of particles used to compute the gradient and make a
gradient step. This means that you need to compute less gradients to
perform an iteration over the training set. If you set n_particles to the
size of the training set, you will perform only one gradient step. That's
fast because the matrix-matrix multiplication in BLAS will be very cache
friendly.

On Sun, Dec 30, 2012 at 7:14 PM, Vlad Niculae <notifications@github.com>wrote:

> In sklearn/neural_networks/rbm.py:
>
> > +        self.intercept_visible_ = np.zeros(X.shape[1], dtype=X.dtype)
> > +        self.h_samples_ = np.zeros((self.n_particles, self.n_components),
> > +            dtype=X.dtype)
> > +
> > +        inds = np.arange(X.shape[0])
> > +        self.random_state.shuffle(inds)
> > +
> > +        n_batches = int(np.ceil(len(inds) / float(self.n_particles)))
> > +
> > +        verbose = self.verbose
> > +        for iteration in xrange(self.n_iter):
> > +            pl = 0.
> > +            if verbose:
> > +                begin = time.time()
> > +            for minibatch in xrange(n_batches):
> > +                pl_batch = self._fit(X[inds[minibatch::n_batches]])
>
> This seems to be done slightly differently than the usual minibatches in
> scikit-learn. I wonder if it affects the speed or anything. Anyway since
> these minibatches are indirectly implied by the n_particles, I think I
> should read the paper first.
>
> I wonder if it's just me or if it's actually confusing: I ran the RBM
> before reading the code and noticed that the higher n_particles is, the
> quicker it is, whereas my ignorant intuition was that "using more stuff
> should take more time". I commented once before about that parameter and I
> still argue that it's a particularity of the learning algorithm and not
> directly of RBMs themselves, so I wouldn't mind having its effect
> intuitively explained.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/scikit-learn/scikit-learn/pull/1200/files#r2521568>.
>
>