Single Layer Regression

Linear Regression

import numpy_neural_network as npnn
import npnn_datasets

model = npnn.Sequential()
model.layers = [
  npnn.Dense(1, 1),
  npnn.Linear(1)
]

loss_layer = npnn.loss_layer.RMSLoss(1)
optimizer  = npnn.optimizer.Adam(alpha=2e-2)
dataset    = npnn_datasets.NoisyLinear()

optimizer.norm  = dataset.norm
optimizer.model = model
optimizer.model.chain = loss_layer

Linear Regression (Single Linear Neuron)

Logistic Regression

import numpy_neural_network as npnn
import npnn_datasets

model = npnn.Sequential()
model.layers = [
  npnn.Dense(2, 1),
  npnn.Sigmoid(1)
]

loss_layer = npnn.loss_layer.RMSLoss(1)
optimizer  = npnn.optimizer.Adam(alpha=2e-2)
dataset    = npnn_datasets.ANDFunction()

optimizer.norm  = dataset.norm
optimizer.model = model
optimizer.model.chain = loss_layer

AND Function Regression (Single Sigmoid Neuron)