### Navigation

- index
- modules |
- previous |
- NeuroLab v0.0.9 documentation »
- Examples »

# Single Layer Perceptron (newp)

Use `neurolab.net.newp()`

    import neurolab as nl

    # Logical &
    input = [[0, 0], [0, 1], [1, 0], [1, 1]]
    target = [[0], [0], [0], [1]]
    # Create net with 2 inputs and 1 neuron
    net = nl.net.newp([[0, 1],[0, 1]], 1)
    # train with delta rule
    # see net.trainf
    error = net.train(input, target, epochs=100, show=10, lr=0.1)
    # Plot results
    import pylab as pl
    pl.plot(error)
    pl.xlabel('Epoch number')
    pl.ylabel('Train error')
    pl.grid()
    pl.show()

Result: |

### Navigation

- index
- modules |
- previous |
- NeuroLab v0.0.9 documentation »
- Examples »