XOR Regression
import numpy_neural_network as npnn
import npnn_datasets
model = npnn.Sequential()
model.layers = [
npnn.Dense(2, 4),
npnn.LeakyReLU(4),
npnn.Dense(4, 4),
npnn.LeakyReLU(4),
npnn.Dense(4, 1),
npnn.Sigmoid(1)
]
loss_layer = npnn.loss_layer.RMSLoss(1)
optimizer = npnn.optimizer.Adam(alpha=2e-2)
dataset = npnn_datasets.XORFunction()
optimizer.norm = dataset.norm
optimizer.model = model
optimizer.model.chain = loss_layer
XOR Function Regression (Small LeakyReLU-based Network)