MCPcopy Index your code
hub / github.com/ddbourgin/numpy-ml / __init__

Method __init__

numpy_ml/neural_nets/layers/layers.py:2353–2419  ·  view source on GitHub ↗

r""" A sparse Erdos-Renyi layer with evolutionary rewiring via the sparse evolutionary training (SET) algorithm. Notes ----- .. math:: Y = f( (\mathbf{W} \odot \mathbf{W}_{mask}) \mathbf{X} + \mathbf{b} ) where :math:`\odot` is the eleme

(
        self,
        n_out,
        zeta=0.3,
        epsilon=20,
        act_fn=None,
        init="glorot_uniform",
        optimizer=None,
    )

Source from the content-addressed store, hash-verified

2351
2352class SparseEvolution(LayerBase):
2353 def __init__(
2354 self,
2355 n_out,
2356 zeta=0.3,
2357 epsilon=20,
2358 act_fn=None,
2359 init="glorot_uniform",
2360 optimizer=None,
2361 ):
2362 r"""
2363 A sparse Erdos-Renyi layer with evolutionary rewiring via the sparse
2364 evolutionary training (SET) algorithm.
2365
2366 Notes
2367 -----
2368 .. math::
2369
2370 Y = f( (\mathbf{W} \odot \mathbf{W}_{mask}) \mathbf{X} + \mathbf{b} )
2371
2372 where :math:`\odot` is the elementwise multiplication operation, `f` is
2373 the layer activation function, and :math:`\mathbf{W}_{mask}` is an
2374 evolved binary mask.
2375
2376 Parameters
2377 ----------
2378 n_out : int
2379 The dimensionality of the layer output
2380 zeta : float
2381 Proportion of the positive and negative weights closest to zero to
2382 drop after each training update. Default is 0.3.
2383 epsilon : float
2384 Layer sparsity parameter. Default is 20.
2385 act_fn : str, :doc:`Activation <numpy_ml.neural_nets.activations>` object, or None
2386 The element-wise output nonlinearity used in computing `Y`. If None,
2387 use the identity function :math:`f(X) = X`. Default is None.
2388 init : {'glorot_normal', 'glorot_uniform', 'he_normal', 'he_uniform'}
2389 The weight initialization strategy. Default is `'glorot_uniform'`.
2390 optimizer : str, :doc:`Optimizer <numpy_ml.neural_nets.optimizers>` object, or None
2391 The optimization strategy to use when performing gradient updates
2392 within the :meth:`update` method. If None, use the :class:`SGD
2393 <numpy_ml.neural_nets.optimizers.SGD>` optimizer with default
2394 parameters. Default is None.
2395
2396 Attributes
2397 ----------
2398 X : list
2399 Running list of inputs to the :meth:`forward <numpy_ml.neural_nets.LayerBase.forward>` method since the last call to :meth:`update <numpy_ml.neural_nets.LayerBase.update>`. Only updated if the `retain_derived` argument was set to True.
2400 gradients : dict
2401 Dictionary of loss gradients with regard to the layer parameters
2402 parameters : dict
2403 Dictionary of layer parameters
2404 hyperparameters : dict
2405 Dictionary of layer hyperparameters
2406 derived_variables : dict
2407 Dictionary of any intermediate values computed during
2408 forward/backward propagation.
2409 """ # noqa: E501
2410 super().__init__(optimizer)

Callers

nothing calls this directly

Calls 2

__init__Method · 0.45

Tested by

no test coverage detected