Modified network property — NeuroLab 0.3.4 documentation

### Navigation

- index
- next |
- previous |
- NeuroLab 0.3.4 documentation »
- Examples »

# Modified network property

    >>> import neurolab as nl
    >>> # Create network
    >>> net = nl.net.newff([[-1, 1]], [5, 1])
    >>> # Default train function (train_gdx)
    >>> print net.trainf
    Trainer(TrainGDX)
    >>> # Change train function
    >>> net.trainf = nl.train.train_bfgs
    >>> # Change init function
    >>> for l in net.layers:
    ...     l.initf = nl.init.InitRand([-2., 2.], 'wb')
    >>> # new inicialized
    >>> net.init()
    >>> # Change error function
    >>> net.errorf = nl.error.MSE()
    >>> # Change weight of input layer
    >>> net.layers[0].np['w'][:] = 0.0
    >>> net.layers[0].np['w']
    >>> array([[ 0.],
               [ 0.],
               [ 0.],
               [ 0.],
               [ 0.]])
    >>> # Change bias of input layer
    >>> net.layers[0].np['b'][:] = 1.0
    >>> net.layers[0].np['b']
    array([ 1.,  1.,  1.,  1.,  1.])
    >>> # Save network in file
    >>> net.save('test.net')
    >>> # Load network
    >>> net = nl.load('test.net')

### Navigation

- index
- next |
- previous |
- NeuroLab 0.3.4 documentation »
- Examples »