def add_weights(self, name, nin, nout, mean=<NUM_LIT:0>, std=<NUM_LIT:0>, sparsity=<NUM_LIT:0>, diagonal=<NUM_LIT:0>):
glorot = <NUM_LIT:1> / np.sqrt(nin + nout)<EOL>m = self.kwargs.get(<EOL>'<STR_LIT>'.format(name), self.kwargs.get('<STR_LIT>', mean))<EOL>s = self.kwargs.get(<EOL>'<STR_LIT>'.format(name), self.kwargs.get('<STR_LIT>', std or glorot))<EOL>p = self.kwargs.get(<EOL>'<STR_LIT>'.format(name), self.kwargs.get('<STR_LIT>', sparsity))<EOL>d = self.kwargs.get(<EOL>'<STR_LIT>'.format(name), self.kwargs.get('<STR_LIT>', diagonal))<EOL>self._params.append(theano.shared(<EOL>util.random_matrix(nin, nout, mean=m, std=s, sparsity=p,<EOL>diagonal=d, rng=self.rng),<EOL>name=self._fmt(name)))<EOL>
Helper method to create a new weight matrix.

        Parameters
        ----------
        name : str
            Name of the parameter to add.
        nin : int
            Size of "input" for this weight matrix.
        nout : int
            Size of "output" for this weight matrix.
        mean : float, optional
            Mean value for randomly-initialized weights. Defaults to 0.
        std : float, optional
            Standard deviation of initial matrix values. Defaults to
            :math:`1 / sqrt(n_i + n_o)`.
        sparsity : float, optional
            Fraction of weights to be set to zero. Defaults to 0.
        diagonal : float, optional
            Initialize weights to a matrix of zeros with this value along the
            diagonal. Defaults to None, which initializes all weights randomly.